Simplify vector geometry in Chain example.

This commit is contained in:
Jürg Lehni 2011-04-20 23:29:46 +01:00
parent 1d92aea8e2
commit d25ab05e25

View file

@ -24,8 +24,8 @@
for(var i = 0; i < size - 1; i++) {
var nextSegment = segments[i + 1];
var position = path.segments[i].point;
var angle = (position - nextSegment.point).getAngleInRadians();
var vector = new Point(Math.cos(angle), Math.sin(angle)) * -25;
var angle = (position - nextSegment.point).angle;
var vector = -new Point({ angle: angle, length: 25 });
nextSegment.point = position + vector;
}
path.smooth();