Jump to content
Search Community

Trouble using GetDocumentById for animation info

cooganb test
Moderator Tag

Recommended Posts

Hi there!

 

I've been trying to follow the "Writing Smarter Animation Code" article. This includes compacting animations into functions, which can then be imported into a master timeline.

 

I'm having some trouble with using DOM element manipulation in the functions. The function in the above example fails when I try to run it, saying `vars` using .GetDocumentById has not been assigned. However, when the logic is moved from function to the body of the JS doc, the animation works (which you can see commented out in the Codepen).

 

Any advice from folks? Thanks in advance!

See the Pen WNNMdrb by cooganb (@cooganb) on CodePen

Link to comment
Share on other sites

11 minutes ago, cooganb said:

Any idea as to why the function is only working for the first ellipse and not the later ones?

You have repeat: -1 on the each inner timeline. So the first timeline of the master timeline keeps getting repeated and the second one is never reached :) You should probably put repeat: -1 on the master timeline instead.

  • Like 2
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.
×
×
  • Create New...