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

SVG: support 'follow path' (animateMotion) #173

Open
adambelis opened this issue May 27, 2024 · 12 comments
Open

SVG: support 'follow path' (animateMotion) #173

adambelis opened this issue May 27, 2024 · 12 comments

Comments

@adambelis
Copy link

follow path
follow path.zip
friction_eVST6KpNJi

0.9.6-last

svg suport this effect :

<?xml version="1.0" encoding="UTF-8"?>
<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg">
  <!-- Define the path -->
  <path id="myPath" fill="none" stroke="gray" d="M 50 200 Q 150 50 250 200 T 450 200" />

  <!-- Define the circle to animate -->
  <circle r="10" fill="red">
    <!-- Animate the circle along the path -->
    <animateMotion repeatCount="indefinite" dur="5s">
      <mpath href="#myPath" />
    </animateMotion>
  </circle>

  <!-- Optional: Show the path for reference -->
  <path d="M 50 200 Q 150 50 250 200 T 450 200" fill="none" stroke="black" />
</svg>

If friction does not there should be maybe warning that this effect is not currently supported on export ? / in UI of exporter

@rodlie
Copy link
Member

rodlie commented May 27, 2024

If friction does not there should be maybe warning that this effect is not currently supported on export

There is a lot of things you can do in Friction that does not work in export SVG, assume effects (except for blur) don't work.

A workaround until this is implemented it to use expressions.

@rodlie rodlie added this to the 1.0.0 milestone May 27, 2024
@adambelis
Copy link
Author

well again if we know its not supported warning user would be nice . i would much rather if export worked but :D that is porbbyl harder to implment

@rodlie
Copy link
Member

rodlie commented May 27, 2024

well again if we know its not supported warning user would be nice

I know, but it's a bit more complicated than that.

I also think this is a bug, we shouldn't care about "follow path" or whatever, but the actual transform values we end up with.

@rodlie
Copy link
Member

rodlie commented May 27, 2024

A quick look into the code indicate that transform effects are not supported for SVG (no code).

So, this is supported:

  • Regular keyframes etc (timeline/graph)
  • Expressions
  • "Raster effect" blur
  • Path effects

Will look into supporting transform effects, unsure when.

@rodlie rodlie changed the title Follow path effect - does not export to svg Support Transform Effects (export SVG) May 27, 2024
@rodlie rodlie self-assigned this May 27, 2024
@rodlie rodlie changed the title Support Transform Effects (export SVG) SVG: support 'follow path' (transform effect) Aug 26, 2024
@rodlie rodlie added the w3c label Aug 26, 2024
@rodlie rodlie changed the title SVG: support 'follow path' (transform effect) SVG: support 'follow path' (animateMotion) Aug 26, 2024
@rodlie
Copy link
Member

rodlie commented Aug 26, 2024

Got a proof-of-concept, still need misc fixes etc, but hey, it kind of works 😄

friction-svg-animateMotion-2024-08-26_23.12.35.mp4

@rodlie rodlie pinned this issue Aug 26, 2024
rodlie added a commit that referenced this issue Aug 27, 2024
rodlie added a commit that referenced this issue Aug 27, 2024
Only 'follow path' is supported.
rodlie added a commit that referenced this issue Aug 27, 2024
Only 'follow path' is supported.
@rodlie
Copy link
Member

rodlie commented Aug 27, 2024

Ok, so it's working, took a bit of extra time to figure out how to set the offset. Has very limited testing (two project files). Will do some more testing later this week.

whatwhat

rodlie added a commit that referenced this issue Aug 28, 2024
Yeah... can't used 'rotate' in animateMotion as it forces pivot top-left.

Ref: #173
@rodlie
Copy link
Member

rodlie commented Aug 28, 2024

rotate will be a challenge, as SVG uses top-left pivot, so just setting auto don't work as expected.

Will need to calculate this in Friction and (in theory) use:

<animate attributeName="rotate" values="XXXXXX" keyTimes="XXXXXX" dur="X" fill="freeze"/>

Inside the animateMotion tag (after mpath). I have no idea if this will work in practice.

@rodlie rodlie unpinned this issue Sep 17, 2024
@rodlie rodlie modified the milestones: 1.0.0, 1.1.0 Sep 30, 2024
@pgilfernandez
Copy link

If friction does not there should be maybe warning that this effect is not currently supported on export

There is a lot of things you can do in Friction that does not work in export SVG, assume effects (except for blur) don't work.

A workaround until this is implemented it to use expressions.

Am I wrong or your are saying that blur effect and expressions work for animated SVG?

@rodlie
Copy link
Member

rodlie commented Nov 3, 2024

Am I wrong or your are saying that blur effect and expressions work for animated SVG?

Blur and shadow is supported. All expressions will be applied (converted to transforms) when exporting to SVG, just don't use $value #296

@pgilfernandez
Copy link

Wow, I understand. I'll try it out tomorrow as well!

Thanks!

@pgilfernandez
Copy link

Am I wrong or your are saying that blur effect and expressions work for animated SVG?

Blur and shadow is supported. All expressions will be applied (converted to transforms) when exporting to SVG, just don't use $value #296

You were right, they are all working fine!

I'm gonna try the "follow path " branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants