mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Some minor changes to the Flock example.
This commit is contained in:
parent
b73afe3fc0
commit
2184fa144b
1 changed files with 8 additions and 10 deletions
|
@ -35,7 +35,7 @@
|
||||||
this.head = new PlacedSymbol(head);
|
this.head = new PlacedSymbol(head);
|
||||||
this.path = new Path();
|
this.path = new Path();
|
||||||
this.shortPath = new Path();
|
this.shortPath = new Path();
|
||||||
this.shortPath.strokeWidth = 3;
|
this.shortPath.strokeWidth = 4;
|
||||||
for(var i = 0, l = strength * 10 + 10; i < l; i++) {
|
for(var i = 0, l = strength * 10 + 10; i < l; i++) {
|
||||||
this.path.add(this.loc);
|
this.path.add(this.loc);
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
|
@ -70,7 +70,6 @@
|
||||||
segment.point += rotated;
|
segment.point += rotated;
|
||||||
lastVector = vector;
|
lastVector = vector;
|
||||||
}
|
}
|
||||||
this.path.smooth();
|
|
||||||
this.head.position = this.loc;
|
this.head.position = this.loc;
|
||||||
var vector = this.loc - this.lastLoc;
|
var vector = this.loc - this.lastLoc;
|
||||||
var rot = vector.angle;
|
var rot = vector.angle;
|
||||||
|
@ -78,9 +77,8 @@
|
||||||
this.lastRot = rot;
|
this.lastRot = rot;
|
||||||
|
|
||||||
var shortSegments = this.shortPath.segments;
|
var shortSegments = this.shortPath.segments;
|
||||||
for (var i = 0; i < 3; i++) {
|
for (var i = 0; i < 3; i++)
|
||||||
shortSegments[i] = segments[i].clone();
|
shortSegments[i] = segments[i].clone();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// We accumulate a new acceleration each time based on three rules
|
// We accumulate a new acceleration each time based on three rules
|
||||||
|
|
Loading…
Reference in a new issue