0
var click=false;
var clickX, clickY;
var moveX=0, moveY=0; 
var lastMoveX=0, lastMoveY=0;     
function movexaxis(evt)
{
var clx=evt.clientX-clickX;
moveX = lastMoveX + clx;
return moveX;
}
function moveyaxis(evt)
{ 
var cly=evt.clientY-clickY;
moveY = lastMoveY + cly;
return moveY;
}
function move(evt){
evt.preventDefault();
var a=document.getElementById("crystal"); 
if(click){
movexaxis(evt);
moveyaxis(evt);
Velocity(a,{translateX: moveX},{duration:"0ms"});
Velocity(a,{translateY: moveY },{duration:"0ms"});
Velocity(a,"stop");
}
}

我使用 Velocity.js JavaScript library.but 移动 SVG 对象,但在移动图像时它不会提供平滑度。如何使用 valocity.js 实现平滑度???

4

0 回答 0