次のコードで私は位置をアニメーション化してテキストをフェードインすることができます。しかし、私が達成したいのは、移動、フェードイン、、次にすべてのコピーをスクロールの最後までフェードアウトします。だから動きはうまくいきます。私はちょうど同じ<p>
タグを消してからスクロールの最後に戻したいと思います。GSAPとScrollMagicの下部と不透明の属性をどのようにアニメーション化しますか?
// init controller to hold all commands/animations
const controller = new ScrollMagic.Controller({ addIndicators: true });
const tween1 = TweenMax
.staggerTo('#parallax p', 1, {
bottom: $('#parallax').height(),
opacity: 1,
}, 0.06);
// All commands/animations live in a scene
new ScrollMagic.Scene({
// Element to watch
triggerElement: '#parallax',
// Point at which animation starts, default is center of screen
triggerHook: 0, // 1 onEnter, .5 onCenter (Defualt), 0 onLeave
})
.setPin('#parallax')
.setTween(tween1)
.duration('100%') // Percentage of full screen or hard-wired number of pixels
.addIndicators({ name: 'FADES' }) // Indicators marked on screen
.addTo(controller); // Add this scene to controller
サイド質問:.staggerTo('#parallax p', 1, {
:アニメーションがScrollMagicをスクロールするためにキーが付いている場合は、次の行にあるため1
を何ですか?
編集:より多くのこのような、より適切なCodePen added
私たちがデバッグするためのcodepenデモを作成できますか?ありがとう – viCky
別のトゥイーンを追加してそれらをフェードアウトさせ、スクロールアウトしてみましょう。 – viCky
SIDE ANSWER:1は各アニメーションの継続時間です。 0.06は、次のアニメーションを開始する時間です。 – viCky