Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can rotation be animated? #367

Open
gaohomway opened this issue Apr 24, 2022 · 3 comments
Open

Can rotation be animated? #367

gaohomway opened this issue Apr 24, 2022 · 3 comments

Comments

@gaohomway
Copy link

gaohomway commented Apr 24, 2022

Can rotation be animated?

@gaohomway gaohomway changed the title Can you choose to add animation? Can rotation be animated? Apr 24, 2022
@pwnedev
Copy link

pwnedev commented May 16, 2022

Can rotation be animated?

It should be easy to animate it, just rotate it slowly in an X amount of time

@gaohomway
Copy link
Author

@pwnedev Can you give the specific implementation code?

@gaohomway
Copy link
Author

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)
            }
        }
    }


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants