I'm trying to do some basic animation with Gsap 3 TweenLite and bezier but all I get is:
Invalid property Bezier set to {curviness: 2, autoRotate: true, values: Array(1)} Missing plugin? gsap.registerPlugin()
and here's my code:
<img class="paper-plane" src="fusee.png" alt="">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.1.1/gsap.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.1.1/CSSRulePlugin.min.js"></script>
<script>
const flightPath = {
curviness: 2,
autoRotate: true,
values: [{ x: 100, y: -20 }],
};
const tween = new TimelineLite();
tween.add(
TweenLite.to('.paper-plane', 1, {
Bezier: flightPath,
ease: Power1.easInOut
})
)
There are a few problems:
It could look something like:
gsap.registerPlugin(MotionPathPlugin);
const tween = gsap.timeline();
tween.to(".paper-plane", {
duration: 1,
ease: "power1.inOut",
motionPath: {
path: [{x: 100, y: -20}], // you probably want more points here...or just use an SVG <path>!
curviness: 2,
autoRotate: true
}
});
Don't forget to load and register MotionPathPlugin.
Release notes for GSAP 3 that covers all the changes: https://greensock.com/3-release-notes/
If you still need some help, I'd highly recommend posting in the GreenSock forums at https://greensock.com/forums and provide a reduced test case (maybe in codepen). We'd be happy to help.