0.2.8 • Published 2 years ago

react-style-text v0.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-style-text

Tests Release npm version

npm

React Component to show animated text and objects, built with styled-components.

The Component provides regular animation for common object and some animation effects especially for typography like letters and multi-line text.

Installation

Install via npm:

npm i react-style-text

Install via yarn:

yarn add react-style-text

Usage

To use react-style-text in your react project, wrap the content with a AnimatedComponent or TypeWriter component and customize the animation with relevant properties.

import React from "react";
import { AnimatedComponent, Typewriter } from "react-style-text";

export const MyAnimatedTypo = () => {
  return (
    <AnimatedComponent
      animationname="animation_type"
      duration="1000ms"
      delay="0s"
      direction="normal"
      timing="ease"
      iteration="infinite"
      fillMode="none"
    >
      Content...
    </AnimatedComponent>
  );
};

export const MyTypewriter = () => {
  return (
    <Typewriter
      datatext={["Hello World!", "Hello React!"]}
      cursorcolor="green"
      statictext="Example Text"
    />
  );
};

Available properties

PropertyCorresponding Animation PropertyData TypeDefault ValueProperty Unit
animationnameanimation-nameString"blur"-
durationanimation-durationString"1s"s or ms
delayanimation-delayString"0s"s or ms
directionanimation-directionString"alternate"-
timinganimation-timing-functionString"ease"-
iterationanimation-iteration-countNumber String"infinite"-
fillModeanimation-fill-modeString"none"-

Available animations

  • For entity object and letters

    Common effectsFadeFlipSlide
    blurfadeInflipslideInFromLeft
    bouncefadeInFromLeftflipInslideInFromRight
    effect3DfadeInFromRightflipOutslideOutToLeft
    flashfadeInFromTopflipSlowDownslideOutToRight
    floatfadeInFromBottomflipFromTopslideInFromTop
    glowingfadeOutflipToTopslideInFromBottom
    jellyfadeOutToLeftflipFromBottomslideOutToTop
    pulsefadeOutToRightflipToBottomslideOutToBottom
    shadowfadeOutToTopflipFromLeftToCenter
    spinfadeOutToBottom
    swing

 

FoldHangZoomPop
foldhangOnLeftzoomInpopIn
unfoldhangOnRightzoomOutpopOut

 

RotateShakeSqueeze
rotateSlowDownshakeMixsqueezeMix
rotateCWshakeHorizontalsqueezeHorizontal
rotateACWshakeVerticalsqueezeVertical

Chain Animation

A string array of animation names used to wrap the animations you want to chain.

import React, { useState } from "react";
import {AnimatedComponent} from "react-style-text";

const AnimationsForChaining = [
  "swing",
  "flipSlowDown",
  "fadeOutToBottom",
  "jelly",
];

const AnimationChain = () => {
  const [animationIndex, setAnimationIndex] = useState(0);
  const [animationType, setAnimationType] = useState(AnimationsForChaining[0]);

  const handleChainAnimation = () => {
    setCounter(animationIndex + 1);
    setAnimationType(selectedItems[animationIndex + 1]);
  };

  return (
    <AnimatedComponent
      onAnimationEnd={handleChainAnimation}
      animationname={animationType}
      duration="1000ms"
      timing="linear"
      iteration={1}
    >
      AnimatedComponent
    </AnimatedComponen
  );
};

Typewriter Animation

A string array of animation names used to wrap the animations you want to chain.

import React, { useState } from "react";
import { Typewriter } from "react-style-text";

const MyTypewriter = () => {
  const [text, setText] = useState<string[]>(["Hello World!", "Hello React!"]);

  return (
    <Typewriter
      dataText={text}
      cursorcolor="green"
      statictext="Example Text"
    />
  );
};

License

MIT © Andrew Edwards

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.1.16

2 years ago

0.2.6

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.2.8

2 years ago

0.1.19

2 years ago

0.1.9

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.5

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago