2017-01-20 73 views
0

我寫了下面的代碼在我的test.html:TweenLite的世博會沒有定義

<!DOCTYPE html> 
<html> 
<head> 
<style type="text/css"> 
#item { 

    background:blue; 
    color:yellow; 
} 
</style> 
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenLite.min.js"></script> 
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/CSSPlugin.min.js"></script> 
<script type="text/javascript"> 
window.onload = function() { 
    var logo = document.getElementById("item"); 
    TweenLite.to(logo, 2, {left:"542px", backgroundColor:"red", borderBottomColor:"#90e500", color:"white",ease:Expo.easeOut}); 
} 
</script> 
</head> 
<body> 

<p id="item">thsi is a para</p> 
</body> 
</html> 

但是當我運行它,我在控制檯收到錯誤消息

Uncaught ReferenceError: Expo is not defined at window.onload (test.html:16)

如何使用Expo.easeOut?

回答

0

要做到放鬆,你必須包括EasePack太:

<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenLite.min.js"></script> 
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/CSSPlugin.min.js"></script> 
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/easing/EasePack.min.js"></script> 

(或者使用TweenMax代替,至極包括CSSPlugin和其他功能的EasePack。)