mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22: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,
|
||||
path = new Path();
|
||||
for (var i = 0; i < numPoints; i++) {
|
||||
var radius = i % 2 == outerFirst ? outer : inner,
|
||||
vector = new Point({
|
||||
angle: -90 + angle * i,
|
||||
length: radius
|
||||
});
|
||||
path.add(center.add(vector));
|
||||
path.add(center.add({
|
||||
angle: -90 + angle * i,
|
||||
length: i % 2 == outerFirst ? outer : inner
|
||||
}));
|
||||
}
|
||||
path.closed = true;
|
||||
return path;
|
||||
|
|
Loading…
Reference in a new issue