All Projects → alexvcasillas → Animated Styled Components

alexvcasillas / Animated Styled Components

React Animated Styled Components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Animated Styled Components

Fakebooker Frontend
Stars: ✭ 124 (-12.68%)
Mutual labels:  styled-components
Blockstack.org
The Blockstack website
Stars: ✭ 132 (-7.04%)
Mutual labels:  styled-components
Gatsby V2 Tutorial Starter
Gatsby V2 Starter - product of step by step tutorial
Stars: ✭ 139 (-2.11%)
Mutual labels:  styled-components
React Native Expanding Circle Transition
A simple react native component to make an expanding circle transition.
Stars: ✭ 125 (-11.97%)
Mutual labels:  animated
React Next Boilerplate
🚀 A basis for reducing the configuration of your projects with nextJS, best development practices and popular libraries in the developer community.
Stars: ✭ 129 (-9.15%)
Mutual labels:  styled-components
Babel Plugin Polished
Compile polished helper functions at build time
Stars: ✭ 133 (-6.34%)
Mutual labels:  styled-components
React Native Submit Button
Animated Submit button. Works on both android and ios.
Stars: ✭ 124 (-12.68%)
Mutual labels:  animated
Project Webcube
Continuously updated JS infrastructure for modern web dev
Stars: ✭ 141 (-0.7%)
Mutual labels:  styled-components
React Stickyroll
A react implementation of stickyroll (original)
Stars: ✭ 132 (-7.04%)
Mutual labels:  styled-components
Expo Dark Mode Switch
A beautiful React dark mode switch component for iOS, Android, and Web
Stars: ✭ 137 (-3.52%)
Mutual labels:  animated
Xstyled
A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️
Stars: ✭ 1,835 (+1192.25%)
Mutual labels:  styled-components
Fluid System
Fluid System is a style props function transformer for generating fluid styles. 💦
Stars: ✭ 130 (-8.45%)
Mutual labels:  styled-components
React Native Boilerplate
A React Native boilerplate with Expo, Redux, React Navigation, Styled Components and some 💕 included.
Stars: ✭ 135 (-4.93%)
Mutual labels:  styled-components
Gatsby Admin Template
Free admin dashboard template based on Gatsby with @paljs/ui component package
Stars: ✭ 124 (-12.68%)
Mutual labels:  styled-components
Styled Icons
💅 Popular icon packs like Font Awesome, Material Design, and Octicons, available as React Styled Components
Stars: ✭ 1,878 (+1222.54%)
Mutual labels:  styled-components
Smooth Ui
Modern React UI library 💅👩‍🎤🍭
Stars: ✭ 1,583 (+1014.79%)
Mutual labels:  styled-components
Gabriel Adorf Portfolio
Gabriel Adorf's personal website
Stars: ✭ 133 (-6.34%)
Mutual labels:  styled-components
Django React Typescript
A boilerplate with Django on the backend, React on the frontend, and much more!
Stars: ✭ 142 (+0%)
Mutual labels:  styled-components
React Native Async Image Animated
Simple cross-platform asynchronous image component for React Native 🙌🏻 with a progressive and placeholder image support. Placeholder color otherwise with a few animation options.
Stars: ✭ 141 (-0.7%)
Mutual labels:  animated
Next Dark Mode
🌑 Enable dark mode for Next.js apps
Stars: ✭ 133 (-6.34%)
Mutual labels:  styled-components

Animated Styled Components

React Animated Styled Components is a library that aims to make ease to use plug and play animated components.

Installing Animated Styled Components

NPM

npm i --save animated-styled-components

YARN

yarn add animated-styled-components

Demo

You can check for a working CodeSandbox to see a small demonstration of this library.

Using the Animated Component

To make use of the Animated component you need to include the library into your project and create a new component just like you would do with any other react component.

import React, { Component } from 'react';
// Make the import into your react component file
import { Animated, FadeAnimations, RotateAnimations } from 'animated-styled-components';

