Jump to content
GreenSock

NickWoodward

Getting better at debugging?

Recommended Posts

Another day, another battle with an animation not working (reversing) as I'd expect 🙂

Was just wondering if anyone had any tips on debugging? I've output the timeline object - is there anything that people look at first to get a clue to what's gone wrong? For example I thought I might look for a 'progress' variable, or something to show where the playhead was. Then I realised I was making it up 😄 (Have now realised I can get the progress through `time()`)

Just curious if there were any good threads or articles on the topic? It might certainly reduce my reliance on the forum when things go a bit pear shaped!

Nick

Link to comment
Share on other sites

Do you have an demo of something that was causing you problems, maybe in its broken form? Debugging is a really broad topic, and I doubt there are any resources on how to do it, especially for animations. It just a skill you develop over time, but the main idea is that you should try to isolate and reduce the problem to its most simplest form as the will make it easier to figure out. Once you have the issue sorted out, then you can start adding in more functionality.

 

6 hours ago, NickWoodward said:

For example I thought I might look for a 'progress' variable, or something to show where the playhead was. Then I realised I was making it up 😄 (Have now realised I can get the progress through `time()`)

 

Inspecting a timeline object is rarely of any help. There's probably a method for everything you need, for example, the .progress() method.

https://greensock.com/docs/v3/GSAP/Timeline/progress()

 

Timeline docs

https://greensock.com/docs/v3/GSAP/Timeline

 

Tween docs

https://greensock.com/docs/v3/GSAP/Tween

 

  • Like 2
Link to comment
Share on other sites

11 minutes ago, OSUblake said:

It just a skill you develop over time


I mean this is pretty reassuring - it definitely feels like I'm winging it a little bit right now.

You're right, I should spend more time with the docs, but I honestly think I've only just got to the stage where I can even put the docs in context. I guess I can take some heart in the fact that if I look back at how I was a few weeks back, I know much more.

And RE my problem - It ended up being a JS/me issue. Mainly me 😊

Thanks for taking a look anyway!

  • Like 1
Link to comment
Share on other sites

And sometimes when I need to make sense of values that would cause the console to keep scrolling, I like to make a little debug panel.

 

See the Pen ZEJMjaL by GreenSock (@GreenSock) on CodePen

 

  • Like 1
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.
×