Some simplifications to the roundRectangle example.

This commit is contained in:
Jonathan Puckey 2011-05-06 15:03:21 +01:00
parent cca62beac3
commit 3dbd6bc91b

View file

@ -7,16 +7,18 @@
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
var count = 0;
setInterval(draw, 30);
function draw() {
count++;
document.activeLayer.children = [];
var rect = new Rectangle([150, 150], [300, 300]);
var path,
count = 0,
rect = new Rectangle([150, 150], [300, 300]);
document.currentStyle.fillColor = 'black';
function onFrame() {
if (path)
path.remove();
var size = Math.abs(Math.sin(count / 40)) * 150 + 10;
var path = new Path.RoundRectangle(rect, size);
path.fillColor = 'black';
document.redraw();
path = new Path.RoundRectangle(rect, size);
path.position = document.bounds.center;
count++;
}
</script>
</head>