react-avatar-editor
react-avatar-editor copied to clipboard
Can rotation be animated?
Can rotation be animated?
Can rotation be animated?
It should be easy to animate it, just rotate it slowly in an X amount of time
@pwnedev Can you give the specific implementation code?
I tried to complete the rotation animation
let id = null
function rotateAnimation(plus) {
let pos = rotate
clearInterval(id)
id = setInterval(frame, 0)
function frame() {
if (pos === rotate + (plus ? -90 : 90) ) {
clearInterval(id)
setRotate(pos % 360)
} else {
plus ? pos-- : pos++
setRotate(pos)
}
}
}