javascript - Force Feeding not working in Velocity JS -


i trying use velocityjs in 1 of react projects. use case facing problem is:

there pointer created in svg, @ center of screen. want move pointer keyboard arrow keys. have maintained state variable updating x , y values of pointer on keydown event. on callback of setstate, calling translate function animates translation. problem faced animation happened initial position of pointer i.e. center of screen. workaround tried maintained previous position of pointer in state too, using forcefeeding in velocityjs. go through code , see if doing wrong.

$(".aim").velocity(   {     translatex: [this.state.aimx, this.state.aimxold],     translatey: [this.state.aimy, this.state.aimyold]   },   {     duration: 500,     easing: [0.46, 0.46, 0.46, 0.46],     complete: () => {       console.log("completed");     }   } ); 


Comments

Popular posts from this blog

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -