motiondivision / motion

A modern animation library for React and JavaScript
https://motion.dev
MIT License
25.66k stars 842 forks source link

[FEATURE] export buildHTMLStyles #2875

Closed productdevbook closed 1 week ago

productdevbook commented 1 week ago

Is your feature request related to a problem? Please describe.
I'm currently facing a challenge where I need to convert Motion values into HTML-compatible styles for custom integrations. However, the buildHTMLStyles function is not accessible externally, which limits my ability to transform or utilize Motion values effectively in specific cases where direct access to HTML-styled outputs is required.

Describe the solution you'd like
I would like buildHTMLStyles to be exported so that it can be accessed as a utility function. This way, I can transform Motion values into HTML styles outside of the Motion framework, enabling more flexible style manipulation and integration with other parts of my application.

Describe alternatives you've considered
One alternative is to manually replicate the logic of buildHTMLStyles in my code, but this is inefficient and error-prone, as updates to the original function in Motion would require repeated adjustments. Another alternative is to rely on inline styles, but this doesn't offer the same flexibility as having the function directly available.

Additional context
Exporting buildHTMLStyles as a utility could greatly enhance flexibility for developers looking to use Motion-generated values in broader CSS or HTML-based contexts. This feature would support custom animations and styling needs in a more modular way, potentially enabling easier integration across different environments or frameworks.

mattgperry commented 1 week ago

Hey @productdevbook unfortunately this isn't something I want to make public or support being public right now. As explained in the PR I would like to revamp this whole part of the render pipeline early next year.

productdevbook commented 1 week ago

Could you make this available temporarily until the redesign is complete, so we can use it in the meantime? Once the redesign is ready, could you introduce it to the community in its updated form? Am I mistaken in thinking this functionality is essential for us right now?