Folding Loader Animated SVG

Animated with Raphaël JavaScript Library

Description

How to resize animated SVG element

How to resize text elements

Javascript variables explained

Notes

Description

Folding Loader SVG animation made Raphaël JavaScript Library. For page preloaders, content loaders, process indicators.

How to resize animated SVG element

Width and height properties are defined with CSS. Defaul values are 100px for both.

  1. Open loader-style.css file in your favorite code editor
  2. Search for .loader svg selector
  3. Changed the values (in pixels)
  4. Save the file.

How to resize text elements

  1. Open loader-style.css file in your favorite code editor
  2. Search for .loader-text h2 and .loader-text p selectors
  3. Changed the values (in pixels)
  4. Save the file.

Javascript variables explained

You may edit these Javascript variables from loader.js, located right after the line /* SETUP ------

shapes Array of strings

The array of 13 predefined SVG shapes (paths) you can choose from. Paths in this array is actually half of the shape, as only half of is needed for animation (scaling). It is mirrored with code, so final element is full shape:

Note that three shapes can't be rotated during animation as they are unsymmetric in 4 sides : heart_unsymmetric, bars_unsymmetric, hexagon_unsymmetric

use_shape Array element pointer

Select the shape from array 'shapes' above. For example: shapes.rect_rotated

colors Array of strings

The sequence of folding shapes' colors.

darken_amount Number

Amount of darkening the color when animated. Default is 0.3

duration_1st_half | duration_2nd_half Number

Duration of 1st and 2nd half of animation loop. Default is 300

pause Number

Pause after 2nd half of animation loop. Default is 150

easing_1st_half | easing_2nd_half String

Animation easing methods. Possible values "<", ">", "linear", "<>", "bounce", "elastic", "backIn", "backOut"

More info: http://raphaeljs.com/easing.html

angles Array of numbers

Angle of SVG elements' rotation after 2nd half of animation loop. Only positive degree values.

Rotation sequence example: [ 0, 90, 180, 270 ] (makes loader to rotate by 90 degree after 2nd half of animation loop)

If you don't want the loader to rotate, use the array with single variable, for example: [ 180 ]

Notes

“Raphaël JavaScript Library” made by Dmitry Baranovskiy (The MIT License).