September 23, 2022

Animate Heartcodes Canvas Loader With jQuery | CanvasLoader

CanvasLoader is a jQuery plugin that uses the Html5 canvas element to create an animated (preloader) with an overlay appended to the Html element.

jquery loading spinner overlay example, preloader animation jquery, preloader jquery, page loader jquery example, jquery loader plugin, page preloading effect jquery

How to make use of it:

1. Include the necessary jQuery CanvasLoader javascript.

<script type="text/javascript" src="heartcode-canvasloader.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

2. Include the jQuery canvasLoader plugin after the jQuery library.

<script src="index.js"></script>

3. Configure the plugin to append a loader to a DIV element.

jQuery(function ($) {
"use strict";
var element = $('<div></div>').css({
width: 500,
height: 500,
border: '3px dashed green'
}).appendTo('body');

/**
 * Initial display canvas loader
 */
element.canvasLoader({
color: '#ff0000'
});

/**
 * Remove canvas loader on the origin instance
 */
element.canvasLoader(false);

/**
 * Reactivate canvas loader on the origin instance
 */
element.canvasLoader(true);

/**
 * Remove canvas loader by event if the origin instance is not available
 */
$(element).trigger('stop.canvasLoader');

/**
 * Manipulate options of current canvas loader instance
 */
element.canvasLoader.options.color='#008000';

/**
 * Reactivate canvas loader by event if the origin instance is not available
 */
$(element).trigger('start.canvasLoader');

/**
 * Manipulate default options
 */
$.fn.canvasLoader.options.color = '#0000ff';

/**
 * Get current version.
 * @type {string}
 */
var version = $.fn.canvasLoader.version;

});

4. Available options.

//  enable the loader during initialization
start: true,

// oval, square, rect(rectangle), roundRect(rounded rectangle) and spiral
shape: 'spiral', 

// Sets hexadecimal color of the loader
color: '#000', 

// Sets the diameter of the loader
diameter: 70, 

// Sets the number of shapes drawn on the loader canvas
density: 70, 

// Sets the amount of the modified shapes in percent.
range: 0.7, 

// Sets the speed of the loader animation.
speed: 2, 

// Sets the rendering frequency.
fps: 24 

Draw and Animate PreLoaders, jQuery.CanvasLoader Plugin/Github


See Demo And Download

Official Website(orianda): Click Here

This superior jQuery/javascript plugin is developed by orianda. For extra Advanced usage, please go to the official website.

Share

You may also like...

Leave a Reply

Your email address will not be published.