Skip to content

Commit

Permalink
removed unused vars from examples
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Aug 25, 2015
1 parent b722012 commit 0bff037
Show file tree
Hide file tree
Showing 32 changed files with 53 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ module.exports = function(grunt) {

grunt.registerTask('default', ['concat:examples', 'test', 'build']);
grunt.registerTask('test', ['build:dev', 'connect:serve', 'jshint', 'test:demo', 'test:demoNode']);
grunt.registerTask('dev', ['build:dev', 'connect:watch', 'watch']);
grunt.registerTask('dev', ['concat:examples', 'build:dev', 'connect:watch', 'watch']);

grunt.registerTask('test:demo', function() {
var updateAll = grunt.option('updateAll'),
Expand Down
6 changes: 4 additions & 2 deletions demo/js/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
// Matter aliases
var Example = Matter.Example,
Engine = Matter.Engine,
World = Matter.World
World = Matter.World,
Common = Matter.Common,
Bodies = Matter.Bodies,
Events = Matter.Events;
Events = Matter.Events,
Mouse = Matter.Mouse,
MouseConstraint = Matter.MouseConstraint;

// MatterTools aliases
if (window.MatterTools) {
Expand Down
2 changes: 1 addition & 1 deletion examples/avalanche.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y) {
return Bodies.circle(x, y, Common.random(10, 20), { friction: 0.00001, restitution: 0.5, density: 0.001 });
});

Expand Down
2 changes: 1 addition & 1 deletion examples/ballPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(100, 50, 10, 15, 10, 10, function(x, y, column, row) {
var stack = Composites.stack(100, 50, 10, 15, 10, 10, function(x, y) {
return Bodies.circle(x, y, Common.random(15, 30), { restitution: 0.6, friction: 0.1 });
});

Expand Down
2 changes: 1 addition & 1 deletion examples/beachBalls.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x, y, column, row) {
var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x, y) {
return Bodies.circle(x, y, 75, { restitution: 0.9 });
});

Expand Down
4 changes: 2 additions & 2 deletions examples/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
world = engine.world,
group = Body.nextGroup(true);

var bridge = Composites.stack(150, 300, 9, 1, 10, 10, function(x, y, column, row) {
var bridge = Composites.stack(150, 300, 9, 1, 10, 10, function(x, y) {
return Bodies.rectangle(x, y, 50, 20, { collisionFilter: { group: group } });
});

Composites.chain(bridge, 0.5, 0, -0.5, 0, { stiffness: 0.9 });

var stack = Composites.stack(200, 40, 6, 3, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(200, 40, 6, 3, 0, 0, function(x, y) {
return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 40));
});

Expand Down
2 changes: 1 addition & 1 deletion examples/broadphase.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y) {
switch (Math.round(Common.random(0, 1))) {

case 0:
Expand Down
2 changes: 1 addition & 1 deletion examples/catapult.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(250, 255, 1, 6, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(250, 255, 1, 6, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 30, 30);
});

Expand Down
4 changes: 2 additions & 2 deletions examples/chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
world = engine.world,
group = Body.nextGroup(true);

var ropeA = Composites.stack(200, 100, 5, 2, 10, 10, function(x, y, column, row) {
var ropeA = Composites.stack(200, 100, 5, 2, 10, 10, function(x, y) {
return Bodies.rectangle(x, y, 50, 20, { collisionFilter: { group: group } });
});

Expand All @@ -28,7 +28,7 @@

group = Body.nextGroup(true);

var ropeB = Composites.stack(500, 100, 5, 2, 10, 10, function(x, y, column, row) {
var ropeB = Composites.stack(500, 100, 5, 2, 10, 10, function(x, y) {
return Bodies.circle(x, y, 20, { collisionFilter: { group: group } });
});

Expand Down
2 changes: 1 addition & 1 deletion examples/circleStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(100, 100, 10, 10, 20, 0, function(x, y, column, row) {
var stack = Composites.stack(100, 100, 10, 10, 20, 0, function(x, y) {
return Bodies.circle(x, y, 20);
});

Expand Down
3 changes: 1 addition & 2 deletions examples/compositeManipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
Example.compositeManipulation = function(demo) {
var engine = demo.engine,
world = engine.world,
mouseConstraint = demo.mouseConstraint,
sceneEvents = demo.sceneEvents;

var stack = Composites.stack(200, 200, 4, 4, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(200, 200, 4, 4, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 40, 40);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/compoundStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
world = engine.world;
var size = 50;

var stack = Composites.stack(100, 220, 12, 6, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(100, 220, 12, 6, 0, 0, function(x, y) {
var partA = Bodies.rectangle(x, y, size, size / 5),
partB = Bodies.rectangle(x, y, size / 5, size, { render: partA.render });

Expand Down
10 changes: 2 additions & 8 deletions examples/concave.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
(function() {

var Engine = Matter.Engine,
World = Matter.World,
var World = Matter.World,
Bodies = Matter.Bodies,
Body = Matter.Body,
Composite = Matter.Composite,
Composites = Matter.Composites,
Common = Matter.Common,
Constraint = Matter.Constraint,
Events = Matter.Events,
Bounds = Matter.Bounds,
Vertices = Matter.Vertices;

Example.concave = function(demo) {
Expand All @@ -21,7 +15,7 @@
star = Vertices.fromPath('50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38'),
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');

var stack = Composites.stack(50, 50, 6, 4, 10, 10, function(x, y, column, row) {
var stack = Composites.stack(50, 50, 6, 4, 10, 10, function(x, y) {
var color = Common.choose(['#556270', '#4ECDC4', '#C7F464', '#FF6B6B', '#C44D58']);
return Bodies.fromVertices(x, y, Common.choose([arrow, chevron, star, horseShoe]), {
render: {
Expand Down
2 changes: 1 addition & 1 deletion examples/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

// scene code

var stack = Composites.stack(50, 100, 8, 4, 50, 50, function(x, y, column, row) {
var stack = Composites.stack(50, 100, 8, 4, 50, 50, function(x, y) {
return Bodies.circle(x, y, 15, { restitution: 1, render: { strokeStyle: '#777' } });
});

Expand Down
2 changes: 1 addition & 1 deletion examples/gravity.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

engine.world.gravity.y = -1;

var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y) {
switch (Math.round(Common.random(0, 1))) {

case 0:
Expand Down
2 changes: 1 addition & 1 deletion examples/mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(20, 20, 15, 4, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(20, 20, 15, 4, 0, 0, function(x, y) {
var sides = Math.round(Common.random(1, 8));

// triangles can be a little unstable, so avoid until fixed
Expand Down
2 changes: 1 addition & 1 deletion examples/mixedSolid.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(50, 50, 12, 3, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(50, 50, 12, 3, 0, 0, function(x, y) {
switch (Math.round(Common.random(0, 1))) {

case 0:
Expand Down
2 changes: 1 addition & 1 deletion examples/pyramid.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.pyramid(100, 258, 15, 10, 0, 0, function(x, y, column, row) {
var stack = Composites.pyramid(100, 258, 15, 10, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 40, 40);
});

Expand Down
6 changes: 2 additions & 4 deletions examples/raycasting.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
(function() {

var Engine = Matter.Engine,
World = Matter.World,
var World = Matter.World,
Bodies = Matter.Bodies,
Composite = Matter.Composite,
Composites = Matter.Composites,
Common = Matter.Common,
Events = Matter.Events,
Vertices = Matter.Vertices,
Mouse = Matter.Mouse,
Query = Matter.Query;

Example.raycasting = function(demo) {
Expand All @@ -17,7 +15,7 @@
sceneEvents = demo.sceneEvents,
mouseConstraint = demo.mouseConstraint;

var stack = Composites.stack(20, 20, 15, 4, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(20, 20, 15, 4, 0, 0, function(x, y) {
switch (Math.round(Common.random(0, 1))) {

case 0:
Expand Down
3 changes: 1 addition & 2 deletions examples/restitution.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(function() {

var World = Matter.World,
Bodies = Matter.Bodies,
Common = Matter.Common;
Bodies = Matter.Bodies;

Example.restitution = function(demo) {
var engine = demo.engine,
Expand Down
5 changes: 3 additions & 2 deletions examples/sleeping.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
var World = Matter.World,
Bodies = Matter.Bodies,
Composites = Matter.Composites,
Common = Matter.Common;
Common = Matter.Common,
Events = Matter.Events;

Example.sleeping = function(demo) {
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(50, 50, 12, 3, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(50, 50, 12, 3, 0, 0, function(x, y) {
switch (Math.round(Common.random(0, 1))) {

case 0:
Expand Down
4 changes: 2 additions & 2 deletions examples/slingshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
});

var pyramid = Composites.pyramid(500, 300, 9, 10, 0, 0, function(x, y, column, row) {
var pyramid = Composites.pyramid(500, 300, 9, 10, 0, 0, function(x, y, column) {
var texture = column % 2 === 0 ? './img/block.png' : './img/block-2.png';
return Bodies.rectangle(x, y, 25, 40, { render: { sprite: { texture: texture } } });
});
Expand All @@ -40,7 +40,7 @@
}
});

var pyramid2 = Composites.pyramid(550, 0, 5, 10, 0, 0, function(x, y, column, row) {
var pyramid2 = Composites.pyramid(550, 0, 5, 10, 0, 0, function(x, y, column) {
var texture = column % 2 === 0 ? './img/block.png' : './img/block-2.png';
return Bodies.rectangle(x, y, 25, 40, { render: { sprite: { texture: texture } } });
});
Expand Down
6 changes: 3 additions & 3 deletions examples/sprites.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

var World = Matter.World,
Bodies = Matter.Bodies,
Composites = Matter.Composites;
Composites = Matter.Composites,
Common = Matter.Common;

Example.sprites = function(demo) {
var engine = demo.engine,
world = engine.world,
mouseConstraint = demo.mouseConstraint,
offset = 10,
options = {
isStatic: true,
Expand All @@ -26,7 +26,7 @@
Bodies.rectangle(-offset, 300, 50.5, 600.5 + 2 * offset, options)
]);

var stack = Composites.stack(20, 20, 10, 4, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(20, 20, 10, 4, 0, 0, function(x, y) {
if (Common.random() > 0.35) {
return Bodies.rectangle(x, y, 64, 64, {
render: {
Expand Down
2 changes: 1 addition & 1 deletion examples/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(100, 300, 10, 5, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(100, 300, 10, 5, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 40, 40);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/staticFriction.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
size = 50,
counter = -1;

var stack = Composites.stack(350, 470 - 6 * size, 1, 6, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(350, 470 - 6 * size, 1, 6, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, size * 2, size, {
slop: 0.5,
friction: 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/stress.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(90, 50, 18, 15, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(90, 50, 18, 15, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 35, 35);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/stress2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(100, 120, 25, 18, 0, 0, function(x, y, column, row) {
var stack = Composites.stack(100, 120, 25, 18, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 25, 25);
});

Expand Down
14 changes: 2 additions & 12 deletions examples/terrain.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
(function() {

var Engine = Matter.Engine,
World = Matter.World,
var World = Matter.World,
Bodies = Matter.Bodies,
Body = Matter.Body,
Composite = Matter.Composite,
Composites = Matter.Composites,
Common = Matter.Common,
Constraint = Matter.Constraint,
Events = Matter.Events,
Bounds = Matter.Bounds,
Vector = Matter.Vector,
Vertices = Matter.Vertices,
MouseConstraint = Matter.MouseConstraint,
Mouse = Matter.Mouse,
Query = Matter.Query,
Svg = Matter.Svg;

Expand Down Expand Up @@ -49,7 +39,7 @@
restitution: 0.6
};

World.add(world, Composites.stack(80, 100, 20, 20, 10, 10, function(x, y, column, row) {
World.add(world, Composites.stack(80, 100, 20, 20, 10, 10, function(x, y) {
if (Query.point([terrain], { x: x, y: y }).length === 0) {
return Bodies.polygon(x, y, 5, 12, bodyOptions);
}
Expand Down
Loading

0 comments on commit 0bff037

Please sign in to comment.