Foundation
Main View
Components
Charts
Dialogs
Framer Animations
Forms
Grids
Typography
Tools
Package: @uireact/framer-animations
Set of basic framer motion props that have animations configured to quickly re use animation objects through multiple components.
1. Make sure you install peer dependencies first:
2. Install package:
npm i -S @uireact/framer-animations
All animations uses MotionProps
type to create the needed animation props so you only pass it to the @UiReact
components or
you can spread it into any motion
component.
These animations are executed when component is rendered:
<UiCard motion={UiReactFadeUp}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </UiCard>
These animations are executed when component is hovered:
<UiCard motion={{ ...UiReactHoverScaleUp }}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </UiCard>
These animations are executed when component is clicked:
<UiCard motion={{ ...UiReactTapScaleDown }}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </UiCard>
These animations are executed every time the component enters the view:
<UiCard motion={{ ...UiReactViewFloat }}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </UiCard>
∞ = Animation repeats
Some icons play very well with a a few animations like these ones:
Rotating:
<UiIcon icon="SettingsBig" category="tertiary" size="xlarge" motion={UiReactViewRotating} />
Dancing:
<UiIcon icon="BellRing" category="tertiary" size="xlarge" motion={UiReactViewDancing} />
Shake on hover:
<UiIcon icon="ShoppingBasket" category="tertiary" size="xlarge" motion={UiReactHoverShake} />
We are working on animations for icons, that animate the actual SVG paths, stay tuned for that future release 🚀
Using these objects you CAN'T merge objects for the same animation states because the later would override the previous one for instace:
Merge 2 fade-in animations won't work:
❌ { ...UiReactFadeUp, ...UiReactFadeDown}
Although merging different state animatios such as fade-in animation, hover and tap animation will work:
✅ { ...UiReactFadeUp, ...UiReactHoverScaleUp, ...UiReactTapScaleDown}
<UiCard motion={{ ...UiReactViewFloat, ...UiReactTapScaleDown, ...UiReactHoverScaleUp }}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </UiCard>
You can use this animation objects without @uireact library, For example in a simple motion component:
// Using it as is: <motion.div style={{backgroundColor: '#000000'}} {...UiReactFadeUp}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </motion.div> // Customizing some props: const custom = {...UiReactFadeUp, transition: { delay: 2 }}; <motion.div style={{backgroundColor: '#000000'}} {...custom}> <UiHeading>Card header</UiHeading> <UiText>Card content</UiText> </motion.div>
These are the animations exported:
import { UiReactFadeUp, UiReactFadeDown, UiReactFadeLeft, UiReactFadeRight, UiReactHoverScaleUp, UiReactHoverElevate, UiReactTapScaleDown, UiReactTapPush, UiReactViewAppearUp, UiReactViewAppearLeft, UiReactViewAppearRight, UiReactViewFloat, UiReactViewPulse, UiReactViewDancing, UiReactViewRotating, UiReactViewShaking, UiReactHoverDance, UiReactHoverShake } from '@uireact/motion'