I have this integrated GSAP and scrollmagic scroll animation that is causing me once again headache.
I think the best way to animate the slides horizontally is by using Gsap rather then the scrollmagic Option "vertical: false".
Now, I'd like to find a way to trigger like scrollmagic does the slides and adding a class for each slide is-active.
I tried the below but doesn't really work.
var headers = ["#section01", "#section02", "#section03", "#section04", "#section05"];
headers.forEach(function (index) {
// number for highlighting scenes
var num = index+1;
// make scene
var headerScene = new ScrollMagic.Scene({
triggerElement: index, // trigger CSS animation when header is in the middle of the viewport
offset: -95
})
.setClassToggle('#section0'+num, 'is-active')// set class to active slide
.addTo(controller);
});
Would anyone help me to achieve that please?
Thanks,
D