class Showcase extends Component {
  render() {
    return (
      <div>
        <Animated
          animation={{
            delay_in: 5,
            in: FadeAnimations.FadeInBottom,
            duration_in: 1,
            continuous: RotateAnimations.RotateCenter,
            duration_continuous: 1,
            out: FadeAnimations.FadeOutTop,
            duration_out: 1,
            delay_between: 5
          }}
          transitions={[
            {
              type: 'hover',
              from: { property: 'border-radius', value: 0 },
              to: { property: 'border-radius', value: 10 }
            }
          ]}
        >
          This is an animated component
        </Animated>
      </div>
    );
  }
}

At the above example you can see a basic structure of an Animated Component. We will dig more into all the props later on this documentation.

Props

The Animated Component doesn't need to be filled with any props, if you don't provide props, it will just simply do nothing, but, to make the magic happen, those props are the following: animation and transitions.

Animation Prop

The animation prop is an object that needs to have the following structure:

animation={{
  delay_in: 5,
  in: FadeAnimations.FadeInBottom,
  duration_in: 1,
  continuous: RotateAnimations.RotateCenter,
  duration_continuous: 1,
  out: FadeAnimations.FadeOutTop,
  duration_out: 1,
  delay_between: 5,
  iteration: 
}}

Deconstructing the animation prop

  • in: This property receives an animation keyframe that will be used to animate in the component.
  • delay_in: This property receives and integer and will set the time that the component will take to start being animated. While this time isn't reached, the component will be mounted but will display nothing. If this property is not setted there won't be any delay in for the component to start animating.
  • duration_in: This property receives and integer greater than 0 and will set the duration in seconds for the in animation.
  • continuous: This property receives an animation keyframe that will be used to animate between in and out (if proceed).
  • duration_continuous: This property receives an integer greater than 0 and will set the duration in seconds for the continuous animation.
  • out: This property receives an animation keyframe that will be used to animate out the component.
  • duration_out: This property receives and integer greater than 0 and will set the duration in seconds for the out animation.
  • delay_between: This property receives and integer geater or equals to 0 and will set the time that will wait between the in and out animations.
  • iteration: This property receives and integer greater than 0 or the literal 'infinite' and will set the amount of iterations the animation should be doing until it goes out (if it should).

Transitions Prop

The transitions prop is an array of objects with the desired transitions that should be handled and needs to have the following structure:

transitions={[
  {
    type: 'hover',
    from: { property: 'border-radius', value: 0 },
    to: { property: 'border-radius', value: 10 }
  }
]}

Deconstructing the transitions prop

An array of objects that must contain the following structure:

  • type: This property must be a string literal from the following literals available: hover, focus, blur, active. This property is the one who's going to set the type of transition we want to achieve.
  • from: This property will define the starting values of the properties to transition. This property must be an object with the following inner properties:
    • property: This property must be a valid CSS property (it will be checked to avoid using unknown properties).
    • value: This property must be a string or a number depending on the property type (will be automatically checked to prevent inconsistencies).
  • to: This property will define the ending values of the properties to transition. This property must be an object with the following inner properties:
    • property: This property must be a valid CSS property (it will be checked to avoid using unknown properties).
    • value: This property must be a string or a number depending on the property type (will be automatically checked to prevent inconsistencies).

Animations

This component gives you a lot of built-in animations that are well tested and ready to be used.

If you want to use our built-in animations you only need to to the following when importing animated-styled-components:

{ AnimationsType } from 'animated-styled-components';

Where AnimationsType are one of the following avaible grouped animations. Each of this groups have the animations.

BounceAnimations

With the following implemented animations:

BounceInForwards


ScaleAnimations

With the following implemented animations:

ScaleInCenter


FadeAnimations

With the following implemented animations:

FadeIn

FadeInTop

FadeOutTop

FadeInBottom

FadeInLeft

FadeInRight


RotateAnimations

With the following implemented animations:

RotateInCenter

RotateCenter


SlideAnimations

With the following implemented animations:

SlideTop

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].