0.2.8 • Published 5 months ago

react-style-text v0.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months 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

5 months ago

0.1.11

5 months ago

0.1.12

5 months ago

0.1.13

5 months ago

0.1.14

5 months ago

0.1.15

5 months ago

0.1.27

5 months ago

0.1.28

5 months ago

0.1.20

5 months ago

0.1.21

5 months ago

0.1.22

5 months ago

0.1.23

5 months ago

0.1.24

5 months ago

0.1.25

5 months ago

0.1.26

5 months ago

0.2.1

5 months ago

0.2.0

5 months ago

0.2.7

5 months ago

0.1.16

5 months ago

0.2.6

5 months ago

0.1.17

5 months ago

0.1.18

5 months ago

0.2.8

5 months ago

0.1.19

5 months ago

0.1.9

5 months ago

0.2.3

5 months ago

0.2.2

5 months ago

0.2.5

5 months ago

0.2.4

5 months ago

0.1.8

5 months ago

0.1.7

5 months ago

0.1.5

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago