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
Post a Comment