还是更喜欢用transition,简单。
加这俩个样式就OK。
#sun {
transition: all 5s;
}
.rotation {
transform: translate(-200px, 100px);
}
加这俩个样式就OK。
#sun {
transition: all 5s;
}
.rotation {
transform: translate(-200px, 100px);
}
2016-07-02
$("button:last").click(function() {
if(isPause)return false;
isPause = true;
$boy.css('left',$boy.css('left'));
runTime += (Date.now() - startTime)/1000;
$boy.addClass('pauseWalk');
});
if(isPause)return false;
isPause = true;
$boy.css('left',$boy.css('left'));
runTime += (Date.now() - startTime)/1000;
$boy.addClass('pauseWalk');
});
2016-07-02
$("button:first").click(function(){
if(!isPause)return;
isPause = false;
startTime = Date.now();
$boy.addClass('slowWalk').css({
'left': $("#content").width() + 'px',
transition: 'left ' + (time - runTime) + 's'
}).removeClass('pauseWalk');
});
if(!isPause)return;
isPause = false;
startTime = Date.now();
$boy.addClass('slowWalk').css({
'left': $("#content").width() + 'px',
transition: 'left ' + (time - runTime) + 's'
}).removeClass('pauseWalk');
});
2016-07-02