Animation

Animation

Animations are illusions of motions for web elements. +70 animations generated by CSS only and works properly on every browser.

Simple Usages

Using our animation is simple. Wrap the content you want to animate into the Animation component and specify its type. Check out the API section for more advanced options!

import React from "react";
import { CDBAnimation, CDBContainer } from "cdbreact";
export const Animation = () => {
return (
<CDBContainer>
<CDBAnimation type="bounce" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="flash" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="pulse" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="rubberBand" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="shake" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="headShake" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="swing" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="tada" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="wobble" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="jello" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
<CDBAnimation type="heartBeat" infinite>
<img alt="" src="img/ball.png" width="50" height="50" />
</CDBAnimation>
</CDBContainer>
);
};

API

In this section you will find advanced information about the Animation component. You will find out which modules are required, what are the possibilities of configuring the component, and what events and methods you can use to work with it.

Contrast Animation Import Statement

You need to import the Contrast Animation component first before using it.

import { CDBAnimation } from "cdbreact";

API Reference: Contrast Animation Properties

The table below shows the configuration options of the CDBAnimation component.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classesAdds custom classes<CDBAnimation className="myClass" ... />
tagfunction or StringdivChanges default input tag<CDBAnimation tag="input" ... />
countNumber1The number of iterations the animation should have<CDBAnimation count="{2}" .../>
delayStringSets the amount of time that should pass before the initial iteration of animation, takes a string consisting of a number and a unit indicator (s/ms)<CDBAnimation delay="3s" .../>
durationString or Number1Defines the speed of animation, takes a string consisting of a number and a unit indicator (s/ms)<CDBAnimation duration="3s" .../>
infiniteBooleanfalseMakes an animation go for eternity. Note: it overwrites the count prop<CDBAnimation infinite .../>
onAnimationStartfunctionFires once an animation starts<CDBAnimation onAnimationStart={handleAnimationStart} .../>
onAnimationIterationfunctionFunction gets executed every time an animation happens. To have things happening only on particular iterations (say, every time for the first five times and then every fifth one), it is enough to create a variable being incremented within a function and to define a simple if statement to see, whether the ongoing iteration number fulfills the requirement (example if (count < 6 && count > 5){yourFunction})<CDBAnimation onAnimationIteration={yourFunction} .../>
onAnimationEndfunctionFires at the final iteration of an animation<CDBAnimation onAnimationEnd={handleAnimationEnd} .../>
revealBooleanfalseSetting this option makes the component postpone the animation till the viewport reaches it's relative position<CDBAnimation reveal .../>
typeStringThis prop defines the kind of animation desired<CDBAnimation type="tada" .../>