mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Update Arcs example.
This commit is contained in:
parent
2b4a1a7dc4
commit
8ab70fd0de
1 changed files with 18 additions and 10 deletions
|
@ -6,19 +6,27 @@
|
||||||
<link rel="stylesheet" href="../css/style.css">
|
<link rel="stylesheet" href="../css/style.css">
|
||||||
<script type="text/javascript" src="../../dist/paper.js"></script>
|
<script type="text/javascript" src="../../dist/paper.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var point = view.center;
|
var values = {
|
||||||
|
points: 20,
|
||||||
|
radius: 20,
|
||||||
|
initialRadius: 10
|
||||||
|
};
|
||||||
for (var i = 0; i < 30; i++) {
|
for (var i = 0; i < 30; i++) {
|
||||||
var vector = new Point(10 + 20 * i, 0).rotate(i);
|
var path = new Path({
|
||||||
var l = vector.length;
|
fillColor: i % 2 ? 'red' : 'black',
|
||||||
var path = new Path();
|
closed: true
|
||||||
path.fillColor = i % 2 ? 'red' : 'black';
|
});
|
||||||
path.closed = true;
|
|
||||||
for (var j = 0; j < 17; j++) {
|
var point = new Point({
|
||||||
vector = vector.rotate(45 / 2);
|
length: values.initialRadius + values.radius * i,
|
||||||
|
angle: 0
|
||||||
|
});
|
||||||
|
for (var j = 0; j <= values.points; j++) {
|
||||||
|
point.angle += 360 / values.points;
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
path.add(point + vector);
|
path.add(view.center + point);
|
||||||
} else {
|
} else {
|
||||||
path.arcTo(point + vector, true);
|
path.arcTo(view.center + point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
project.activeLayer.insertChild(0, path);
|
project.activeLayer.insertChild(0, path);
|
||||||
|
|
Loading…
Reference in a new issue