javascript实现的图片切割多块效果实例_基础知识
程序员文章站
2022-04-08 22:09:26
...
本文实例讲述了javascript实现的图片切割多块效果。分享给大家供大家参考。具体实现方法如下:
");
var lineY=$("");
var _option={
"display":"none",
"targetPosX":container.width()/2-2,
"targetPosY":container.height()/2-2,
"time":500,
"freq":10
};
$.extend(_option,option);
option=_option;
var targetPosX=option.targetPosX;
var targetPosY=option.targetPosY;
var time=option.time;
var freq=option.freq;
times=time/freq;
container.append(lineX).append(lineY);
//开始运动
var lxt=lineX.position().top;
var lyl=lineY.position().left;
xPerTime=targetPosX/times;
yPerTime=targetPosY/times;
var count=0;
var si=setInterval(function(){
count++;
if(count>=times){
clearInterval(si);
if(typeof(callback)=="function"){
callback();
}
if(option.display=="none"){
lineX.remove();
lineY.remove();
}
}
if(lxt+yPerTime