2011-02-21 08:31:26 -05:00
|
|
|
<!DOCTYPE html>
|
2011-02-14 16:43:14 -05:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<title>Example</title>
|
2011-05-05 11:25:17 -04:00
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
2011-03-07 20:07:26 -05:00
|
|
|
<script type="text/javascript">var root = '../../'</script>
|
2011-03-07 18:11:41 -05:00
|
|
|
<script type="text/javascript" src="../../src/load.js"></script>
|
2011-03-04 06:38:38 -05:00
|
|
|
<script type="text/paperscript" canvas="canvas">
|
2011-05-16 07:51:20 -04:00
|
|
|
var mousePoint = view.center;
|
2011-03-04 06:38:38 -05:00
|
|
|
var amount = 25;
|
|
|
|
var colors = ['red', 'white', 'blue', 'white'];
|
2011-04-18 11:48:48 -04:00
|
|
|
|
2011-03-04 06:38:38 -05:00
|
|
|
for (var i = 0; i < amount; i++) {
|
|
|
|
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;
|
|
|
|
path.scale(scale);
|
|
|
|
new PlacedSymbol(path);
|
|
|
|
}
|
2011-04-18 11:48:48 -04:00
|
|
|
|
|
|
|
function onMouseDown(event) {
|
|
|
|
mousePoint = event.point;
|
|
|
|
}
|
2011-03-04 06:38:38 -05:00
|
|
|
|
2011-03-04 06:44:02 -05:00
|
|
|
function onMouseDrag(event) {
|
|
|
|
mousePoint = event.point;
|
|
|
|
}
|
2011-04-18 11:48:48 -04:00
|
|
|
|
2011-05-16 08:33:15 -04:00
|
|
|
var children = project.activeLayer.children;
|
2011-05-15 13:12:56 -04:00
|
|
|
function onFrame(event) {
|
2011-03-04 06:38:38 -05:00
|
|
|
for (var i = 0, l = children.length; i < l; i++) {
|
|
|
|
var item = children[i];
|
2011-04-18 11:48:48 -04:00
|
|
|
var delta = (mousePoint - item.position) / (i + 5);
|
2011-05-15 13:12:56 -04:00
|
|
|
item.rotate(Math.sin((event.count + i) / 10) * 7);
|
2011-03-04 06:38:38 -05:00
|
|
|
if (delta.length > 0.1)
|
|
|
|
item.translate(delta);
|
2011-02-14 16:43:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2011-05-14 06:04:02 -04:00
|
|
|
<canvas id="canvas" resize keepalive="true"></canvas>
|
2011-02-14 16:43:14 -05:00
|
|
|
</body>
|