Skip to content

Commit 6dd5ec5

Browse files
committed
update demo and example render styles
1 parent d258411 commit 6dd5ec5

19 files changed

Lines changed: 61 additions & 63 deletions

demo/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
opacity: 0.5;
6262
background: transparent !important;
6363
}
64+
65+
.matter-demo canvas {
66+
border: 1px solid rgba(255, 255, 255, 0.07);
67+
}
6468
</style>
6569
</head>
6670
<body>

examples/avalanche.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ Example.avalanche = function() {
4141
var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y) {
4242
return Bodies.circle(x, y, Common.random(10, 20), { friction: 0.00001, restitution: 0.5, density: 0.001 });
4343
});
44-
44+
4545
World.add(world, stack);
4646

4747
World.add(world, [
48-
Bodies.rectangle(200, 150, 700, 20, { isStatic: true, angle: Math.PI * 0.06 }),
49-
Bodies.rectangle(500, 350, 700, 20, { isStatic: true, angle: -Math.PI * 0.06 }),
50-
Bodies.rectangle(340, 580, 700, 20, { isStatic: true, angle: Math.PI * 0.04 })
48+
Bodies.rectangle(200, 150, 700, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' } }),
49+
Bodies.rectangle(500, 350, 700, 20, { isStatic: true, angle: -Math.PI * 0.06, render: { fillStyle: '#060a19' } }),
50+
Bodies.rectangle(340, 580, 700, 20, { isStatic: true, angle: Math.PI * 0.04, render: { fillStyle: '#060a19' } })
5151
]);
5252

5353
// add mouse control

examples/ballPool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Example.ballPool = function() {
3939

4040
// add bodies
4141
World.add(world, [
42-
Bodies.rectangle(400, 600, 1200, 50.5, { isStatic: true })
42+
Bodies.rectangle(400, 600, 1200, 50.5, { isStatic: true, render: { fillStyle: '#060a19' } })
4343
]);
4444

4545
var stack = Composites.stack(100, 0, 10, 8, 10, 10, function(x, y) {

examples/bridge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Example.bridge = function() {
4444
density: 0.005,
4545
frictionAir: 0.05,
4646
render: {
47-
fillStyle: '#575375'
47+
fillStyle: '#060a19'
4848
}
4949
});
5050
});

examples/car.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ Example.car = function() {
4848
World.add(world, Composites.car(350, 300, 150 * scale, 30 * scale, 30 * scale));
4949

5050
World.add(world, [
51-
Bodies.rectangle(200, 150, 400, 20, { isStatic: true, angle: Math.PI * 0.06 }),
52-
Bodies.rectangle(500, 350, 650, 20, { isStatic: true, angle: -Math.PI * 0.06 }),
53-
Bodies.rectangle(300, 560, 600, 20, { isStatic: true, angle: Math.PI * 0.04 })
51+
Bodies.rectangle(200, 150, 400, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' }}),
52+
Bodies.rectangle(500, 350, 650, 20, { isStatic: true, angle: -Math.PI * 0.06, render: { fillStyle: '#060a19' }}),
53+
Bodies.rectangle(300, 560, 600, 20, { isStatic: true, angle: Math.PI * 0.04, render: { fillStyle: '#060a19' }})
5454
]);
5555

5656
// add mouse control

examples/catapult.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ Example.catapult = function() {
4848
World.add(world, [
4949
stack,
5050
catapult,
51-
Bodies.rectangle(400, 600, 800, 50.5, { isStatic: true }),
52-
Bodies.rectangle(250, 555, 20, 50, { isStatic: true }),
53-
Bodies.rectangle(400, 535, 20, 80, { isStatic: true, collisionFilter: { group: group } }),
51+
Bodies.rectangle(400, 600, 800, 50.5, { isStatic: true, render: { fillStyle: '#060a19' } }),
52+
Bodies.rectangle(250, 555, 20, 50, { isStatic: true, render: { fillStyle: '#060a19' } }),
53+
Bodies.rectangle(400, 535, 20, 80, { isStatic: true, collisionFilter: { group: group }, render: { fillStyle: '#060a19' } }),
5454
Bodies.circle(560, 100, 50, { density: 0.005 }),
5555
Constraint.create({
5656
bodyA: catapult,

examples/cloth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Example.cloth = function() {
4343

4444
World.add(world, [
4545
cloth,
46-
Bodies.circle(300, 500, 80, { isStatic: true }),
47-
Bodies.rectangle(500, 480, 80, 80, { isStatic: true }),
46+
Bodies.circle(300, 500, 80, { isStatic: true, render: { fillStyle: '#060a19' }}),
47+
Bodies.rectangle(500, 480, 80, 80, { isStatic: true, render: { fillStyle: '#060a19' }}),
4848
Bodies.rectangle(400, 609, 800, 50, { isStatic: true })
4949
]);
5050

examples/collisionFiltering.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ Example.collisionFiltering = function() {
2323
options: {
2424
width: 800,
2525
height: 600,
26-
wireframes: false,
27-
background: '#111'
26+
wireframes: false
2827
}
2928
});
3029

@@ -40,9 +39,9 @@ Example.collisionFiltering = function() {
4039
greenCategory = 0x0004,
4140
blueCategory = 0x0008;
4241

43-
var redColor = '#C44D58',
44-
blueColor = '#4ECDC4',
45-
greenColor = '#C7F464';
42+
var colorA = '#f55a3c',
43+
colorB = '#063e7b',
44+
colorC = '#f5d259';
4645

4746
// add floor
4847
World.add(world, Bodies.rectangle(400, 600, 900, 50, {
@@ -57,14 +56,14 @@ Example.collisionFiltering = function() {
5756
World.add(world,
5857
Composites.stack(275, 100, 5, 9, 10, 10, function(x, y, column, row) {
5958
var category = redCategory,
60-
color = redColor;
59+
color = colorA;
6160

6261
if (row > 5) {
6362
category = blueCategory;
64-
color = blueColor;
63+
color = colorB;
6564
} else if (row > 2) {
6665
category = greenCategory;
67-
color = greenColor;
66+
color = colorC;
6867
}
6968

7069
return Bodies.circle(x, y, 20, {
@@ -87,7 +86,7 @@ Example.collisionFiltering = function() {
8786
mask: defaultCategory | greenCategory
8887
},
8988
render: {
90-
fillStyle: greenColor
89+
fillStyle: colorC
9190
}
9291
})
9392
);
@@ -99,7 +98,7 @@ Example.collisionFiltering = function() {
9998
mask: defaultCategory | redCategory
10099
},
101100
render: {
102-
fillStyle: redColor
101+
fillStyle: colorA
103102
}
104103
})
105104
);
@@ -111,7 +110,7 @@ Example.collisionFiltering = function() {
111110
mask: defaultCategory | blueCategory
112111
},
113112
render: {
114-
fillStyle: blueColor
113+
fillStyle: colorB
115114
}
116115
})
117116
);

examples/concave.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Example.concave = function() {
4747
horseShoe = Vertices.fromPath('35 7 19 17 14 38 14 58 25 79 45 85 65 84 65 66 46 67 34 59 30 44 33 29 45 23 66 23 66 7 53 7');
4848

4949
var stack = Composites.stack(50, 50, 6, 4, 10, 10, function(x, y) {
50-
var color = Common.choose(['#556270', '#4ECDC4', '#C7F464', '#FF6B6B', '#C44D58']);
50+
var color = Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1']);
5151
return Bodies.fromVertices(x, y, Common.choose([arrow, chevron, star, horseShoe]), {
5252
render: {
5353
fillStyle: color,

examples/doublePendulum.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ Example.doublePendulum = function() {
2626
options: {
2727
width: 800,
2828
height: 600,
29-
wireframes: false,
30-
background: '#0f0f13'
29+
wireframes: false
3130
}
3231
});
3332

@@ -54,9 +53,6 @@ Example.doublePendulum = function() {
5453
});
5554
});
5655

57-
pendulum.bodies[0].render.strokeStyle = '#4a485b';
58-
pendulum.bodies[1].render.strokeStyle = '#4a485b';
59-
6056
world.gravity.scale = 0.002;
6157

6258
Composites.chain(pendulum, 0.45, 0, -0.45, 0, {

0 commit comments

Comments
 (0)