paper.js/examples/Scripts/star.html

28 lines
893 B
HTML
Raw Normal View History

2011-02-21 08:31:26 -05:00
<!DOCTYPE html>
2011-02-07 13:28:09 -05:00
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
2011-03-07 20:07:26 -05:00
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
2011-03-04 06:38:38 -05:00
<script type="text/paperscript" canvas="canvas">
var point = new Point(document.size) / 2;
for (var i = 0; i < 30; i++) {
var vector = new Point(1 + 10 * i, 0).rotate(i);
var l = vector.length;
var path = new Path();
path.fillColor = i % 2 ? 'red' : 'black';
path.closed = true;
for (var j = 0; j < 32; j++) {
vector = vector.rotate(45 / 4);
var newPoint = point + vector + vector.rotate(-180).normalize(l * (j % 2 ? 0.1 : -0.1));
path.add(newPoint);
2011-02-07 13:28:09 -05:00
}
2011-03-04 06:38:38 -05:00
path.smooth();
document.activeLayer.appendBottom(path);
2011-02-07 13:28:09 -05:00
}
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
</body>