mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Some simplifications to the roundRectangle example.
This commit is contained in:
parent
cca62beac3
commit
3dbd6bc91b
1 changed files with 11 additions and 9 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue