Jump to content

Search In
  • More options...
Find results that contain...
Find results in...
Victor Work

Do not assign TimelineMax() to variable. Is correct?

Recommended Posts

Hello GSAPers, I would use something like:

$el.click(() => {
  new TimelineMax()

Is correct or disruptive in performance

Link to comment
Share on other sites

All it means is that a new timeline will be created every time you trigger the click event and it will not be held in memory.


So, unless you're passing in new parameters every time, there's no particular reason to do so. You can create the timeline once and only replay it on click.


Having said that, there's nothing really bad or wrong by creating a " throwaway" timeline like that.


Performance-wise.... Unless you are triggering thousands upon thousand of clicks or looping and creating thousands upon thousands of calculations on that one click, there's no real perceivable difference in performance.

  • Like 5
Link to comment
Share on other sites

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.