Jump to content


How to make divs constantly appearing and disappearing

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, I am new at GreenSock, started a day ago.

I want to make make divs constantly disappearing and appearing. I menage to make it works with only one iteration, but when I add repeat it doesnt work. Dont know what i am doing wrong.


This is my code for one iteration:


TweenMax.staggerTo(".bla", 1,  {opacity:0}, 1);
TweenMax.staggerTo(".bla", 1,  {opacity:1, delay:1}, 1);


This is my code for infinitely iterations


TweenMax.staggerTo(".bla", 1,  {opacity:0, repeat:-1, repeatDelay:10}, 1);

TweenMax.staggerTo(".bla", 1,  {opacity:1, delay:1, repeat:-1, repeatDelay:10}, 1);
Link to comment
Share on other sites

Hi bobby91  :) Welcome to GreenSock forum


- pls make a reduced Codepen Demo available :


Read This First: How to Create a CodePen Demo




- check GSAP Docs. too : http://greensock.com/docs/#/HTML5/



- and finaly try this and fork it if you have any problem : 

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

  • Like 1
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.


Like Diaco suggested, we will be able to help you much quicker and efficiently with a demo.


From what you are explaining, I think the best solution here is a repeating TimelineMax with a single staggerTo that contains repeating tweens

var tl = new TimelineMax({repeat:-1});
tl.staggerTo(".box", 0.5,  {opacity:0, repeat:1, yoyo:true}, 1);



My guess is that you were creating overlapping tweens on the same elements and they were overwriting (killing) each other.


This video will introduce you to the concept of timelines: http://greensock.com/sequence-video


Be sure to read the TimelineLite and TimelineMax pages




and the docs too


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