WineGums example: rename function.

This commit is contained in:
Jonathan Puckey 2014-03-13 13:35:40 +01:00
parent 6c7c4d0798
commit 4751fc6dc8

View file

@ -39,14 +39,14 @@
Ball.prototype = { Ball.prototype = {
iterate: function() { iterate: function() {
this.checkWallCollision(); this.checkBorders();
if (this.vector.length > this.maxVec) if (this.vector.length > this.maxVec)
this.vector.length = this.maxVec; this.vector.length = this.maxVec;
this.point += this.vector; this.point += this.vector;
this.updateShape(); this.updateShape();
}, },
checkWallCollision: function() { checkBorders: function() {
var size = view.size; var size = view.size;
if (this.point.x < -this.radius) if (this.point.x < -this.radius)
this.point.x = size.width + this.radius; this.point.x = size.width + this.radius;
@ -128,7 +128,8 @@
angle: 360 * Math.random(), angle: 360 * Math.random(),
length: Math.random() * 10 length: Math.random() * 10
}); });
balls.push(new Ball(Math.random() * 60 + 60, position, vector)); var radius = Math.random() * 60 + 60;
balls.push(new Ball(radius, position, vector));
} }
function onFrame() { function onFrame() {