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

Animations for non-pure-number properties and effects #402

Open
m-hall opened this issue Sep 27, 2024 · 2 comments
Open

Animations for non-pure-number properties and effects #402

m-hall opened this issue Sep 27, 2024 · 2 comments

Comments

@m-hall
Copy link
Contributor

m-hall commented Sep 27, 2024

This is a request/proposal, and I wanted to get some advice for this before I take a look at possibly contributing a change myself.

My goal right now, is to allow gradient effects to animate their colors.

However, I think if I go down this road, it would make sense to allow any effect uniforms to have the ability to define their own animations calculations.

My proposal is to add an animate function to the ShaderEffectUniform. The definition would be something like:
animate?: (start: T, end: T, progress) => T

This would (in theory) allow any uniform to define how the values are to be interpolated. eg. allowing a number[] to be animated
Of course, the current method would be a backup for any uniform that does not define this property.

Ideally, if this works out, then I think it could be useful to allow animations on many style and shader properties that are not just single numbers, and enable custom effects to define their own interpolation as well.

@erikhaandrikman
Copy link
Contributor

Thanks for your proposal :) We haven’t investigated the possibility of implementing animation on shader uniforms yet, but it sounds like a really useful feature. Adding a ShaderEffectUniform to handle interpolation is interesting and could open up the way to more dynamic effects.

If you'd like to contribute, that would be really helpful!

@jfboeve
Copy link
Collaborator

jfboeve commented Oct 7, 2024

Hi @m-hall we are currently busy with an overhaul of the current shader system, that being said I think it would make more sense to implement a feature to the CoreAnimation to support interpolating arrays containing numbers. If you'd like to help us in that way I think it would also resolve your problem with gradient effects!

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

3 participants