GSAP timelineMax 错误,无法读取未定义的 属性 'repeat'
GSAP timelineMax error, cannot read property 'repeat' of undefined
我正在尝试使用 GSAP 和 scrollMagic 创建一个简单的 timelineMax,但出现以下错误。我觉得一切正常,所以我不明白这个错误。
Uncaught TypeError: Cannot read property 'repeat' of undefined
d.to @ TweenMax.min.js:14
(anonymous function) @ app.js:12
第 12 行在下面 .to("#parallax1 > div", {y: "80%", ease: Linear.easeNone});
。
代码如下:
// init controller
var controller = new ScrollMagic.Controller({globalSceneOptions: {triggerHook: "onEnter", duration: "200%"}});
// build scenes
// build tween1
var tween1 = new TimelineMax();
tween1.to("#parallax1 > div", {y: "80%", ease: Linear.easeNone});
var scene = new ScrollMagic.Scene({triggerElement: "#parallax1"})
.setTween(tween1)
.addIndicators()
.addTo(controller);
(我知道那个 tween 中没有持续时间参数,但是如果你看一下 http://janpaepke.github.io/ScrollMagic/examples/advanced/parallax_sections.html 你会发现他们的 setTween 上没有持续时间参数而且它工作得很好)。
您缺少 duration 参数:
TweenMax.to(element, duration, {property: value});
.
我正在尝试使用 GSAP 和 scrollMagic 创建一个简单的 timelineMax,但出现以下错误。我觉得一切正常,所以我不明白这个错误。
Uncaught TypeError: Cannot read property 'repeat' of undefined
d.to @ TweenMax.min.js:14
(anonymous function) @ app.js:12
第 12 行在下面 .to("#parallax1 > div", {y: "80%", ease: Linear.easeNone});
。
代码如下:
// init controller
var controller = new ScrollMagic.Controller({globalSceneOptions: {triggerHook: "onEnter", duration: "200%"}});
// build scenes
// build tween1
var tween1 = new TimelineMax();
tween1.to("#parallax1 > div", {y: "80%", ease: Linear.easeNone});
var scene = new ScrollMagic.Scene({triggerElement: "#parallax1"})
.setTween(tween1)
.addIndicators()
.addTo(controller);
(我知道那个 tween 中没有持续时间参数,但是如果你看一下 http://janpaepke.github.io/ScrollMagic/examples/advanced/parallax_sections.html 你会发现他们的 setTween 上没有持续时间参数而且它工作得很好)。
您缺少 duration 参数:
TweenMax.to(element, duration, {property: value});
.