paper.js/examples/Tools/MultiLines.html

44 lines
970 B
HTML
Raw Normal View History

2011-02-21 08:31:26 -05:00
<!DOCTYPE html>
2011-02-08 07:16:43 -05:00
<html>
<head>
2013-06-02 16:41:10 -04:00
<meta charset="UTF-8">
<title>Multi Lines</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
tool.fixedDistance = 30;
2011-02-08 07:16:43 -05:00
var values = {
lines: 5,
size: 40,
smooth: true
};
2011-02-08 07:16:43 -05:00
var paths;
function onMouseDown(event) {
paths = [];
for (var i = 0; i < values.lines; i++) {
var path = new Path();
path.strokeColor = '#000000';
paths.push(path);
}
}
function onMouseDrag(event) {
var offset = event.delta;
offset.angle = offset.angle + 90;
var lineSize = values.size / values.lines;
for (var i = 0; i < values.lines; i++) {
var path = paths[values.lines - 1 - i];
offset.length = lineSize * i + lineSize / 2;
path.add(event.middlePoint + offset);
path.smooth();
}
2011-02-08 07:16:43 -05:00
}
</script>
</head>
<body>
<canvas id="canvas" resize></canvas>
2011-05-30 18:27:39 -04:00
</body>
</html>