Initiation of animation after completion of the previous animation. - Greensock / ScrollMagic

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

// init the controller
var controller = new ScrollMagic({
    globalSceneOptions: {
        triggerHook: "onLeave"
    }
});


// pinani
var pinani = new TimelineMax()

    // panel slide translateX
    .add(TweenMax.to("#slide-dos", 1, {top: "150px"})) // panel slide top
    .add(TweenMax.to("#slide-dos", 1, {left: "500px"})) // panel slide left
    .add(TweenMax.from( $('#slide-dos'), 0.5, {css:{scale:0.05, opacity:0, top: "100px"}, ease:Quad.easeInOut }));



// panel section pin
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

+4
source share
1

@reekogi , .
Timeline, :

var pinani = new TimelineMax()
    .add(TweenMax.to("#slide-dos", 1, {top: "300px"})) // panel slide top
    .add(TweenMax.to("#slide-dos", 1, {left: "300px"})); // panel slide left

. : http://greensock.com/docs/#/HTML5/GSAP/TimelineMax/add/

+3

All Articles