npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

animate-css-styled-components

v1.0.2

Published

port of animate.css for styled-components

Downloads

9,453

Readme

animate-css-styled-components

simple port of animate css for styled-components

Build Status


instalation

install animate-css-styled-components

[sudo] npm i --save animate-css-styled-components

How to use

import animate-css-styled-components module calling global animations

import { Wobble, FadeIn, FadeOut } from 'animate-css-styled-components';
See how import specifics animations here.

Now, this animation is a component and you can encompassing the desired content within the component.

Example:

  <Wobble duration="0.8s" delay="1s">
    <Card>
      card content...
    </Card>
  </Wobble>

Props

  • duration
    • prop for represent animation-duration
    • default 1s
  • delay
    • prop for represent animation-delay
    • default 0s
  • timingFunction
    • prop for represent animation-timing-function
    • default ease
  • iterationCount
    • prop for represent animation-iteration-count
    • default 1
  • direction
    • prop for represent animation-direction
    • default normal
  • fillMode
    • prop for represent animation-fill-mode
    • default both
  • playState
    • prop for represent animation-play-state
    • default running
  • display
    • prop for represent display css property
    • default block

Animate - HOC

For convenience you can use Animate HOC to use animations stacked, you could pass a unique component to Animation prop or an array of animations, example:

  import Animate, {
    Flash,
    Bounce
  } from 'animate-css-styled-components';

  <Animate 
    Animation={[Flash, Bounce]} 
    duration="0.8s" 
    delay="0.2s">
    <Card>
      card content...
    </Card>
  </Animate>

In this example that you could see here, the Bounce Animation will run after when Flash animation is finished, respecting the duration time + delay time, duration and delay are same for all animations, but you could pass diferents values to each animation prop, look:

  import Animate, {
    Flash,
    Bounce,
    FadeOut,
    FadeIn
  } from 'animate-css-styled-components';

  <Animate 
    Animation={[Flash, Bounce, FadeOut, FadeIn]}
    duration={["0.8s", "3s", "2s", "0.4s"]}
    delay={["0.2s", "0.1s", "0.5s", "1s"]}>
    <Card>
      card content...
    </Card>
  </Animate>

See this example here

Don't forget, you coul pass any animations props as single string if the value are same for all animations stacked or an array of values.

Examples - Storybook

See all examples here

How to create custom styled animations

You can import BaseAnimation component and create your custom animation

Example:

  import { BaseAnimation } from 'animate-css-styled-components';

  //create your custom animation
  const SlideOutDownAnimation = keyframes`
    from {
      transform: translate3d(0, 0, 0);
    }

    to {
      visibility: hidden;
      transform: translate3d(0, 100%, 0);
    }
  `;

  //extend BaseAnimation component and create
  //your custom styled animation
  const SlideOutDown = styled(BaseAnimation)`
    animation-name: ${SlideOutDownAnimation};
  `;

  //export your custom styled animation  
  export default SlideOutDown;

now your animation is a styled-component and you can use this like any other styled-component, passing the all BaseAnimation props.

Made with love and styled-components!