rough-notation
rough-notation copied to clipboard
feat: animate hide
Fixes: #57
This change introduces an animation to the hide() method, making the annotation disappear with a reverse animation of the show() method.
Previously, hide() would immediately remove the annotation's SVG elements from the DOM. This change modifies the hide() method to:
- Play the
show()animation in reverse. - Use
requestAnimationFrameto ensure the animation restart is smooth. - Use
setTimeoutto remove the SVG elements only after the animation has completed. This prevents race conditions whenshow()is called again while ahide()animation is in progress.
Tested
Added a demo page so you can pull this down and try it as well!
Contributing
Not sure what your contribution guidelines are, but just FYI the first pass at this was done with AI. The Jules product / Google doesn't claim any copyright over code generated by Jules though.
For my ref
Task ID: https://jules.google.com/task/18159235495996926247
I just thought about adding that. Thank you :)