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

Can motionpath add a unit conversion? #611

Open
DanielLin0516 opened this issue Mar 10, 2025 · 4 comments
Open

Can motionpath add a unit conversion? #611

DanielLin0516 opened this issue Mar 10, 2025 · 4 comments

Comments

@DanielLin0516
Copy link

The unit I need is rem

@DanielLin0516
Copy link
Author

But I see that when gsap is converted into translate3d attribute, it is px

@jackdoyle
Copy link
Member

@DanielLin0516 can you please provide a minimal demo, like a CodePen, that clearly illustrates the problem you're trying to solve?

@DanielLin0516
Copy link
Author

Sorry, I don't have
motionPath Cannot adapt to different phone sizes when i only have path input like(I am not using svg html element)
motionPath: {
path: 'Mxxxxx',
align: element,
autoRotate: true,
alignOrigin: [0.5, 0.5],
},
because gsap is converted into translate3d attribute, it is px

but when i use svg html element ,giving it the appropriate size and the curve path is adaptive to mobile phones

@jackdoyle
Copy link
Member

It's very difficult to help you without a minimal demo that clearly illustrates the issue. I don't think what you're asking for is necessary or even possible due to many reasons. If you need a responsive path, there are many other ways to do it. Again, if you'd like more assistance, please provide a minimal demo as a CodePen. For example, here's one that uses MotionPath that you can just fork: https://codepen.io/cassie-codes/pen/mdddaRG?editors=0010

Often it's just a matter of making your SVG responsive, and then set up a debounced "resize" handler that then re-creates your animation based on the new size. gsap.context() might make it very easy for you.

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