• Stars
    star
    190
  • Rank 197,679 (Top 4 %)
  • Language
    HTML
  • Created about 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

simple port of animate css for styled-components

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!

More Repositories

1

awesome-microfronts

A curated list about Micro Fronts architecture and its implementations.
41
star
2

graphql-devtools

WIP a frameworkless Graphql dev tool focused in a good DX and simplicity - written in TS and state machines just for fun
TypeScript
24
star
3

schema-diff-bot

A simple slack bot to send the differences between graphql schemas
JavaScript
15
star
4

minimalist-store

a minimalist store using as maximum as possible of native object features + Proxy
JavaScript
13
star
5

workshop-reactNative

React native App - example for workshops
JavaScript
9
star
6

style-extractor

Extract all inline CSS from your HTML generating a css file for it.
TypeScript
8
star
7

slush-hot-landing

generator for static websites using my favorite stack
JavaScript
7
star
8

babel-maker

A cli to create initial babel configuration in an easy way
JavaScript
7
star
9

slush-itcss

generator for develop with itcss architecture and sass pre processor
JavaScript
6
star
10

minimal-normalize

normalizing your data before sending to your store
JavaScript
6
star
11

code-share

An extension to share your project or specific files from VSCode to world!
TypeScript
6
star
12

react-snowpack-rescript-template

a simple boilerplate starter to use rescript and snowpack
JavaScript
5
star
13

blog

my personal blog plataform made using Gatsby and React
JavaScript
4
star
14

redux-actionTypes-namespace

add name spaces to your global actionTypes in an easy way
JavaScript
4
star
15

memory-pg

a RPG memory game using react + Xstate
JavaScript
3
star
16

gatsby-starter-delog

HTML
3
star
17

agile-note

JavaScript
2
star
18

react-studies

my studies about react.js
JavaScript
2
star
19

slush-angular-basic

My personal template for develop angular webapp
JavaScript
2
star
20

strider-todo

a simple todo list with react + mobx + material ui
JavaScript
2
star
21

QRCodeExample-react-native

a simple react native app to scan a QRCode using device camera or getting the image from gallery
JavaScript
1
star
22

testing-danger-js

testing danger js for a demo, please automate your shit.
TypeScript
1
star
23

dielduarte.github.io

my personal blog
HTML
1
star
24

socket-chat-example

a simple example using socket.io, react, redux and redux ducks
JavaScript
1
star
25

tienda-test

JavaScript
1
star
26

button-builder

a simple example using rescript and react just for fun!
ReScript
1
star
27

snowpack-demo

just testing snowpack, I liked it!
JavaScript
1
star
28

cssgram-desktop

desktop app for using cssgram filters in your pictures
JavaScript
1
star
29

dom-events-advanced

examples for a presentation given in a Brazilian front-end engineering meetup - April 2022
HTML
1
star
30

my-primitives-styled

a list of primitives using stitches so you don't need to write css to compose your components anymore.
JavaScript
1
star
31

steps-component

simple react steps component with styled-component
JavaScript
1
star
32

angular-foursquare-integration-example

JavaScript
1
star
33

firebase-appsync-middleware

A nodejs API to be used as middleware connecting firebase auth and amazon Appsync
JavaScript
1
star
34

the-swift-web-WIP-

JavaScript
1
star
35

react-native-todolist

A simple example with react native and firebase.
JavaScript
1
star
36

allien-challenge

JavaScript
1
star
37

babel-plugins-and-events-logging

Presentation about how to create babel plugins and how my team automated events logging
1
star
38

react-web-camera

JavaScript
1
star
39

react-netflixroulette

A simple example integration into react and netflix roulette api
JavaScript
1
star
40

angularjs-studies

my studies about angular.js
HTML
1
star
41

eslint-plugin-better-js-code

This is just an experimental eslint plugin, to test my knowledge on AST, parsers, and eslint plugins in general
JavaScript
1
star
42

advent-of-code

Rust
1
star
43

ethereum-and-solidity-the-complete-developers-guide

This repository is just to save some examples that I did on ethereum and solidity the complete developers guide course.
JavaScript
1
star