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

Support for style objects in AnimateKeyframes #57

Closed
stroborobo opened this issue Jul 17, 2019 · 11 comments
Closed

Support for style objects in AnimateKeyframes #57

stroborobo opened this issue Jul 17, 2019 · 11 comments
Assignees

Comments

@stroborobo
Copy link

Is your feature request related to a problem? Please describe.
The API to define styles is different in AnimateKeyframes compared to Animate. While Animate supports an object with key/value as styles, AnimateKeyframes only seems to support a string, making it harder to compute and manipulate.

Describe the solution you'd like
It would be nice if AnimateKeyframes would support the style object, too.

Perhaps keyframes could look like this:

[
  {at: 0,   style: { opacity: 0 }},
  {at: 100, style: { opacity: 1 }},
]

Additional context
Putting the animation index (%) into a property instead of being the object key itself would help interoperability from other languages that compile to JS, but aren't as dynamic.

@bluebill1049
Copy link
Member

hi @stroborobo,

I can definitely support object syntax which aligns with <Animate />.

for at: 0, you can use Object.entity to get the key and value.

@bluebill1049
Copy link
Member

bluebill1049 commented Jul 18, 2019

hey @pangpang1987,

Did you have the capacity to convert object into a string for AnimateKeyFrames?

basically, support

<AnimateKeyframes 
    play 
    delay={1}
    duration={10}
    iterationCount={3}
    direction="alternative"
    keyframes={[
      {transform: 'translateY(0)'},
      {transform: 'translateY(10px)'},
    ]} 
  >

currently, we support only string:

<AnimateKeyframes 
    play 
    delay={1}
    duration={10}
    iterationCount={3}
    direction="alternative"
    keyframes={[
      'transform: translateY(0)',
      'transform: translateY(10px)',
    ]} 
  >

@stroborobo
Copy link
Author

@bluebill1049

for at: 0, you can use Object.entity to get the key and value

Object.entries? Absolutely, at was a brain fart anyway, I could just use maps or tuple lists instead m( But thanks for considering the main part of this request :)

@bluebill1049
Copy link
Member

haha no worries @stroborobo , either @pangpang1987 or I will work on that feature.

@bluebill1049 bluebill1049 self-assigned this Jul 18, 2019
@pangpang1987
Copy link
Contributor

@bluebill1049 I can work on this. Keep the styles object.

@bluebill1049
Copy link
Member

thanks, heaps @pangpang1987 legend.

@pangpang1987
Copy link
Contributor

thanks, heaps @pangpang1987 legend.

Do you want to reimplement the two step senerario to use from to? Or keep the existing one?

@bluebill1049
Copy link
Member

i think it's better to support both, then it's not a breaking change @pangpang1987

@bluebill1049
Copy link
Member

@pangpang1987 I have tested the feature branch works great 👍

however this is not workingkeyframes={[{ 0: {opacity: 0}}, {100: {opacity: 1}}]}

I will publish what you got with a minor update first, we can patch in the next release

@bluebill1049
Copy link
Member

@bluebill1049
Copy link
Member

Looks like the above use is low. Going to close it for now

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