Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Gabriel Rosario
23,602 PointsScrollMagic + Gsap multiple scenes on the same element
0 down vote favorite I'm trying to make 3 scene where an element change position and border radius each time.
When I make the first scene it work beautiful, but on the second scene its doesn't work. Why?
// Scroll Interactions //Init Controller let controller = new ScrollMagic.Controller(); // Ball Scene let ball = $('.ball'); let ballTl = new TimelineLite(); let ballT2 = new TimelineLite(); let ballScene1 = new ScrollMagic.Scene({ triggerElement: '#f1', }) .setTween(ballTl) .addIndicators() .addTo(controller);
let ballScene2 = new ScrollMagic.Scene({ triggerElement: '#f2', }) .setTween(ballT2) .addIndicators() .addTo(controller);
ballTl .to(ball, .8, {css:{ x: '10%', borderRadius: 0}, ease:Elastic.easeOut.config(.5, 0.4)}) ;
ballT2 .to(ball, .5, {css:{ x: '-50%', y:'-50%', borderRadius: '50%'}, ease: Elastic.easeOut.config(.5, 0.4)}) ; When I make the second scene and refresh the browser it just work the last scene, the first scene is missed. How I make multiple scene on the same element while scrolling?