I want to overlap a ScrollMagic animation on a text, and not make the animation a separate section like it is right here:
There is supposed to be text over there but it made this animation into a new section where the text is at the bottom.
Code:
gsap.registerPlugin(MotionPathPlugin);
const tween = gsap.timeline();
tween.to(".paper-plane", {
duration: 1,
ease: "power1.inOut",
motionPath: {
path: [
{x: 100, y: 0},
{x: 300, y: 10},
{x: 500, y: 100},
{x: 750, y: -100},
{x: 350, y: -50},
{x: 600, y: 100},
{x: 800, y: 0},
{x: window.innerWidth, y: -250}
],
curviness: 2,
autoRotate: true
}
});
const controller = new ScrollMagic.Controller();
const scene = new ScrollMagic.Scene({
triggerElement: '.animation',
duration: 1000,
triggerHook: 0
})
.setTween(tween)
.setPin('.animation')
.addTo(controller);
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
header, footer{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: "Montserrat", sans-serif;
}
header h1{
font-size: 60px;
}
.animation{
height: 100vh;
position: relative;
overflow: hidden;
}
.paper-plane{
position: absolute;
top: 50%;
left: 0%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/plugins/animation.gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.2.6/MotionPathPlugin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.0/gsap.min.js"></script>
<div class="animation">
<img class="paper-plane" src="https://i.postimg.cc/W1w9dT1x/paper.png" alt="Paper Plane">
</div>
What would I need to add to my css so that the animation displays on top of the text, I have not provided the code for my text because it can be any text in general. I just want this animation to work over text and not have a separate section of its own. Any suggestions?

you need to set the display to absolute