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

[Feature Request] Animate individual paths #241

Closed
jmaris opened this issue Jun 23, 2022 · 2 comments
Closed

[Feature Request] Animate individual paths #241

jmaris opened this issue Jun 23, 2022 · 2 comments

Comments

@jmaris
Copy link

jmaris commented Jun 23, 2022

Please define your problem or issue as clear as possible.

For a problem, please fill the following:

Vivus version: 0.4.6

Browser: Firefox (latest release)

Hey, I was wondering if it is possible to animate individual paths.

To explain what I am trying to do, I would like for part of my SVG to be rendered by default, except a select set that I want to animate, then to have a javascript function that allows me to animate those paths when, for instance, a button is clicked

Is that possible with the library as-is? I wasn't 100% sure from the documentation

Thanks :)

@maxwellito
Copy link
Owner

Hi @jmaris

Thanks for your patience. After looking at your needs, I doubt this library can help you to achieve this. However, there's maybe a trick to try. I can't promess it works:

  1. Set your indivudual paths in groups
<svg>
  <g id="group_1">
    <circle ..../>
  </g>
  <g id="group_2">
    <circle ..../>
    <circle ..../>
  </g>
</svg>
  1. Create one Vivus object per group
const g1 = new Vivus('group_1', {start: 'manual'});
const g2 = new Vivus('group_2', {start: 'manual'});
  1. Use them when needed
randomButton.addEvenetListener('click', () => {
  g1.play();
})

I hope this makes sense

@jmaris
Copy link
Author

jmaris commented Jul 10, 2022

This makes perfect sense, i'll give it a go :)
Thanks !

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