Eze
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by Eze
-
-
Thank you, it's really more complicated. I thought there was an api that could get the tween value on the animation axis at a certain time in the future. I will study the sample code you gave, thank you very much!
-
Thank you, is there a way to animate to the same position as box2 in 1 second after the mouse is lifted?
-
-
Thank you for your reply, do not pause the tween when dragging, the tween is still running
-
Thank you for your reply, thank you very much!
My code is as follows, the div moves from 0px to 500px, during this animation, the user can drag the div, pressSign=true while dragging, gsap doesn't change the position of the div, when the user stops dragging, pressSign=false, I I want gsap to perfectly keep up with the tl animation in the TODO place, and the animation of the position dragged by the user reaches tl instead of jumping to tl in 0 secondslet pressSign = false;let pressTime = 0;let divEl = document.getElementById('div')const val = { x: 0 };const tl = gsap.timeline({paused: true,});tl.to(val, {x:500,duration:10onStart: function () {},onUpdate: function () {if (pressSign) return;divEl.style.left = val.x + 'px'},});function divElOnUp(){clearTimeout(pressTime);pressTime = setTimeout(() => {// TODOpressSign = false},2000)}function divElOnDown(){pressSign = true;} -
const myObj = { x: 0 };
const myTween = gsap.to(myObj, {
duration: 4,
x: 100,
});const valueAt2s = myTween.vars.x * myTween.progress(2);
console.log(valueAt2s);I expect valueAt2s=50
Get the tween value of a time in the future above the time axis
in GSAP
Posted
Thank you so much