admin管理员组文章数量:1316694
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=".4.1.min.js"></script>
<script src=".0.7/ScrollMagic.min.js"></script>
<script src=".1.1/gsap.min.js">
</script>
<script src=".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
})
)
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./jquery-3.4.1.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/ScrollMagic/2.0.7/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/gsap/3.1.1/gsap.min.js">
</script>
<script src="https://cdnjs.cloudflare./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
})
)
Share
Improve this question
edited Feb 7, 2020 at 17:02
Omar Errabaany
asked Feb 7, 2020 at 16:50
Omar ErrabaanyOmar Errabaany
552 silver badges10 bronze badges
1
- 1 I had the same problem earlier today!!! – Oussama Essamadi Commented Feb 7, 2020 at 17:08
1 Answer
Reset to default 8There are a few problems:
- You're loading GSAP 3 (good!) which has been modernized quite a bit. Most code is totally backward patible but BezierPlugin is an exception, as explained in the migration guide: https://greensock./3-migration#motion-path - you should use MotionPathPlugin now. It's way more capable and easy to use.
- You mistyped it as "Bezier" (it shouldn't be capitalized), but again, bezier isn't valid in GSAP 3. Use MotionPathPlugin.
- You only have one point in your "values" Array. Why?
- You're using the old syntax which is okay, but I'd strongly remend updating to the shorter, more intuitive GSAP 3 syntax. It's all simplified into a single "gsap" object (no more TweenLite, TweenMax, TimelineLite, and TimelineMax). Your code could be made quite a bit shorter. The eases are now string-based too (shorter). I think you'll really like the new syntax.
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./3-release-notes/
If you still need some help, I'd highly remend posting in the GreenSock forums at https://greensock./forums and provide a reduced test case (maybe in codepen). We'd be happy to help.
本文标签: javascriptInvalid property Bezier setto Missing plugin gsapregisterPlugin()Stack Overflow
版权声明:本文标题:javascript - Invalid property Bezier set ... to Missing plugin? gsap.registerPlugin() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742006499a2412062.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论