paper.js/examples/Scripts/Arcs.html

40 lines
1.1 KiB
HTML
Raw Permalink Normal View History

2011-02-21 08:31:26 -05:00
<!DOCTYPE html>
2011-02-07 13:28:09 -05:00
<html>
<head>
2014-08-16 13:24:54 -04:00
<meta charset="UTF-8">
<title>Arcs</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper-full.js"></script>
<script type="text/paperscript" canvas="canvas">
var values = {
points: 20,
radius: 20,
initialRadius: 10
};
for (var i = 0; i < 30; i++) {
var path = new Path({
fillColor: i % 2 ? 'red' : 'black',
closed: true
});
2013-03-02 11:05:56 -05:00
2014-08-16 13:24:54 -04:00
var point = new Point({
length: values.initialRadius + values.radius * i,
angle: 0
});
for (var j = 0; j <= values.points; j++) {
point.angle += 360 / values.points;
if (j == 0) {
path.add(view.center + point);
} else {
path.arcTo(view.center + point);
}
}
project.activeLayer.insertChild(0, path);
}
</script>
2011-02-07 13:28:09 -05:00
</head>
<body>
2014-08-16 13:24:54 -04:00
<canvas id="canvas" resize></canvas>
2011-05-30 18:27:39 -04:00
</body>
</html>