Jump to content
Search Community

Using multiple tweens within a Superscrollorama object?

Vincentccw 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

Is it possible to use a Superscrollorama object to control multiple timelines?

 

My code:

See the Pen ?editors=111 by vincentccw (@vincentccw) on CodePen

 

RIght now the box1 class is animating as intended, but I'm only allowed to animate one box at a time, if I add another timeline below it, the whole animation stop working.

 

Is there a better way to add multiple animation timelines or do I need to create multiple scrollorama object to hold individual timeline>

Link to comment
Share on other sites

Maybe someone here is familiar enough with it to assist you, but this is not the superscrollorama support forum so your question might be better suited at their GitHub.

 

That said, are you sure you're using the right syntax to add multiple timelines? I have zero idea how superscrollorama works, but it seemed like the syntax would be more like this, and it seems to be working?

controller.addTween(
  0,
  mainTweenSlideDown.fromTo($('.box1'), 1, {css:{top: 0}, immediateRender:true}, {css:{left: 500}})
  		    .to($('.box1'), 1, {css:{left: 300},onComplete: function(){console.log('test')}}),
  500
);
  
controller.addTween(
  0,
  mainTweenSlideDown2.fromTo($('.box2'), 1, {css:{top: 0}, immediateRender:true}, {css:{left: 500}})
  		     .to($('.box2'), 1, {css:{left: 300},onComplete: function(){console.log('test')}}),
  500 
);

You should also remove display:table-cell from the boxes - not every browser allows you to position table cells.

  • 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.
×
×
  • Create New...