Using external variable to change position in onFrame

23 views
Skip to first unread message

Michael Sartore

unread,
Mar 11, 2021, 5:45:08 PMMar 11
to Paper.js
Hi,
I'm using sliders in an external ui, (dat.gui.js)
To try to change the variables in my paper.js project.
Instead of animating the variable, I'd like it to continually update it.
Ie: circle.position.x = posX;
Where posX comes from my ui slider.
Is there a different way? To "set" it each time?

I have requestAnimationFrame running, any basic animation works fine.
Just hung up on this.
Thanks

Michael Sartore

unread,
Mar 11, 2021, 10:08:02 PMMar 11
to Paper.js
Hi,
Found the issue.
Had needed to declare the dat.gui vars as global.

Michael Sartore

unread,
Mar 12, 2021, 4:24:05 PMMar 12
to Paper.js

Well I spoke too soon I guess.
function onFrame(event){ 
pivotPoint.x = datPivX;
Circle.rotate(3,pivotPoint);
}
Has perfect interactivity.

However,
function onFrame(event){ 
circle.position.x = datPosX;
}

Doesn't work. Circle disappears.
Even
 circle.position.x = 0;
Same.

Any thoughts as to what could be causing this?
Thanks!

Michael Sartore

unread,
Mar 13, 2021, 2:31:56 AMMar 13
to Paper.js
re: this for future searches...
i am finding that the issue was that i had been setting my circle.pivot erroneously and that had rendered my circle.position x,y fields NaN.
Reply all
Reply to author
Forward
0 new messages