itsdouges / element-motion

Tween between view states with declarative zero configuration element motions for React
https://elementmotion.com
MIT License
810 stars 13 forks source link

Improve internal composable API for className #146

Open itsdouges opened 5 years ago

itsdouges commented 5 years ago

We can't easily compose things from className and keyframes ATM. Since this library wants to try and do things via CSS animation (over JS animation) we need to come up with a solution.

API thoughts:

setChildProps({
  // composable style
  style: prevStyle => ({ ...prevStyle }),

  // composable class via objects
  classNameStyle: prevStyle => ({ ...prevStyle }),

  // composable keyframes
  keyframes: prevKeyframes => compose => compose(prevKeyframes, newKeyframes, 'animation-name'),
});
itsdouges commented 5 years ago

Keyframes is done.