Jump to content
Search Community

Is GSAP Strict like AS3?

soupking test
Moderator Tag

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

Hi Jack and friends,

 

Hey, I've been going at troubleshooting the GSAP and I'm finding that when I add code for instances that aren't in the HTML markup that the whole thing seems to stop.

 

Does the GSAP require that all coding have referenced instances to function? It seems that's the case.

Link to comment
Share on other sites

Are you asking if it'll work if you try tweening null objects? No, you shouldn't try to tween null objects. Not sure why you'd want to :)

 

Maybe it'd help if you provided a very simple codepen demo so that we can see the context. I suspect there's something you might be misunderstanding but it's tough for me to know exactly what without seeing a demo. Sometimes talking in hypotheticals keeps us going in circles. 

Link to comment
Share on other sites

Heya Jack,

 

To be honest I didn't know there were null objects in this realm. First I've heard of them was in After Effects. 

 

I ended up answering my own question, and I'm pretty sure the answer is 'yes'.

 

Like if I have a Tween command for a clip that's not on the stage (even though I'm not using canvas...I think) putting it's instance name in a TweenLite command will break it all.

 

I'm guessing that's what you call a null?

Link to comment
Share on other sites

Well, kinda. null is basically like nothing or empty or undefined (sorta). 

 

For example, let's say you do this:

var myObject; //declares a variable, but doesn't assign anything to it, so it's null. 
myObject.someProperty = 1; //will throw an error because you can't set a property on a null object. 

Likewise, it'd be weird to try to tween properties on a null object that doesn't exist. And yes, when most browsers run into this sort of condition, they simply halt execution of JavaScript. This has nothing to do with GSAP. 

 

Does that clear things up? 

 

The moral of the story is: don't try tweening properties of objects that don't exist :) Make sure your target is valid. 

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...