2015-06-10 50 views
2

我正在嘗試使用GSAP和scrollMagic創建一個簡單的timelineMax,出現以下錯誤。一切看起來都適合我,所以我不理解這個錯誤。GSAP timelineMax錯誤,無法讀取undefined屬性'repeat'

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); 

(我知道有一個在吐溫沒有時間PARAM,但如果你看看http://janpaepke.github.io/ScrollMagic/examples/advanced/parallax_sections.html你可以看到,有自己的setTween沒有時間參數,它工作得很好)。

回答

8

你缺少時間參數:

TweenMax.to(element, duration, {property: value});

+0

嗨塔希爾,我知道它看起來是這樣,但如果你看看http://janpaepke.github.io/ScrollMagic/examples/advanced/parallax_sections.html你可以看到他們的'setTween沒有持續時間參數'它可以正常運行'.setTween(「#parallax1> div」,{y:「80%」,ease:Linear.easeNone})''。這和timelineMax有什麼區別? timelineMax總是需要持續時間參數嗎? –

+0

Tahir從文檔看起來像是正確的,缺少.setTween中的補間持續時間僅僅是1秒持續時間的簡寫,也許這種簡寫不適用於TimelineMax。嗯...... '//用於添加TweenMax.to()補間1秒的簡短手勢 //當場景有持續時間並且補間持續時間不重要時,此功能很有用 scene.setTween(「 obj3「,{y:100});'[參考鏈接](http://scrollmagic.io/docs/animation.GSAP.html#Scene.setTween)無論如何它現在工作後添加一個持續時間參數。我想知道如何獲得更好的錯誤信息? –

+0

任何人都可以解釋這個選擇器意味着'parallax1> div'嗎?那裏的「<」是什麼? –

相關問題