Hi everybody!
I have an issue with this.$gsap on Nuxt.
It's unknow when i use it on a document.addEventListener:
mounted(){
const cursor = document.querySelector('.cursor')
const follower = document.querySelector('.cursor-follower')
document.addEventListener("mousemove", function(e, this.$gsap) {
this.$gsap.to(cursor,{
x: e.pageX,
y: e.pageY
})
})
=> Uncaught TypeError: Cannot read properties of undefined (reading 'to')
I tried this too:
mounted(){
this.$gsap.to({}, 0.016, {
repeat: -1,
onRepeat: function() {
posX += (mouseX - posX) / 9;
posY += (mouseY - posY) / 9;
this.$gsap.set(follower, {
css: {
left: posX - 12,
top: posY - 12
}
});
this.$gsap.set(cursor, {
css: {
left: mouseX,
top: mouseY
}
});
}
});
}
And the this.$gsap on the OnRepeat function is undefined (=> Uncaught TypeError: Cannot read properties of undefined (reading 'set')
Any ideas?
Thanks a lot!
(i'm trying to use this : https://codepen.io/karlovidek/pen/yvxZjO?