mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Some small changes to lines example.
This commit is contained in:
parent
f39895a945
commit
6430baa858
1 changed files with 5 additions and 4 deletions
|
@ -14,8 +14,8 @@
|
||||||
path.closed = true;
|
path.closed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var position = new Point(document.size) / 2;
|
var position = document.bounds.center;
|
||||||
var mousePos = position;
|
var mousePos = position;
|
||||||
var children = document.activeLayer.children;
|
var children = document.activeLayer.children;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
|
@ -24,13 +24,14 @@
|
||||||
var delta = (mousePos - position);
|
var delta = (mousePos - position);
|
||||||
position += delta / 10;
|
position += delta / 10;
|
||||||
for (var i = 1; i < amount; i++) {
|
for (var i = 1; i < amount; i++) {
|
||||||
|
var path = children[i];
|
||||||
var length = Math.abs(Math.sin(i + count / 20) * 300);
|
var length = Math.abs(Math.sin(i + count / 20) * 300);
|
||||||
children[i].segments = [
|
path.segments = [
|
||||||
position + delta / 1.5,
|
position + delta / 1.5,
|
||||||
position + { angle: i * 2, length: length },
|
position + { angle: i * 2, length: length },
|
||||||
position + { angle: (i + 1) * 2, length: length }
|
position + { angle: (i + 1) * 2, length: length }
|
||||||
];
|
];
|
||||||
children[i].fillColor.hue = count - length;
|
path.fillColor.hue = count - length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue