Skip to content

Animate the Fill in SVG Path - When restart animation - Is there a way to restart the Path FILL? #692

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

Open
shir0206 opened this issue May 26, 2020 · 1 comment

Comments

@shir0206
Copy link

shir0206 commented May 26, 2020

When play the animation - the SVG Paths are being drawn & filled (I use color array to fill my SVG paths).
However, when restarting the animation, the SVG fill is not restarting, the Paths are already filled and only the stroke is animating. What should I do in order to change it and re-stroke& re-fill?

function animation() {
anime({
targets: "svg path",
strokeDashoffset: [anime.setDashoffset, 0],
easing: "cubicBezier(.5, .05, .1, .3)",
duration: 200,
delay: function (el, i) {
return i * 50 + 1500;
},
loop: false,
direction: "alternate",
autoplay: true,
fill: function (el, i) {
return colors[colors.lenght - 1- i];
},
});
}

EXAMPLE:
https://codesandbox.io/s/intelligent-banach-9pufd?file=/src/App.js

@shir0206 shir0206 changed the title Animate the Fill in SVG Path - When restart animation - Is there a way to restart The Path FILL? Animate the Fill in SVG Path - When restart animation - Is there a way to restart the Path FILL? May 26, 2020
@cameralibre
Copy link

when restarting the animation, the SVG fill is not restarting, the Paths are already filled and only the stroke is animating.

EXAMPLE:
https://codesandbox.io/s/intelligent-banach-9pufd?file=/src/App.js

I don't know if you've updated the linked project since opening this issue, but I can't reproduce the problem in Firefox or Chromium. Both the stroke and the fill are animating on restart, as expected.

Can this issue be closed now?

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