paper.js/examples/Scripts/lines.html

59 lines
3.1 KiB
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>
<script type="text/javascript" src="../../lib/bootstrap.js"></script>
2011-03-04 06:38:38 -05:00
<script type="text/javascript" src="../../lib/parse-js.js"></script>
<script type="text/javascript" src="../../src/Paper.js"></script>
<script type="text/javascript" src="../../src/tool/ToolEvent.js"></script>
<script type="text/javascript" src="../../src/tool/ToolHandler.js"></script>
<script type="text/javascript" src="../../src/tool/Tool.js"></script>
<script type="text/javascript" src="../../src/basic/Point.js"></script>
<script type="text/javascript" src="../../src/basic/Rectangle.js"></script>
<script type="text/javascript" src="../../src/basic/Size.js"></script>
<script type="text/javascript" src="../../src/basic/Matrix.js"></script>
<script type="text/javascript" src="../../src/document/DocumentView.js"></script>
<script type="text/javascript" src="../../src/document/Document.js"></script>
2011-02-20 17:28:38 -05:00
<script type="text/javascript" src="../../src/document/Symbol.js"></script>
<script type="text/javascript" src="../../src/item/Item.js"></script>
2011-02-20 17:28:38 -05:00
<script type="text/javascript" src="../../src/item/PlacedSymbol.js"></script>
<script type="text/javascript" src="../../src/item/Group.js"></script>
<script type="text/javascript" src="../../src/item/Layer.js"></script>
2011-03-02 20:25:45 -05:00
<script type="text/javascript" src="../../src/item/Raster.js"></script>
<script type="text/javascript" src="../../src/item/PathStyle.js"></script>
<script type="text/javascript" src="../../src/path/Segment.js"></script>
<script type="text/javascript" src="../../src/path/PathItem.js"></script>
<script type="text/javascript" src="../../src/path/Path.js"></script>
2011-03-02 20:25:45 -05:00
<script type="text/javascript" src="../../src/path/CompoundPath.js"></script>
<script type="text/javascript" src="../../src/path/Path.Constructors.js"></script>
2011-02-19 11:56:15 -05:00
<script type="text/javascript" src="../../src/color/Color.js"></script>
<script type="text/javascript" src="../../src/color/RGBColor.js"></script>
<script type="text/javascript" src="../../src/color/GrayColor.js"></script>
2011-02-20 17:28:38 -05:00
<script type="text/javascript" src="../../src/color/GradientColor.js"></script>
<script type="text/javascript" src="../../src/color/Gradient.js"></script>
<script type="text/javascript" src="../../src/color/GradientStop.js"></script>
2011-03-04 06:38:38 -05:00
<script type="text/javascript" src="../../src/util/PaperScript.js"></script>
<script type="text/paperscript" canvas="canvas">
2011-02-07 13:28:09 -05:00
var count = 0;
2011-03-04 06:38:38 -05:00
setInterval(draw, 20);
2011-02-07 13:28:09 -05:00
function draw() {
count++;
2011-03-04 06:38:38 -05:00
document.activeLayer.children = [];
var point = new Point(document.size) / 2;
2011-02-07 13:28:09 -05:00
var vector = new Point(100, 0);
for (var i = 0; i < 180; i++) {
2011-03-04 06:38:38 -05:00
var center = point + vector.rotate(i * 2).normalize(30);
var length = 30 + Math.abs(Math.sin((i + count / 20)) * 300);
var end = point + vector.rotate(i * 2).normalize(length);
var path = new Path.Line(center, end);
2011-02-07 13:28:09 -05:00
path.strokeColor = i % 4 ? 'black' : 'red';
}
2011-03-04 06:38:38 -05:00
document.redraw();
2011-02-07 13:28:09 -05:00
}
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
</body>