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

Callback function for when a path is completed? #249

Open
jmckalex opened this issue Jan 29, 2023 · 1 comment
Open

Callback function for when a path is completed? #249

jmckalex opened this issue Jan 29, 2023 · 1 comment

Comments

@jmckalex
Copy link

Thanks so much for making this code available.

Is there a way to arrange to have a callback function called when a path is completed? I am using vivus with reveal.js (https://revealjs.com) and I would like to be able to have parts of a SVG "drawn in" using the OneByOne animation type as part of a reveal fragment. That requires being able to call stop() at the right time, so that only the desired paths are drawn, with the rest remaining hidden until the next fragment is shown.

What I have in mind is the ability to register a callback function like

   path_completed( path ) { ..... }

where 'path' is the DOM element of the path which just finished drawing in its entirety. By registering such a callback function, it would be easy to check if certain paths had finished drawing and, if so, call stop() to pause the drawing. Or do other things, like change the class so as to allow a CSS animation to fade-in the fill of a closed path which was just drawn (like the hack you give).

@maxwellito
Copy link
Owner

Hello! Hello!

Thanks for your kind words :)
About your request, nothing out of the box will let you do that. However, I provided a trick in the issue #241 that should help you. This will require to edit your SVG and group your paths.

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