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

Any idea how to animate box-shadow? #56

Open
ryanflorence opened this issue Mar 6, 2017 · 7 comments
Open

Any idea how to animate box-shadow? #56

ryanflorence opened this issue Mar 6, 2017 · 7 comments

Comments

@ryanflorence
Copy link

It's a silly rule since it doesn't have box-shadow-radius, spread, color, etc.

        boxShadow: anim.interpolate({
          inputRange: [ 0, 1 ],
          outputRange: [
            '0px 0px 0px hsla(0, 0%, 0%, 0.5)',
            '0px 0px 40px hsla(0, 0%, 0%, 0.5)'
          ]
        }),

That would be cool! but seems heavy to have to dig in and find every possible number that could be interpolating :\

Any ideas?

@browniefed
Copy link
Member

@ryanflorence there is a PR open for it

@browniefed
Copy link
Member

Ah has a conflicting issue, needs a rebase.

@arcanis
Copy link
Collaborator

arcanis commented Mar 6, 2017

If targeting the web, you could be using the Animated.template function to support it. Something like this would yield the result in your first post, but you could add other values to interpolate the other properties as well:

let value = anim.interpolate({ inputRange: [ 0, 1 ], outputRange: [ 0, 40 ] });
...
style.boxShadow = Animated.template `0px 0px ${value}px hsla(0, 0, 0, 0.5)`;

@browniefed
Copy link
Member

Nothing that specific is actually needed. Just need to fix the interpolation to understand multi-values.
#47

@arcanis
Copy link
Collaborator

arcanis commented Mar 6, 2017

Sure, in this specific case it's only a workaround :)

@browniefed
Copy link
Member

Yeah good point, I believe Leland Richardson had ideas about all of this. Although mostly in the form of building out new Animated.Value abilities w/ Animated.Shape

Lots of use cases to be covered, especially SVG paths which I think is a huge one.

@souporserious
Copy link

I'd love to help out with SVG interpolation if it's still needed :) I've been looking at a lot of libs that support this. I'm guessing it would need to work in both React Native and React Web? I should be able to handle the web side or at least start it, I'd be willing to look into RN as well and try to learn some things.

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

4 participants