1.0.2 • Published 5 years ago

@stnew/animation-wrapper v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

@stnew/animation-wrapper

Component that wraps other content and runs an animation on the content when it becomes visible on the page.

npm install @stnew/animation-wrapper
import { AnimationWrapper } from '@stnew/animation-wrapper';

const AnimatedComponent = () => (
  <AnimationWrapper>
    <p>Hello world!</p>
  </AnimationWrapper>
)
PropsTypeDefaultDesc
childrenReacChildrenundefinedElement(s) to be animated. *Required
rootElement0pxroot option passed to IntersectionObserver.
rootMarginstring0pxrootMargin option passed to IntersectionObserver.
thresholdnumber0threshold option passed to IntersectionObserver.
generalClassstringanimationcss class to be applied at all times to the wrapper component.
finalClassstringanimation-tocss class to be applied to the wrapper component once the content comes into view.
initialClassstringanimation-fromcss class to be applied to the wrapper component before the content comes into view.
delaynumber0time (in milliseconds) between when the element comes into view and when the finalClass gets applied.
heightDelayMultnumber1if multiple AnimationWrapper components are in view when the page loads, their animations are delayed by an amount relative to how far they are from the top of the page. heightDelayMult can increase or increase this offset. A value of 0 will remove the delay.
1.0.2

5 years ago