Hi everyone!
I was user of tween, there I can do something like this. Where e is the current value throung the time... so if I log in onUpdate the e value logs the exactly value in time.
const n2bt = new TWEEN.Tween({x: 0})
.to({x:1}, 1650)
.onUpdate((e) => {
console.log(e.x)
})
.start()
}
How can I do this with gsap?
Elements are little different because the value is part of the style object. GSAP has a helper to get those style values for you.
https://greensock.com/docs/v3/GSAP/gsap.getProperty()
gsap.to("#Poker_presentaciones", {
duration: 5,
x: 500,
onUpdate() {
console.log(gsap.getProperty(this.targets()[0], "x"));
}
});
Using the getter function.
const element = document.querySelector("#Poker_presentaciones");
const getter = gsap.getProperty(element);
gsap.to(e