Jump to content
Search Community

Error: "Uncaught Cannot tween a null target" when using the CssRule Plugin

gimperdaniel test
Moderator Tag

Go to solution Solved by gimperdaniel,

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

Here's my code:

var connectors_tl = new TimelineMax({repeat:-1,onRepeat:change_position});

        var connector_before = CSSRulePlugin.getRule(".connector:before");
        var connector_after = CSSRulePlugin.getRule(".connector:after");

        connectors_tl.add(TweenMax.to(".connector",1,{opacity:1,repeat:1,repeatDelay:3, yoyo:true}));
        connectors_tl.add(TweenMax.to(connector_before,1,{opacity:1}));

I was basing my code on the example here:

 

 

I already have the before and after defined in my css with opacity:0;

 

What does the error mean?

See the Pen ibHAt by jamiejefferson (@jamiejefferson) on CodePen

Link to comment
Share on other sites

  • Solution

Never mind. I figured it out. 

 

I had my css defined as 

#myID.connector:after{}

And I was trying to select just 

.connector:after{}

It looks like that the CSSRulePlugin selection must have the exact same selector structure.

 

So this works:

CSSRulePlugin.getRule("#myID.connector:after");
  • 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...