Jump to content
GreenSock

erikb

processing js

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

is the best practice for incorporating this library with processing js to check tween values in the processing-js draw function?

Link to comment
Share on other sites

I'm not familiar with processing.js yet. Anyone else care to chime in?

Link to comment
Share on other sites

That's a tricky one because the draw method in processing.js is continuously called and is generally only controlled by noLoop(), redraw(), loop(), or if the program is stopped completely. I would think though, you could 'parameterize' the variables that the draw method references and externally check them with Tween-related logic that responds accordingly based on the values, or even sets values for any given reason. Perhaps even setting left/right boundaries in variables that trigger 'Tweens' to do stuff in conjunction with or independently of whatever the draw method loop executes.

 

One example might be if you're tracking the yPos variable in the application scope and the draw method does something like yPos += 1 and then externally you have a check that when the yPos is say greater than 200, you TweenLite.to back to yPos = 0 (possibly setting a flag toggle that the draw method stops adding 1 to the yPos while tweening back to 0) and then use the TweenLite onComplete to set back the flag toggle back and thus create a unique effect of some element moving down 1 step every draw loop and then tweens back to 0 and starts the process all over again.

Link to comment
Share on other sites

  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×