Trying to use GreenSock / ScrollMagic JS to animate divs on a page. I want to start the second animation in the animation window after the completion of the first animation. Therefore, move the field down 300 pixels, and then move it 300 pixels. How can I add a sequence of twins. My code for this is
http://codepen.io/anon/pen/HfFwJ
The JS I use is
var controller = new ScrollMagic({
globalSceneOptions: {
triggerHook: "onLeave"
}
});
var pinani = new TimelineMax()
.add(TweenMax.to("#slide-dos", 1, {top: "150px"}))
.add(TweenMax.to("#slide-dos", 1, {left: "500px"}))
.add(TweenMax.from( $('#slide-dos'), 0.5, {css:{scale:0.05, opacity:0, top: "100px"}, ease:Quad.easeInOut }));
new ScrollScene({
triggerElement: "section#pin",
duration: 1100
})
.setTween(pinani)
.setPin("section#pin")
.addTo(controller);
The structure of my HTML is
<div class="row">
<div class="large-12 columns"></div>
</div>
<section id="pin" class="scroll-magic-section">
<div id="spacer">
<div class="row">
<div class="large-12 columns">
<div id="slide-banner">
<div class="container">
<h3>Banner</h3>
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div id="slide-pre">
<div class="container">
<h3>Pre-Animation</h3>
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div id="slide-dos">
<div class="container">
<h3>Animation Box</h3>
</div>
</div>
</div>
</div>
</section>
So, in short, I want to animate the slide dos so that it adds to the left: 300 pixels after completing its top: 300 pixels.
Any help is much appreciated! :)
DIM3NSION
source
share