简体   繁体   English

GSAP补间无法正常工作。 设置持续时间无效

[英]GSAP tween not working correctly. Set duration has no effect

I am trying out the GSAP animation library. 我正在尝试GSAP动画库。 According to the basic docs the syntax for getting a tween up and running is: 根据基本文档 ,启动补间和运行的语法为:

TweenLite.to( [target object], [duration in seconds], [destination values] )

So I have tried a really simple tween based on jQuery's hover event: 所以我尝试了一个基于jQuery的悬停事件的非常简单的补间:

$('.contact-item').hover(function(){
    TweenLite.to(this,4,{background:'#671B4B'});
},function(){
    TweenLite.to(this,4,{background:'#FFFFFF'});
});

Oddly, the background does change to the correct color, but it tweens instantly instead of over the course of 4 seconds as I have specified in the second argument. 奇怪的是,背景确实会更改为正确的颜色,但是它会立即进行补间,而不是像我在第二个参数中指定的那样经过4秒钟。

I did check to make sure the duration is in seconds not milliseconds. 我做了检查以确保持续时间以秒为单位,而不是毫秒。 It's in the docs I linked to. 在我链接的文档中。 I also made sure that I am using TweenLite and not TweenMax . 我还确保我使用的是TweenLite而不是TweenMax I am using jQuery but I do not see any conflicts or errors in the console. 我正在使用jQuery但在控制台中看不到任何冲突或错误。 I have also made sure that the CSSPlugin is included in my fiddle below. 我还确保在下面的小提琴中包含CSSPlugin

Any help is appreciated. 任何帮助表示赞赏。 here is the fiddle. 是小提琴。

Changing background to backgroundColor should fix your problem. background更改为backgroundColor应该可以解决您的问题。 [ Link ]. [ 链接 ]。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM