【发布时间】:2013-12-04 20:45:08
【问题描述】:
我目前正在使用 GSAP JS 库运行动画序列。
在运行第一个动画实例后,我运行了一个onComplete 函数,将当前的position() 保存为#myDiv
然后我尝试在动画的最后一个实例中使用 coordX 值,但它只是显示为:invalid left tween value: undefined
有什么想法吗?
var coordX;
function regPosition() {
coordX = $("#mydiv").position().left;
}
function animationStart() {
//Initiate animation with onComplete
tl.to("#mydiv", 0.5, {borderRadius:"50%", width: "35%", onComplete: regPosition})
//Move #myDiv to another position than registered
.to("#mydiv", 0.5, {left: 1000})
//try to use the original position stored in "coordX"
.fromTo("#mydiv", 1.5, {left:-800}, {left:coordX});
}
animationStart();
【问题讨论】:
标签: javascript jquery gsap