mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Small change to Flock example.
This commit is contained in:
parent
de466edc23
commit
3751dd0a38
1 changed files with 5 additions and 3 deletions
|
@ -20,6 +20,8 @@
|
|||
head.strokeColor = null;
|
||||
var headSymbol = new Symbol(head);
|
||||
|
||||
var size = document.size;
|
||||
|
||||
var Boid = Base.extend({
|
||||
initialize: function(position, maxSpeed, maxForce) {
|
||||
var strength = Math.random() * 0.5;
|
||||
|
@ -129,8 +131,8 @@
|
|||
var loc = this.loc,
|
||||
r = this.r,
|
||||
oldLoc = this.loc.clone(),
|
||||
width = document.size.width,
|
||||
height = document.size.height;
|
||||
width = size.width,
|
||||
height = size.height;
|
||||
if (loc.x < -r) loc.x = width + r;
|
||||
if (loc.y < -r) loc.y = height + r;
|
||||
if (loc.x > width + r) loc.x = -r;
|
||||
|
@ -281,7 +283,7 @@
|
|||
|
||||
// Resize the document, whenever the window is resized,
|
||||
window.onresize = function(event) {
|
||||
document.size = [window.innerWidth, window.innerHeight];
|
||||
size = document.size = [window.innerWidth, window.innerHeight];
|
||||
heartPath.position = document.bounds.center;
|
||||
document.redraw();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue