CSS

Animations Page

The translate() Method

The translate() method moves an element from its current position:

This a normal div element.
This div element is moved 50 pixels to the right, and 100 pixels down from its current position.


The rotate() Method

The rotate() method rotates an element clockwise or counter-clockwise.

This a normal div element.
This div element is rotated clockwise 20 degrees.




The scale() Method

The scale() method increases or decreases the size of an element.

This a normal div element.
This div element is two times of its original width, and three times of its original height.

The scaleX() Method

The scaleX() method increases or decreases the width of an element.

This a normal div element.
This div element is two times of its original width.

The scaleY() Method

The scaleY() method increases or decreases the height of an element.

This a normal div element.
This div element is three times of its original height.




The skew(), skewX(), skewY() Method

The skew() method skews an element along the X-axis by the given angle.


The skewX() method skews an element along the X-axis by the given angle.


The skewY() method skews an element along the X-axis by the given angle.


This a normal div element.

The matrix() Method

The matrix() method combines all the 2D transform methods into one.

This a normal div element.
Using the matrix() method.

Another use of the matrix() method.


The rotateX() Method

The rotateX() method rotates an element around its X-axis at a given degree.

This a normal div element.
This div element is rotated 150 degrees.

The rotateY() Method

The rotateY() method rotates an element around its Y-axis at a given degree.

This a normal div element.
This div element is rotated 150 degrees.

The rotateZ() Method

The rotateZ() method rotates an element around its Z-axis at a given degree.

This a normal div element.
This div element is rotated 90 degrees.







The transition Property

Hover over the div element below, to see the transition effect:


Transition Linear


Transition Ease


Transition Ease-In


Transition Ease-Out


Transition Ease-In-Out


CSS Animation background

Note: When an animation is finished, it goes back to its original style.


CSS Animation background and position

Note: When an animation is finished, it goes back to its original style.


CSS Animation delay

The animation-delay property specifies a delay for the start of an animation. The following example has a 2 seconds delay before starting the animation:


CSS Animation repetitions

The animation-iteration-count property specifies the number of times an animation should run. The following example will run the animation 3 times before it stops:


CSS Animation reverse direction or alternate cycles

The animation-direction property specifies whether an animation should be played forwards, backwards or in alternate cycles. The following example will run the animation in reverse direction (backwards):


CSS Specify the Speed Curve of the Animation

The animation-timing-function property specifies the speed curve of the animation. The following example shows some of the different speed curves that can be used:

Linear

Ease

Ease-In

Ease-Out

Ease-In-Out


CSS Animation Specify the fill-mode

Let the div element get the style values set by the first keyframe before the animation starts (during the animation-delay period):


CSS Animation Shorthand

This example uses the shorthand animation property: