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