mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Simplify Path.Star constructor.
This commit is contained in:
parent
12de77eb42
commit
491250ef14
1 changed files with 4 additions and 6 deletions
|
@ -136,12 +136,10 @@ Path.inject({ statics: new function() {
|
||||||
outerFirst = radius1 < radius2,
|
outerFirst = radius1 < radius2,
|
||||||
path = new Path();
|
path = new Path();
|
||||||
for (var i = 0; i < numPoints; i++) {
|
for (var i = 0; i < numPoints; i++) {
|
||||||
var radius = i % 2 == outerFirst ? outer : inner,
|
path.add(center.add({
|
||||||
vector = new Point({
|
angle: -90 + angle * i,
|
||||||
angle: -90 + angle * i,
|
length: i % 2 == outerFirst ? outer : inner
|
||||||
length: radius
|
}));
|
||||||
});
|
|
||||||
path.add(center.add(vector));
|
|
||||||
}
|
}
|
||||||
path.closed = true;
|
path.closed = true;
|
||||||
return path;
|
return path;
|
||||||
|
|
Loading…
Reference in a new issue