0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

demos are now jshinted

This commit is contained in:
liabru 2014-03-20 15:10:48 +00:00
parent 1a152309a0
commit 471754611a
3 changed files with 70 additions and 53 deletions

View file

@ -41,7 +41,7 @@ module.exports = function(grunt) {
options: { options: {
jshintrc: '.jshintrc' jshintrc: '.jshintrc'
}, },
all: ['src/**/*.js', '!src/module/*'] all: ['src/**/*.js', 'demo/js/*.js', '!src/module/*']
}, },
connect: { connect: {
watch: { watch: {

View file

@ -174,12 +174,14 @@
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, column, row) {
switch (Math.round(Common.random(0, 1))) { switch (Math.round(Common.random(0, 1))) {
case 0: case 0:
if (Math.random() < 0.8) { if (Math.random() < 0.8) {
return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50)); return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50));
} else { } else {
return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30)); return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30));
} }
break;
case 1: case 1:
var sides = Math.round(Common.random(1, 8)); var sides = Math.round(Common.random(1, 8));
@ -203,14 +205,17 @@
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, column, row) {
switch (Math.round(Common.random(0, 1))) { switch (Math.round(Common.random(0, 1))) {
case 0: case 0:
if (Math.random() < 0.8) { if (Math.random() < 0.8) {
return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50)); return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50));
} else { } else {
return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30)); return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30));
} }
break;
case 1: case 1:
return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50)); return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50));
} }
}); });
@ -326,14 +331,17 @@
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, column, row) {
switch (Math.round(Common.random(0, 1))) { switch (Math.round(Common.random(0, 1))) {
case 0: case 0:
if (Math.random() < 0.8) { if (Math.random() < 0.8) {
return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50)); return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50));
} else { } else {
return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30)); return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30));
} }
break;
case 1: case 1:
return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50)); return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50));
} }
}); });
@ -351,14 +359,17 @@
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, column, row) {
switch (Math.round(Common.random(0, 1))) { switch (Math.round(Common.random(0, 1))) {
case 0: case 0:
if (Math.random() < 0.8) { if (Math.random() < 0.8) {
return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50)); return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50));
} else { } else {
return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30)); return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30));
} }
break;
case 1: case 1:
return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50)); return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50));
} }
}); });
@ -377,14 +388,17 @@
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, column, row) {
switch (Math.round(Common.random(0, 1))) { switch (Math.round(Common.random(0, 1))) {
case 0: case 0:
if (Math.random() < 0.8) { if (Math.random() < 0.8) {
return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50)); return Bodies.rectangle(x, y, Common.random(20, 50), Common.random(20, 50));
} else { } else {
return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30)); return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30));
} }
break;
case 1: case 1:
return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50)); return Bodies.polygon(x, y, Math.round(Common.random(1, 8)), Common.random(20, 50));
} }
}); });

View file

@ -136,14 +136,17 @@
var stack = Composites.stack(20, 20, 10, 5, 0, 0, function(x, y, column, row) { var stack = Composites.stack(20, 20, 10, 5, 0, 0, function(x, y, column, row) {
switch (Math.round(Common.random(0, 1))) { switch (Math.round(Common.random(0, 1))) {
case 0: case 0:
if (Math.random() < 0.8) { if (Math.random() < 0.8) {
return Bodies.rectangle(x, y, Common.random(20, 40), Common.random(20, 40), { friction: 0.01, restitution: 0.4 }); return Bodies.rectangle(x, y, Common.random(20, 40), Common.random(20, 40), { friction: 0.01, restitution: 0.4 });
} else { } else {
return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30), { friction: 0.01, restitution: 0.4 }); return Bodies.rectangle(x, y, Common.random(80, 120), Common.random(20, 30), { friction: 0.01, restitution: 0.4 });
} }
break;
case 1: case 1:
return Bodies.polygon(x, y, Math.round(Common.random(4, 6)), Common.random(20, 40), { friction: 0.01, restitution: 0.4 }); return Bodies.polygon(x, y, Math.round(Common.random(4, 6)), Common.random(20, 40), { friction: 0.01, restitution: 0.4 });
} }
}); });