-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Responsive motion path animation example ? #556
Comments
@littlee https://codepen.io/spz/full/zbxqQW - this example with responsive motion path animation (with fix problem #541). The problem is function Now you can fix this problem with add viewBox attribute to parent of SVG element. |
You'll also have issues if the item you're animating is an SVGElement parented under the same SVG viewBox as your motion path element. This is because the library attempts to scale the path's x and y at line 637-638 based on the viewBox: But the viewBox will handle the scaling itself if the animated item is under the same viewBox as your path element. So it gets scaled twice and goes a bit funky: https://codepen.io/anon/pen/EJKaxz So that's something else to take into account if you're having issues getting the responsive motion path to work. |
Hey bro people seem to ignore this issue so I created a fork and published the fixed version on npm it's called |
I really need this to work. Did anyone get Elements under the same parent SVG to animate with motion paths? It works when the SVG isn't scaled, but when scaling to fit the window everything goes totally bonkers. I tried |
Never mind. In case anyone else has problems with SVGs not following path inside of parent SVG. "Fixed" it by modifying lines 636 - 637 in case 'x': return (p.x - svg.x);
case 'y': return (p.y - svg.y); Thank you @mhammo for valuable information. I only use animejs to animate svg elements inside of svgs. |
That's interesting because I got it working without removing |
Should be fixed in v3.1.0! |
Hey @juliangarnier You mention this being fixed in |
I've the same issue with anime v3.1.0.
But what's the easiest and/or most elegant way to this ? I wanted to do something like that :
But |
case 'x': return p.x; |
…path When the svg is scaled by DOM scaling, the path will be scaled twice without this change. This change in function getPathProgress moves away the multiplication of svg dimensions. When I want to animate obejct along the path(the path is inside a scaled svg), the object will follow the scaled path, which is not what I want. I would like to have the object move along the original path instead of the scaled path.
The fix ruyuewang@a776810 seems to work at least for the mentioned case. Do you, @juliangarnier, have any plans to put that into the official repo? |
Tested out ruyuewang@a776810 fix and I can confirm it fixes the problem in my case too. It make more sense that scaling is handled by viewBox of SVG and the animated element is hold inside same SVG, so we do not have to think about it. |
the docs said
but the demo in the doc is still a non-responsive version, can someone show me a responsive one ?
The text was updated successfully, but these errors were encountered: