2011-02-14 16:43:14 -05:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
|
|
|
|
|
|
|
<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>
|
|
|
|
<script type="text/javascript" src="../../src/Paper.js"></script>
|
2011-02-16 16:35:17 -05:00
|
|
|
<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>
|
2011-02-14 16:43:14 -05:00
|
|
|
<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>
|
2011-02-16 16:35:17 -05:00
|
|
|
<script type="text/javascript" src="../../src/document/Doc.js"></script>
|
2011-02-20 17:28:38 -05:00
|
|
|
<script type="text/javascript" src="../../src/document/Symbol.js"></script>
|
2011-02-16 16:35:17 -05:00
|
|
|
<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>
|
2011-02-16 16:35:17 -05:00
|
|
|
<script type="text/javascript" src="../../src/item/Group.js"></script>
|
|
|
|
<script type="text/javascript" src="../../src/item/Layer.js"></script>
|
|
|
|
<script type="text/javascript" src="../../src/item/PathStyle.js"></script>
|
2011-02-14 16:43:14 -05:00
|
|
|
<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-02-17 09:56:07 -05:00
|
|
|
<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-02-14 16:43:14 -05:00
|
|
|
<script>
|
|
|
|
window.onload = function() {
|
|
|
|
var canvas = document.getElementById('canvas');
|
2011-02-20 17:28:38 -05:00
|
|
|
var doc = new Doc(canvas);
|
|
|
|
var mousePoint = new Point(doc.size.divide(2));
|
|
|
|
|
|
|
|
var amount = 25;
|
|
|
|
var colors = ['red', 'white', 'blue', 'white'];
|
|
|
|
|
2011-02-17 10:00:03 -05:00
|
|
|
for (var i = 0; i < amount; i++) {
|
2011-02-14 16:43:14 -05:00
|
|
|
var rect = new Rectangle([0, 0], [25, 25]);
|
|
|
|
rect.center = mousePoint;
|
|
|
|
var path = new Path.RoundRectangle(rect, 6);
|
|
|
|
path.fillColor = colors[i % 4];
|
|
|
|
var scale = (1 - i / amount) * 20;
|
2011-02-20 17:28:38 -05:00
|
|
|
path.scale(scale);
|
|
|
|
new PlacedSymbol(path);
|
2011-02-14 16:43:14 -05:00
|
|
|
}
|
|
|
|
setInterval(draw, 30);
|
|
|
|
|
|
|
|
var tool = new Tool({
|
2011-02-14 18:08:11 -05:00
|
|
|
onMouseDrag: function(event) {
|
2011-02-14 16:43:14 -05:00
|
|
|
mousePoint = event.point;
|
|
|
|
}
|
2011-02-20 17:28:38 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
var children = Paper.document.activeLayer.children;
|
|
|
|
var count = 0;
|
|
|
|
function draw() {
|
|
|
|
count++;
|
|
|
|
for (var i = 0, l = children.length; i < l; i++) {
|
|
|
|
var item = children[i];
|
|
|
|
var delta = mousePoint.subtract(item.position).divide(i + 1);
|
|
|
|
item.rotate(Math.sin((count + i) / 10) * 7);
|
2011-02-20 21:32:39 -05:00
|
|
|
if (delta.length > 0.1)
|
2011-02-20 17:28:38 -05:00
|
|
|
item.translate(delta);
|
|
|
|
}
|
|
|
|
doc.redraw();
|
2011-02-14 16:43:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<canvas id='canvas' width=1024 height=768></canvas>
|
|
|
|
</body>
|