Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

Refactor for composable animations #74

@itsdouges

Description

@itsdouges

Shower thought. A lot of the move animations duplicate common code.

What if we could compose animations together, move does move, reveal does reveal, crossfade fades between. Would prove to be a better implementation. Would have to solve combining styles via inline styles + classes.

Some would work naturally (reveal + move), some wouldn't (conceal + move). Need to test.

Example API

import Baba, { Reveal as RevealFromTarget, Move, CrossFade, Target } from 'yubaba';

<Baba name="composing-animations">
  <Move>
    <RevealFromTarget>
      <CrossFade>
        {baba => (
          <div {...baba} id="container-element">
            <Target>{target => <div {...target} id="focal-element" />}</Target>
          </div>
        )}
      </CrossFade>
    </RevealFromTarget>
  </Move>
</Baba>

We can then compose them ourselves so this isn't a breaking change, for example

import { Move, CrossFade } from 'yubaba';

class CrossFadeMove extends React.Component {
  render() {
    const { children, ...props } = this.props;
    return (
      <Move {...props}>
        <CrossFade {...props}>{children}</CrossFade>
      </Move>
    );
  }
}

While we're doing this, also do:

  • Set sane defaults for zindex
  • Find any opportunities to cleanup animation code

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions