Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
jasper

two lines of code too many

Recommended Posts

Sorry for not making a codepen, but my question is so pathetically simple I think it's unnecessary.

 

The following works.  (Obviously, it's just supposed to flash the two classes on and off in alternation.) But it doesn't work without the first (or last) two lines of code.  Why not?  I see redundancy here, and would like to refactor this properly.

	var foiled_crook = new TimelineMax({repeat:-1});
	foiled_crook
		.set($('.crook'), {autoAlpha:"1"})
		.set($('.crook-blocked'), {autoAlpha:"0"})
		.add("foiled", "+=2")
		.set($('.crook'), {autoAlpha:"0"}, "foiled")
		.set($('.crook-blocked'), {autoAlpha:"1"}, "foiled")
		.add("trying", "+=2")
		.set($('.crook'), {autoAlpha:"1"}, "trying")
		.set($('.crook-blocked'), {autoAlpha:"0"}, "trying")
		;

Thanks, eh.

Link to comment
Share on other sites

Hi jasper :)

 

everything works correctly , pls fork and share the codepen if you still have any problem :

 

See the Pen raeVLL by MAW (@MAW) on CodePen

Link to comment
Share on other sites

Thanks Diaco.AW!

 

(Just me being an idiot then.)

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