mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-10 11:44:05 -04:00
Switch examples to using event.count in onFrame().
This commit is contained in:
parent
36c9286ca9
commit
cd7544c7c7
7 changed files with 16 additions and 30 deletions
examples/Scripts
|
@ -7,18 +7,16 @@
|
|||
<script type="text/javascript">var root = '../../'</script>
|
||||
<script type="text/javascript" src="../../src/load.js"></script>
|
||||
<script type="text/paperscript" canvas="canvas">
|
||||
var path,
|
||||
count = 0,
|
||||
rect = new Rectangle([150, 150], [300, 300]);
|
||||
var path;
|
||||
var rect = new Rectangle([150, 150], [300, 300]);
|
||||
document.currentStyle.fillColor = 'black';
|
||||
|
||||
function onFrame() {
|
||||
function onFrame(event) {
|
||||
if (path)
|
||||
path.remove();
|
||||
var size = Math.abs(Math.sin(count / 40)) * 150 + 10;
|
||||
var size = Math.abs(Math.sin(event.count / 40)) * 150 + 10;
|
||||
path = new Path.RoundRectangle(rect, size);
|
||||
path.position = document.bounds.center;
|
||||
count++;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue