- VML mode IE8 display bugs fixed

- Canvas mode shape glitches fixed
- Documentation updated
- Minified js file updated
- Second test html file removed
This commit is contained in:
Robert Pataki committed 2011-10-16 16:43:08 +01:00
1 parent 7c1371181c
commit d67486e81d
12 files changed
+691 -718

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
.DS_Store
Executable → Regular
+287 -266
View File
@@ -15,9 +15,9 @@
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://heartcode.robertpataki.com/demos/canvasloader" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a></h1>
<h1><a href="http://heartcode.robertpataki.com/canvasloader/" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a></h1>
<h3>CanvasLoader&nbsp; <span class="subtitle">0.8.0</span></h3>
<a href="./index.html" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a>
<a href="./index.html" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a>
&gt; <a href="./module_canvasloader.html" title="CanvasLoader">CanvasLoader</a>
&gt; CanvasLoader
@@ -84,7 +84,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<code><span property="yui:name">id</span>
&lt;<span property="yui:type">String</span>&gt;
</code>
<span property="yui:description"> The id of the placeholder div.</span>
<span property="yui:description"> The id of the placeholder div</span>
</dd>
</dl>
@@ -104,7 +104,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The active shape id for rendering.
The active shape id for rendering
</div>
</div>
@@ -119,7 +119,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The canvas we use for caching.
The canvas we use for caching
</div>
</div>
@@ -134,7 +134,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The context of the cache canvas.
The context of the cache canvas
</div>
</div>
@@ -149,7 +149,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The div we draw the shapes into.
The div we draw the shapes into
</div>
</div>
@@ -164,7 +164,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The color of the loader shapes in HEX.
The color of the loader shapes in HEX
</div>
</div>
@@ -182,7 +182,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The color of the loader shapes in RGB.
The color of the loader shapes in RGB
</div>
</div>
@@ -197,7 +197,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The div we place the canvas object into.
The div we place the canvas object into
</div>
</div>
@@ -212,7 +212,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The canvas context.
The canvas context
</div>
</div>
@@ -227,7 +227,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The number of shapes drawn on the loader canvas.
The number of shapes drawn on the loader canvas
</div>
</div>
@@ -245,7 +245,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The diameter of the loader.
The diameter of the loader
</div>
</div>
@@ -255,21 +255,6 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</div>
<hr />
</div>
<div class="protected" rel="yui:property" resource="#property_fading">
<h4><a name="property_fading" property="yui:name">fading</a>
- <code>protected <span property="yui:type">Boolean</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
The fading of the loader shapes.
</div>
</div>
<hr />
</div>
<div class="protected" rel="yui:property" resource="#property_fps">
@@ -278,7 +263,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The FPS of the loader animation rendering.
The FPS value of the loader animation rendering
</div>
</div>
@@ -293,7 +278,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
Sets the amount of the modified shapes in percent.
The amount of the modified shapes in percent.
</div>
</div>
@@ -308,22 +293,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
Tell if the canvas and its context is ready.
</div>
</div>
<hr />
</div>
<div class="protected" rel="yui:property" resource="#property_running">
<h4><a name="property_running" property="yui:name">running</a>
- <code>protected <span property="yui:type">Boolean</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
Tell if the loader rendering is running.
Tells if the canvas and its context is ready
</div>
</div>
@@ -338,7 +308,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The type of the loader shapes.
The type of the loader shapes
</div>
</div>
@@ -356,7 +326,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
The speed of the loader animation.
The speed of the loader animation
</div>
</div>
@@ -371,7 +341,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</h4>
<div class="detail">
<div class="description" property="yui:description">
Add a timer for the rendering.
Adds a timer for the rendering
</div>
</div>
@@ -389,57 +359,68 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<div class="section method details">
<h3 id="methods">Methods</h3>
<div class="content">
<div class="" rel="yui:method" resource="#method_addEl">
<div class="protected" rel="yui:method" resource="#method_addEl">
<h4>
<a name="method_addEl">addEl</a></h4>
<div class="detail" >
<code>
protected
void
Object
<strong property="yui:name">addEl</strong>
(
tag
,
par
,
props
)
</code>
<div class="description" property="yui:description">
Creates a new element with the tag and applies the passed properties on it.
</div>
<div class="description">
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_canvasSupport">
<h4>
<a name="method_canvasSupport">canvasSupport</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">canvasSupport</strong>
(
)
</code>
<div class="description" property="yui:description">
Checks if the browser supports Canvas
Creates a new element with the tag and applies the passed properties on it
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">tag</span>
&lt;<span property="yui:type">String</span>&gt;
</code>
<span property="yui:description"> The tag to be created</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">par</span>
&lt;<span property="yui:type">String</span>&gt;
</code>
<span property="yui:description"> The DOM element the new element will be appended to</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">props</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> Additional properties passed to the new DOM element</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Object
</code></dt>
<dd property="yui:returnInfo">The DOM element</dd>
</dl>
@@ -464,7 +445,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Cleans the canvas.
Cleans the canvas
</div>
<div class="description">
@@ -517,25 +498,19 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
String
<strong property="yui:name">getColor</strong>
(
)
</code>
<div class="description" property="yui:description">
Returns the loader color in a hexadecimal form.
Returns the loader color in a hexadecimal form
</div>
<div class="description">
<dl>
<dt>Returns:
<code property="yui:return">
</code></dt>
<dd property="yui:returnInfo">String</dd>
</dl>
@@ -560,7 +535,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Returns the number of shapes drawn on the loader canvas.
Returns the number of shapes drawn on the loader canvas
</div>
<div class="description">
@@ -583,7 +558,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
Number
<strong property="yui:name">getDiameter</strong>
(
)
@@ -596,42 +571,6 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<div class="description">
<dl>
<dt>Returns:
<code property="yui:return">
</code></dt>
<dd property="yui:returnInfo">Number</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_getFading">
<h4>
<a name="method_getFading">getFading</a></h4>
<div class="detail" >
<code>
Boolean
<strong property="yui:name">getFading</strong>
(
)
</code>
<div class="description" property="yui:description">
Returns the fading of the loader shapes.
</div>
<div class="description">
@@ -656,7 +595,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Returns the fps of the loader.
Returns the fps of the loader
</div>
<div class="description">
@@ -686,7 +625,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Returns the modified shape range in percent.
Returns the modified shape range in percent
</div>
<div class="description">
@@ -721,7 +660,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Return the RGB values of the passed color.
Return the RGB values of the passed color
</div>
<div class="description">
@@ -730,9 +669,9 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">color</span>
&lt;<span property="yui:type">object</span>&gt;
&lt;<span property="yui:type">String</span>&gt;
</code>
<span property="yui:description"> (String) The HEX color value to be converted to RGB</span>
<span property="yui:description"> The HEX color value to be converted to RGB</span>
</dd>
</dl>
@@ -753,25 +692,19 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
String
<strong property="yui:name">getShape</strong>
(
)
</code>
<div class="description" property="yui:description">
Returns the type of the loader shapes.
Returns the type of the loader shapes
</div>
<div class="description">
<dl>
<dt>Returns:
<code property="yui:return">
</code></dt>
<dd property="yui:returnInfo">String</dd>
</dl>
@@ -796,7 +729,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Returns the speed of the loader animation.
Returns the speed of the loader animation
</div>
<div class="description">
@@ -826,7 +759,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Stop the rendering of the loader animation and hides the loader.
Stops the rendering of the loader animation and hides the loader
</div>
<div class="description">
@@ -854,14 +787,18 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
(
id
parentId
,
loaderId
)
</code>
<div class="description" property="yui:description">
Initialization method.
Initialization method
</div>
<div class="description">
@@ -869,10 +806,16 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">id</span>
<code><span property="yui:name">parentId</span>
&lt;<span property="yui:type">object</span>&gt;
</code>
<span property="yui:description"> String The id of the placeholder div.</span>
<span property="yui:description"> (String) The id of the placeholder div, where the loader will be nested into</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">loaderId</span>
&lt;<span property="yui:type">object</span>&gt;
</code>
<span property="yui:description"> (String) The id of loader</span>
</dd>
</dl>
@@ -900,7 +843,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Remove the CanvasLoader instance and all references.
Removes the CanvasLoader instance and all its references
</div>
<div class="description">
@@ -930,7 +873,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Redraws the canvas.
Redraws the canvas
</div>
<div class="description">
@@ -960,7 +903,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Resets the timer.
Resets the timer
</div>
<div class="description">
@@ -975,17 +918,26 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_setAttr">
<div class="protected" rel="yui:method" resource="#method_setAttr">
<h4>
<a name="method_setAttr">setAttr</a></h4>
<div class="detail" >
<code>
protected
void
Object
<strong property="yui:name">setAttr</strong>
(
el
,
props
)
</code>
@@ -995,7 +947,29 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">el</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> The DOM element to add the attributes to</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">props</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> The attributes</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Object
</code></dt>
<dd property="yui:returnInfo">The DOM element</dd>
</dl>
@@ -1025,7 +999,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Sets hexadecimal color of the loader.
Sets hexadecimal color of the loader
</div>
<div class="description">
@@ -1036,7 +1010,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<code><span property="yui:name">color</span>
&lt;<span property="yui:type">String</span>&gt;
</code>
<span property="yui:description"> The default value is '#000000'.</span>
<span property="yui:description"> The default value is '#000000'</span>
</dd>
</dl>
@@ -1049,17 +1023,26 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_setCSS">
<div class="protected" rel="yui:method" resource="#method_setCSS">
<h4>
<a name="method_setCSS">setCSS</a></h4>
<div class="detail" >
<code>
protected
void
Object
<strong property="yui:name">setCSS</strong>
(
el
,
props
)
</code>
@@ -1069,7 +1052,29 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">el</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> The DOM element to be styled</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">props</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> The style properties</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Object
</code></dt>
<dd property="yui:returnInfo">The DOM element</dd>
</dl>
@@ -1099,7 +1104,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Sets the number of shapes drawn on the loader canvas.
Sets the number of shapes drawn on the loader canvas
</div>
<div class="description">
@@ -1110,7 +1115,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<code><span property="yui:name">density</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> The default value is 40.</span>
<span property="yui:description"> The default value is 40</span>
</dd>
</dl>
@@ -1143,7 +1148,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
</code>
<div class="description" property="yui:description">
Sets the diameter of the loader.
Sets the diameter of the loader
</div>
<div class="description">
@@ -1154,51 +1159,7 @@ If no id is passed in the constructor, the canvas objects are paced in the docum
<code><span property="yui:name">diameter</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> The default value is 40.</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_setFading">
<h4>
<a name="method_setFading">setFading</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">setFading</strong>
(
fading
)
</code>
<div class="description" property="yui:description">
Sets the fading of the loader shapes.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">fading</span>
&lt;<span property="yui:type">Boolean</span>&gt;
</code>
<span property="yui:description"> The default value is true.</span>
<span property="yui:description"> The default value is 40</span>
</dd>
</dl>
@@ -1244,7 +1205,7 @@ Using the right combination of the <code>setSpeed</code> and the <code>setFPS</c
<code><span property="yui:name">fps</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> The default value is 24.</span>
<span property="yui:description"> The default value is 24</span>
</dd>
</dl>
@@ -1291,7 +1252,7 @@ The visually acceptable range value should be between 0.4 and 1.5.
<code><span property="yui:name">range</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> The default value is 1.3.</span>
<span property="yui:description"> The default value is 1.3</span>
</dd>
</dl>
@@ -1327,10 +1288,11 @@ The visually acceptable range value should be between 0.4 and 1.5.
Sets the type of the loader shapes.<br/>
<br/><b>The acceptable values are:</b>
<ul>
<li>'circle'</li>
<li>'oval'</li>
<li>'spiral'</li>
<li>'square'</li>
<li>'rectangle'</li>
<li>'roundedRectangle'</li>
<li>'rect'</li>
<li>'roundRect'</li>
</ul>
</div>
@@ -1342,7 +1304,7 @@ The visually acceptable range value should be between 0.4 and 1.5.
<code><span property="yui:name">shape</span>
&lt;<span property="yui:type">String</span>&gt;
</code>
<span property="yui:description"> The default value is 'circle'.</span>
<span property="yui:description"> The default value is 'oval'</span>
</dd>
</dl>
@@ -1388,7 +1350,7 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
<code><span property="yui:name">speed</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> The default value is 2.</span>
<span property="yui:description"> The default value is 2</span>
</dd>
</dl>
@@ -1416,7 +1378,7 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
</code>
<div class="description" property="yui:description">
Shows the rendering of the loader animation.
Shows the rendering of the loader animation
</div>
<div class="description">
@@ -1426,6 +1388,108 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
</div>
</div>
<hr />
</div>
<div class="protected" rel="yui:method" resource="#method_tick">
<h4>
<a name="method_tick">tick</a></h4>
<div class="detail" >
<code>
protected
void
<strong property="yui:name">tick</strong>
(
)
</code>
<div class="description" property="yui:description">
Renders the loader animation
</div>
<div class="description">
</div>
</div>
<hr />
</div>
<div class="protected" rel="yui:method" resource="#method_transformContext">
<h4>
<a name="method_transformContext">transformContext</a></h4>
<div class="detail" >
<code>
protected
void
<strong property="yui:name">transformContext</strong>
(
x
,
y
,
r
)
</code>
<div class="description" property="yui:description">
Prepares the cache canvas for drawing
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">x</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> The canvas context to be transformed</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">x</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> x translation</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">y</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> y translation</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">r</span>
&lt;<span property="yui:type">Number</span>&gt;
</code>
<span property="yui:description"> Rotation radians</span>
</dd>
</dl>
</div>
</div>
@@ -1437,40 +1501,6 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
</div>
<div rel="yui:events" resource="#events">
<div class="section method details">
<h3 id="events">Events</h3>
<div class="content">
<div class="protected" rel="yui:event" resource="#event_tick">
<h4>
<a name="event_tick">tick</a></h4>
<div class="detail">
<code>
protected
<strong property="yui:name">tick</strong>
(
)
</code>
<div class="description" property="yui:description">
Renders the loader animation.
</div>
<div class="description">
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
@@ -1518,11 +1548,9 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
<li class="protected"><a href="#property_context" title="context">context</a></li>
<li class="protected"><a href="#property_density" title="density">density</a></li>
<li class="protected"><a href="#property_diameter" title="diameter">diameter</a></li>
<li class="protected"><a href="#property_fading" title="fading">fading</a></li>
<li class="protected"><a href="#property_fps" title="fps">fps</a></li>
<li class="protected"><a href="#property_range" title="range">range</a></li>
<li class="protected"><a href="#property_ready" title="ready">ready</a></li>
<li class="protected"><a href="#property_running" title="running">running</a></li>
<li class="protected"><a href="#property_shape" title="shape">shape</a></li>
<li class="protected"><a href="#property_speed" title="speed">speed</a></li>
<li class="protected"><a href="#property_timer" title="timer">timer</a></li>
@@ -1532,14 +1560,12 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
<div id="methodsList" class="module">
<h4>Methods</h4>
<ul class="content">
<li class=""><a href="#method_addEl" title="addEl">addEl</a></li>
<li class=""><a href="#method_canvasSupport" title="canvasSupport">canvasSupport</a></li>
<li class="protected"><a href="#method_addEl" title="addEl">addEl</a></li>
<li class="protected"><a href="#method_clean" title="clean">clean</a></li>
<li class="protected"><a href="#method_draw" title="draw">draw</a></li>
<li class=""><a href="#method_getColor" title="getColor">getColor</a></li>
<li class=""><a href="#method_getDensity" title="getDensity">getDensity</a></li>
<li class=""><a href="#method_getDiameter" title="getDiameter">getDiameter</a></li>
<li class=""><a href="#method_getFading" title="getFading">getFading</a></li>
<li class=""><a href="#method_getFPS" title="getFPS">getFPS</a></li>
<li class=""><a href="#method_getRange" title="getRange">getRange</a></li>
<li class="protected"><a href="#method_getRGB" title="getRGB">getRGB</a></li>
@@ -1550,26 +1576,21 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
<li class=""><a href="#method_kill" title="kill">kill</a></li>
<li class="protected"><a href="#method_redraw" title="redraw">redraw</a></li>
<li class="protected"><a href="#method_reset" title="reset">reset</a></li>
<li class=""><a href="#method_setAttr" title="setAttr">setAttr</a></li>
<li class="protected"><a href="#method_setAttr" title="setAttr">setAttr</a></li>
<li class=""><a href="#method_setColor" title="setColor">setColor</a></li>
<li class=""><a href="#method_setCSS" title="setCSS">setCSS</a></li>
<li class="protected"><a href="#method_setCSS" title="setCSS">setCSS</a></li>
<li class=""><a href="#method_setDensity" title="setDensity">setDensity</a></li>
<li class=""><a href="#method_setDiameter" title="setDiameter">setDiameter</a></li>
<li class=""><a href="#method_setFading" title="setFading">setFading</a></li>
<li class=""><a href="#method_setFPS" title="setFPS">setFPS</a></li>
<li class=""><a href="#method_setRange" title="setRange">setRange</a></li>
<li class=""><a href="#method_setShape" title="setShape">setShape</a></li>
<li class=""><a href="#method_setSpeed" title="setSpeed">setSpeed</a></li>
<li class=""><a href="#method_show" title="show">show</a></li>
<li class="protected"><a href="#method_tick" title="tick">tick</a></li>
<li class="protected"><a href="#method_transformContext" title="transformContext">transformContext</a></li>
</ul>
</div>
<div id="eventsList" class="module">
<h4>Events</h4>
<ul class="content">
<li class="protected"><a href="#event_tick" title="tick">tick</a></li>
</ul>
</div>
</div>
@@ -1577,12 +1598,12 @@ Using the right combination of the <code>setFPS</code> and the <code>setSpeed</c
</div>
<div id="ft">
<hr />
Copyright &copy; 2004 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
Copyright &copy; 2011 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
</div>
</div>
<script type="text/javascript">
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_canvasSupport", "access": "", "host": "CanvasLoader", "type": "method", "name": "canvasSupport"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fading", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fading"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFading"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#property_running", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "running"}, {"url": "CanvasLoader.html#method_setAttr", "access": "", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFading"}, {"url": "CanvasLine truncated
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#method_setAttr", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFPS"}, {"url": "CanvasLoader.html#method_setRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "setRange"}, {"url": "CanvasLoader.html#method_setShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "setShape"}, {"url": "CanvasLoader.html#method_setSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "setSpeed"}, {"url": "CanvasLoader.html#property_shape", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "shape"}, {"url": "CanvasLoadLine truncated
</script>
</body>
</html>
Executable → Regular
View File
File mode changed.
+162 -174
View File
@@ -15,9 +15,9 @@
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://heartcode.robertpataki.com/demos/canvasloader" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a></h1>
<h1><a href="http://heartcode.robertpataki.com/canvasloader/" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a></h1>
<h3>CanvasLoader&nbsp; <span class="subtitle">0.8.0</span></h3>
<a href="./index.html" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a>
<a href="./index.html" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a>
&gt; <a href="./module_canvasloader.html" title="CanvasLoader">CanvasLoader</a>
&gt; heartcode-canvasloader.js (source view)
@@ -82,22 +82,28 @@
<span class="cm">* @module CanvasLoader</span>
<span class="cm">**/</span>
<span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nb">window</span><span class="p">)</span> <span class="p">{</span>
<span class="s2">&quot;use strict&quot;</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * CanvasLoader is a JavaScript UI library that draws and animates circular preloaders using the Canvas HTML object.&lt;br/&gt;</span>
<span class="cm"> * A CanvasLoader instance creates two canvas elements which are placed into a placeholder div (the id of the div has to be passed in the constructor). The second canvas is invisible and used for caching purposes only.&lt;br/&gt;</span>
<span class="cm"> * If no id is passed in the constructor, the canvas objects are paced in the document directly.</span>
<span class="cm"> * @class CanvasLoader</span>
<span class="cm"> * @constructor</span>
<span class="cm"> * @param {String} id The id of the placeholder div.</span>
<span class="cm"> * @param {String} id The id of the placeholder div</span>
<span class="cm"> **/</span>
<span class="s2">&quot;use strict&quot;</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">CanvasLoader</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">id</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">initialize</span><span class="p">(</span><span class="nx">id</span><span class="p">);</span>
<span class="p">},</span> <span class="nx">p</span> <span class="o">=</span> <span class="nx">CanvasLoader</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="nx">engine</span><span class="p">,</span> <span class="nx">engines</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;canvas&quot;</span><span class="p">,</span> <span class="s2">&quot;vml&quot;</span><span class="p">],</span> <span class="nx">shapes</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;oval&quot;</span><span class="p">,</span> <span class="s2">&quot;spiral&quot;</span><span class="p">,</span> <span class="s2">&quot;square&quot;</span><span class="p">,</span> <span class="s2">&quot;rect&quot;</span><span class="p">,</span> <span class="s2">&quot;roundRect&quot;</span><span class="p">],</span> <span class="nx">colorReg</span> <span class="o">=</span> <span class="sr">/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/</span><span class="p">,</span>
<span class="p">},</span> <span class="nx">p</span> <span class="o">=</span> <span class="nx">CanvasLoader</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="nx">engine</span><span class="p">,</span> <span class="nx">engines</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;canvas&quot;</span><span class="p">,</span> <span class="s2">&quot;vml&quot;</span><span class="p">],</span> <span class="nx">shapes</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;oval&quot;</span><span class="p">,</span> <span class="s2">&quot;spiral&quot;</span><span class="p">,</span> <span class="s2">&quot;square&quot;</span><span class="p">,</span> <span class="s2">&quot;rect&quot;</span><span class="p">,</span> <span class="s2">&quot;roundRect&quot;</span><span class="p">],</span> <span class="nx">colorReg</span> <span class="o">=</span> <span class="sr">/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/</span><span class="p">,</span> <span class="nx">ie8</span> <span class="o">=</span> <span class="nx">navigator</span><span class="p">.</span><span class="nx">appVersion</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;MSIE&quot;</span><span class="p">)</span> <span class="o">!==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">&amp;&amp;</span> <span class="nb">parseFloat</span><span class="p">(</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">appVersion</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;MSIE&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span> <span class="o">===</span> <span class="mi">8</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span><span class="p">,</span> <span class="nx">canvasSupport</span> <span class="o">=</span> <span class="o">!!</span><span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;canvas&#39;</span><span class="p">).</span><span class="nx">getContext</span><span class="p">,</span>
<span class="cm">/**</span>
<span class="cm"> * Creates a new element with the tag and applies the passed properties on it.</span>
<span class="cm"> * Creates a new element with the tag and applies the passed properties on it</span>
<span class="cm"> * @method addEl</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param tag {String} The tag to be created</span>
<span class="cm"> * @param par {String} The DOM element the new element will be appended to</span>
<span class="cm"> * @param props {Object} Additional properties passed to the new DOM element</span>
<span class="cm"> * @return {Object} The DOM element</span>
<span class="cm"> */</span>
<span class="nx">addEl</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">tag</span><span class="p">,</span> <span class="nx">props</span><span class="p">,</span> <span class="nx">par</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">addEl</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">tag</span><span class="p">,</span> <span class="nx">par</span><span class="p">,</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="nx">tag</span><span class="p">),</span> <span class="nx">n</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">n</span> <span class="k">in</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span> <span class="nx">el</span><span class="p">[</span><span class="nx">n</span><span class="p">]</span> <span class="o">=</span> <span class="nx">props</span><span class="p">[</span><span class="nx">n</span><span class="p">];</span> <span class="p">}</span>
<span class="k">if</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="nx">par</span><span class="p">)</span> <span class="o">!==</span> <span class="s2">&quot;undefined&quot;</span><span class="p">)</span> <span class="p">{</span>
@@ -107,36 +113,55 @@
<span class="p">},</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the css properties on the element</span>
<span class="cm"> * @method setCSS</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param el {Object} The DOM element to be styled</span>
<span class="cm"> * @param props {Object} The style properties</span>
<span class="cm"> * @return {Object} The DOM element</span>
<span class="cm"> */</span>
<span class="nx">setCSS</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">el</span><span class="p">,</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">n</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">n</span> <span class="k">in</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span> <span class="nx">el</span><span class="p">.</span><span class="nx">style</span><span class="p">[</span><span class="nx">n</span><span class="p">]</span> <span class="o">=</span> <span class="nx">props</span><span class="p">[</span><span class="nx">n</span><span class="p">];</span> <span class="p">}</span>
<span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">n</span> <span class="k">in</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span> <span class="nx">el</span><span class="p">.</span><span class="nx">style</span><span class="p">[</span><span class="nx">n</span><span class="p">]</span> <span class="o">=</span> <span class="nx">props</span><span class="p">[</span><span class="nx">n</span><span class="p">];</span> <span class="p">}</span>
<span class="k">return</span> <span class="nx">el</span><span class="p">;</span>
<span class="p">},</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the attributes on the element</span>
<span class="cm"> * @method setAttr</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param el {Object} The DOM element to add the attributes to</span>
<span class="cm"> * @param props {Object} The attributes</span>
<span class="cm"> * @return {Object} The DOM element</span>
<span class="cm"> */</span>
<span class="nx">setAttr</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">el</span><span class="p">,</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">n</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">n</span> <span class="k">in</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span> <span class="nx">el</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">props</span><span class="p">[</span><span class="nx">n</span><span class="p">]);</span> <span class="p">}</span>
<span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">n</span> <span class="k">in</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span> <span class="nx">el</span><span class="p">.</span><span class="nx">setAttribute</span><span class="p">(</span><span class="nx">n</span><span class="p">,</span> <span class="nx">props</span><span class="p">[</span><span class="nx">n</span><span class="p">]);</span> <span class="p">}</span>
<span class="k">return</span> <span class="nx">el</span><span class="p">;</span>
<span class="p">},</span>
<span class="cm">/**</span>
<span class="cm"> * Checks if the browser supports Canvas</span>
<span class="cm"> * Prepares the cache canvas for drawing</span>
<span class="cm"> * @method transformContext</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param x {Object} The canvas context to be transformed</span>
<span class="cm"> * @param x {Number} x translation</span>
<span class="cm"> * @param y {Number} y translation</span>
<span class="cm"> * @param r {Number} Rotation radians</span>
<span class="cm"> */</span>
<span class="nx">canvasSupport</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="o">!!</span><span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;canvas&#39;</span><span class="p">).</span><span class="nx">getContext</span><span class="p">;</span>
<span class="nx">transformContext</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">c</span><span class="p">,</span> <span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">r</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">c</span><span class="p">.</span><span class="nx">save</span><span class="p">();</span>
<span class="nx">c</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">);</span>
<span class="nx">c</span><span class="p">.</span><span class="nx">rotate</span><span class="p">(</span><span class="nx">r</span><span class="p">);</span>
<span class="nx">c</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="o">-</span><span class="nx">x</span><span class="p">,</span> <span class="o">-</span><span class="nx">y</span><span class="p">);</span>
<span class="nx">c</span><span class="p">.</span><span class="nx">beginPath</span><span class="p">();</span>
<span class="p">};</span>
<span class="cm">/** </span>
<span class="cm"> * Initialization method.</span>
<span class="cm"> * Initialization method</span>
<span class="cm"> * @method initialize</span>
<span class="cm"> * @param id String The id of the placeholder div.</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param parentId (String) The id of the placeholder div, where the loader will be nested into</span>
<span class="cm"> * @param loaderId (String) The id of loader</span>
<span class="cm"> */</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">initialize</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">parentId</span><span class="p">,</span> <span class="nx">loaderId</span><span class="p">)</span> <span class="p">{</span>
<span class="cm">/*</span>
<span class="cm"> * Find the containing div by id (passed by the user).</span>
<span class="cm"> * If the container element cannot be found we use the document body itself.</span>
<span class="cm"> * Find the containing div by id</span>
<span class="cm"> * If the container element cannot be found we use the document body itself</span>
<span class="cm"> */</span>
<span class="k">try</span> <span class="p">{</span>
<span class="c1">// Look for the parent element</span>
@@ -150,15 +175,15 @@
<span class="p">}</span>
<span class="c1">// Creates the parent div of the loader instance</span>
<span class="nx">loaderId</span> <span class="o">=</span> <span class="k">typeof</span> <span class="p">(</span><span class="nx">loaderId</span><span class="p">)</span> <span class="o">!==</span> <span class="s2">&quot;undefined&quot;</span> <span class="o">?</span> <span class="nx">loaderId</span> <span class="o">:</span> <span class="s2">&quot;canvasLoader&quot;</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cont</span> <span class="o">=</span> <span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">,</span> <span class="p">{</span><span class="nx">id</span><span class="o">:</span> <span class="nx">loaderId</span><span class="p">},</span> <span class="k">this</span><span class="p">.</span><span class="nx">mother</span><span class="p">),</span> <span class="p">{</span><span class="nx">border</span><span class="o">:</span> <span class="s2">&quot;1px solid #ff0000&quot;</span><span class="p">,</span> <span class="nx">position</span><span class="o">:</span> <span class="s2">&quot;absolute&quot;</span><span class="p">});</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">canvasSupport</span><span class="p">())</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cont</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">mother</span><span class="p">,</span> <span class="p">{</span><span class="nx">id</span><span class="o">:</span> <span class="nx">loaderId</span><span class="p">});</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">canvasSupport</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// For browsers with Canvas support...</span>
<span class="nx">engine</span> <span class="o">=</span> <span class="nx">engines</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
<span class="c1">// Create the canvas element</span>
<span class="k">this</span><span class="p">.</span><span class="nx">canvas</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;canvas&quot;</span><span class="p">,</span> <span class="p">{},</span> <span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">canvas</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;canvas&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">canvas</span><span class="p">.</span><span class="nx">getContext</span><span class="p">(</span><span class="s2">&quot;2d&quot;</span><span class="p">);</span>
<span class="c1">// Create the cache canvas element</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span> <span class="o">=</span> <span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;canvas&quot;</span><span class="p">,</span> <span class="p">{},</span> <span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">),</span> <span class="p">{</span> <span class="nx">display</span><span class="o">:</span> <span class="s2">&quot;none&quot;</span> <span class="p">});</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span> <span class="o">=</span> <span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;canvas&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">),</span> <span class="p">{</span> <span class="nx">display</span><span class="o">:</span> <span class="s2">&quot;none&quot;</span> <span class="p">});</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">getContext</span><span class="p">(</span><span class="s2">&quot;2d&quot;</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="c1">// For browsers without Canvas support...</span>
@@ -170,153 +195,147 @@
<span class="kd">var</span> <span class="nx">a</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;group&quot;</span><span class="p">,</span> <span class="s2">&quot;oval&quot;</span><span class="p">,</span> <span class="s2">&quot;roundrect&quot;</span><span class="p">,</span> <span class="s2">&quot;fill&quot;</span><span class="p">],</span> <span class="nx">n</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">n</span> <span class="k">in</span> <span class="nx">a</span><span class="p">)</span> <span class="p">{</span> <span class="nx">CanvasLoader</span><span class="p">.</span><span class="nx">vmlSheet</span><span class="p">.</span><span class="nx">addRule</span><span class="p">(</span><span class="nx">a</span><span class="p">[</span><span class="nx">n</span><span class="p">],</span> <span class="s2">&quot;behavior:url(#default#VML); position:absolute;&quot;</span><span class="p">);</span> <span class="p">}</span>
<span class="p">}</span>
<span class="k">this</span><span class="p">.</span><span class="nx">vml</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;group&quot;</span><span class="p">,</span> <span class="p">{},</span> <span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">vml</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;group&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">);</span>
<span class="p">}</span>
<span class="c1">// Set the RGB color object</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setColor</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">color</span><span class="p">);</span>
<span class="c1">// Set the instance ready</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">ready</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
<span class="c1">// Draw the shapes on the canvas</span>
<span class="c1">// Sets the instance to be ready</span>
<span class="k">this</span><span class="p">.</span><span class="nx">ready</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
<span class="c1">// Draws the shapes on the canvas</span>
<span class="k">this</span><span class="p">.</span><span class="nx">draw</span><span class="p">();</span>
<span class="c1">// Start rendering the preloader</span>
<span class="c1">// Starts rendering the preloader</span>
<span class="k">this</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
<span class="p">};</span>
<span class="c1">/////////////////////////////////////////////////////////////////////////////////////////////</span>
<span class="c1">// Property declarations</span>
<span class="cm">/**</span>
<span class="cm"> * The div we place the canvas object into.</span>
<span class="cm"> * The div we place the canvas object into</span>
<span class="cm"> * @property container</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Object</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">container</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * The div we draw the shapes into.</span>
<span class="cm"> * The div we draw the shapes into</span>
<span class="cm"> * @property canvas</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Object</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">canvas</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * The canvas context.</span>
<span class="cm"> * The canvas context</span>
<span class="cm"> * @property context</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Object</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">context</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * The canvas we use for caching.</span>
<span class="cm"> * The canvas we use for caching</span>
<span class="cm"> * @property cacheCanvas</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Object</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">cacheCanvas</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * The context of the cache canvas.</span>
<span class="cm"> * The context of the cache canvas</span>
<span class="cm"> * @property cacheContext</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Object</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">cacheContext</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * Tell if the loader rendering is running.</span>
<span class="cm"> * @property running</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @protected</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">running</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Tell if the canvas and its context is ready.</span>
<span class="cm"> * Tells if the canvas and its context is ready</span>
<span class="cm"> * @property ready</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">ready</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Add a timer for the rendering.</span>
<span class="cm"> * Adds a timer for the rendering</span>
<span class="cm"> * @property timer</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">timer</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * The active shape id for rendering.</span>
<span class="cm"> * The active shape id for rendering</span>
<span class="cm"> * @property activeId</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Number</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">activeId</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * The diameter of the loader.</span>
<span class="cm"> * The diameter of the loader</span>
<span class="cm"> * @property diameter</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 40</span>
<span class="cm"> * @protected</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">=</span> <span class="mi">40</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the diameter of the loader.</span>
<span class="cm"> * Sets the diameter of the loader</span>
<span class="cm"> * @method setDiameter</span>
<span class="cm"> * @param diameter {Number} The default value is 40.</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param diameter {Number} The default value is 40</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setDiameter</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">diameter</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">diameter</span><span class="p">));</span> <span class="k">this</span><span class="p">.</span><span class="nx">redraw</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the diameter of the loader.</span>
<span class="cm"> * @method getDiameter</span>
<span class="cm"> * @return Number</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getDiameter</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * The color of the loader shapes in RGB.</span>
<span class="cm"> * The color of the loader shapes in RGB</span>
<span class="cm"> * @property colorRGB</span>
<span class="cm"> * @type Object</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Object</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">colorRGB</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * The color of the loader shapes in HEX.</span>
<span class="cm"> * The color of the loader shapes in HEX</span>
<span class="cm"> * @property color</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @default &quot;#000000&quot;</span>
<span class="cm"> * @protected</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">color</span> <span class="o">=</span> <span class="s2">&quot;#000000&quot;</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Sets hexadecimal color of the loader.</span>
<span class="cm"> * Sets hexadecimal color of the loader</span>
<span class="cm"> * @method setColor</span>
<span class="cm"> * @param color {String} The default value is &#39;#000000&#39;.</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param color {String} The default value is &#39;#000000&#39;</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setColor</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">color</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">color</span> <span class="o">=</span> <span class="nx">colorReg</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">color</span><span class="p">)</span> <span class="o">?</span> <span class="nx">color</span> <span class="o">:</span> <span class="s2">&quot;#000000&quot;</span><span class="p">;</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">getRGB</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">color</span><span class="p">);</span> <span class="k">this</span><span class="p">.</span><span class="nx">redraw</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the loader color in a hexadecimal form.</span>
<span class="cm"> * Returns the loader color in a hexadecimal form</span>
<span class="cm"> * @method getColor</span>
<span class="cm"> * @return String</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {String}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getColor</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">color</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * The type of the loader shapes.</span>
<span class="cm"> * The type of the loader shapes</span>
<span class="cm"> * @property shape</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type String</span>
<span class="cm"> * @default &quot;oval&quot;</span>
<span class="cm"> * @protected</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">shape</span> <span class="o">=</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the type of the loader shapes.&lt;br/&gt;</span>
<span class="cm"> * &lt;br/&gt;&lt;b&gt;The acceptable values are:&lt;/b&gt;</span>
<span class="cm"> * &lt;ul&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;circle&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;oval&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;spiral&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;square&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;rectangle&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;roundedRectangle&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;rect&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;li&gt;&#39;roundRect&#39;&lt;/li&gt;</span>
<span class="cm"> * &lt;/ul&gt;</span>
<span class="cm"> * @method setShape</span>
<span class="cm"> * @param shape {String} The default value is &#39;circle&#39;.</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param shape {String} The default value is &#39;oval&#39;</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setShape</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">shape</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">n</span><span class="p">;</span>
@@ -325,39 +344,39 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the type of the loader shapes.</span>
<span class="cm"> * Returns the type of the loader shapes</span>
<span class="cm"> * @method getShape</span>
<span class="cm"> * @return String</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {String}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getShape</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">shape</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * The number of shapes drawn on the loader canvas.</span>
<span class="cm"> * The number of shapes drawn on the loader canvas</span>
<span class="cm"> * @property density</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @default 40</span>
<span class="cm"> * @protected</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">density</span> <span class="o">=</span> <span class="mi">40</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the number of shapes drawn on the loader canvas.</span>
<span class="cm"> * Sets the number of shapes drawn on the loader canvas</span>
<span class="cm"> * @method setDensity</span>
<span class="cm"> * @param density {Number} The default value is 40.</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param density {Number} The default value is 40</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setDensity</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">density</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">density</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">density</span><span class="p">));</span> <span class="k">this</span><span class="p">.</span><span class="nx">redraw</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the number of shapes drawn on the loader canvas.</span>
<span class="cm"> * Returns the number of shapes drawn on the loader canvas</span>
<span class="cm"> * @method getDensity</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getDensity</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">density</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the amount of the modified shapes in percent.</span>
<span class="cm"> * The amount of the modified shapes in percent.</span>
<span class="cm"> * @property range</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Number</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">range</span> <span class="o">=</span> <span class="mf">1.3</span><span class="p">;</span>
<span class="cm">/**</span>
@@ -366,43 +385,22 @@
<span class="cm"> * This minimum amount is 0.1 which means every shape which is out of the range is scaled and/or faded to 10% of the original values.&lt;br/&gt;</span>
<span class="cm"> * The visually acceptable range value should be between 0.4 and 1.5.</span>
<span class="cm"> * @method setRange</span>
<span class="cm"> * @param range {Number} The default value is 1.3.</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param range {Number} The default value is 1.3</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setRange</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">range</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">range</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">range</span><span class="p">);</span> <span class="k">this</span><span class="p">.</span><span class="nx">redraw</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the modified shape range in percent.</span>
<span class="cm"> * Returns the modified shape range in percent</span>
<span class="cm"> * @method getRange</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getRange</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">range</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * The fading of the loader shapes.</span>
<span class="cm"> * @property fading</span>
<span class="cm"> * @type Boolean</span>
<span class="cm"> * @protected</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">fading</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
<span class="cm">/**</span>
<span class="cm"> * Sets the fading of the loader shapes.</span>
<span class="cm"> * @method setFading</span>
<span class="cm"> * @param fading {Boolean} The default value is true.</span>
<span class="cm"> * @public</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setFading</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">fading</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">fading</span> <span class="o">=</span> <span class="nx">fading</span><span class="p">;</span> <span class="k">this</span><span class="p">.</span><span class="nx">redraw</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the fading of the loader shapes.</span>
<span class="cm"> * @method getFading</span>
<span class="cm"> * @return {Boolean}</span>
<span class="cm"> * @public</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getFading</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">fading</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * The speed of the loader animation.</span>
<span class="cm"> * The speed of the loader animation</span>
<span class="cm"> * @property speed</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Number</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">speed</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span>
<span class="cm">/**</span>
@@ -410,23 +408,22 @@
<span class="cm"> * This value tells the loader how many shapes to skip by each tick.&lt;br/&gt;</span>
<span class="cm"> * Using the right combination of the &lt;code&gt;setFPS&lt;/code&gt; and the &lt;code&gt;setSpeed&lt;/code&gt; methods allows the users to optimize the CPU usage of the loader whilst keeping the animation on a visually pleasing level.</span>
<span class="cm"> * @method setSpeed</span>
<span class="cm"> * @param speed {Number} The default value is 2.</span>
<span class="cm"> * @seealso setFPS</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param speed {Number} The default value is 2</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setSpeed</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">speed</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">speed</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">speed</span><span class="p">));</span> <span class="k">this</span><span class="p">.</span><span class="nx">reset</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the speed of the loader animation.</span>
<span class="cm"> * Returns the speed of the loader animation</span>
<span class="cm"> * @method getSpeed</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getSpeed</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">speed</span><span class="p">;</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * The FPS of the loader animation rendering.</span>
<span class="cm"> * The FPS value of the loader animation rendering</span>
<span class="cm"> * @property fps</span>
<span class="cm"> * @type Number</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @type Number</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">fps</span> <span class="o">=</span> <span class="mi">24</span><span class="p">;</span>
<span class="cm">/**</span>
@@ -434,25 +431,24 @@
<span class="cm"> * This value tells the loader how many times to refresh and modify the canvas in 1 second.&lt;br/&gt;</span>
<span class="cm"> * Using the right combination of the &lt;code&gt;setSpeed&lt;/code&gt; and the &lt;code&gt;setFPS&lt;/code&gt; methods allows the users to optimize the CPU usage of the loader whilst keeping the animation on a visually pleasing level.</span>
<span class="cm"> * @method setFPS</span>
<span class="cm"> * @param fps {Number} The default value is 24.</span>
<span class="cm"> * @seealso setSpeed</span>
<span class="cm"> * @public</span>
<span class="cm"> * @param fps {Number} The default value is 24</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">setFPS</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">fps</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">fps</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">fps</span><span class="p">));</span> <span class="k">this</span><span class="p">.</span><span class="nx">reset</span><span class="p">();</span> <span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Returns the fps of the loader.</span>
<span class="cm"> * Returns the fps of the loader</span>
<span class="cm"> * @method getFPS</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> * @public</span>
<span class="cm"> * @return {Number}</span>
<span class="cm"> **/</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getFPS</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">fps</span><span class="p">;</span> <span class="p">};</span>
<span class="c1">// End of Property declarations</span>
<span class="c1">///////////////////////////////////////////////////////////////////////////////////////////// </span>
<span class="cm">/**</span>
<span class="cm"> * Return the RGB values of the passed color.</span>
<span class="cm"> * Return the RGB values of the passed color</span>
<span class="cm"> * @method getRGB</span>
<span class="cm"> * @param color (String) The HEX color value to be converted to RGB</span>
<span class="cm"> * @protected</span>
<span class="cm"> * @param color {String} The HEX color value to be converted to RGB</span>
<span class="cm"> */</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">getRGB</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">color</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">color</span> <span class="o">=</span> <span class="nx">color</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">===</span> <span class="s2">&quot;#&quot;</span> <span class="o">?</span> <span class="nx">color</span><span class="p">.</span><span class="nx">substring</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span> <span class="o">:</span> <span class="nx">color</span><span class="p">;</span>
@@ -466,7 +462,6 @@
<span class="nx">p</span><span class="p">.</span><span class="nx">draw</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">size</span><span class="p">,</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">angle</span><span class="p">,</span> <span class="nx">radians</span><span class="p">,</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">animBits</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">round</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">density</span> <span class="o">*</span> <span class="k">this</span><span class="p">.</span><span class="nx">range</span><span class="p">),</span> <span class="nx">bitMod</span><span class="p">,</span> <span class="nx">minBitMod</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">s</span><span class="p">,</span> <span class="nx">g</span><span class="p">,</span> <span class="nx">sh</span><span class="p">,</span> <span class="nx">f</span><span class="p">,</span> <span class="nx">d</span> <span class="o">=</span> <span class="mi">1000</span><span class="p">,</span> <span class="nx">arc</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">engine</span> <span class="o">===</span> <span class="nx">engines</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span>
<span class="c1">// Clean the cache canvas</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">clearRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">width</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span><span class="p">);</span>
<span class="nx">setAttr</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">canvas</span><span class="p">,</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">});</span>
<span class="nx">setAttr</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">,</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">});</span>
@@ -474,8 +469,7 @@
<span class="nx">bitMod</span> <span class="o">=</span> <span class="nx">i</span> <span class="o">&lt;=</span> <span class="nx">animBits</span> <span class="o">?</span> <span class="mi">1</span> <span class="o">-</span> <span class="p">((</span><span class="mi">1</span> <span class="o">-</span> <span class="nx">minBitMod</span><span class="p">)</span> <span class="o">/</span> <span class="nx">animBits</span> <span class="o">*</span> <span class="nx">i</span><span class="p">)</span> <span class="o">:</span> <span class="nx">bitMod</span> <span class="o">=</span> <span class="nx">minBitMod</span><span class="p">;</span>
<span class="nx">angle</span> <span class="o">=</span> <span class="mi">360</span> <span class="o">-</span> <span class="mi">360</span> <span class="o">/</span> <span class="k">this</span><span class="p">.</span><span class="nx">density</span> <span class="o">*</span> <span class="nx">i</span><span class="p">;</span>
<span class="nx">radians</span> <span class="o">=</span> <span class="nx">angle</span> <span class="o">/</span> <span class="mi">180</span> <span class="o">*</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">PI</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">save</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">fading</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">fillStyle</span> <span class="o">=</span> <span class="s2">&quot;rgba(&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">r</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">g</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">b</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="nx">bitMod</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;)&quot;</span><span class="p">;</span> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">fillStyle</span> <span class="o">=</span> <span class="s2">&quot;rgba(&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">r</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">g</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">b</span> <span class="o">+</span> <span class="s2">&quot;,1)&quot;</span><span class="p">;</span> <span class="p">}</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">fillStyle</span> <span class="o">=</span> <span class="s2">&quot;rgba(&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">r</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">g</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">colorRGB</span><span class="p">.</span><span class="nx">b</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="nx">bitMod</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;)&quot;</span><span class="p">;</span>
<span class="k">switch</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">shape</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">:</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">:</span>
@@ -489,42 +483,30 @@
<span class="nx">size</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.12</span><span class="p">;</span>
<span class="nx">x</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">cos</span><span class="p">(</span><span class="nx">radians</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">width</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">size</span><span class="p">)</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">width</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">sin</span><span class="p">(</span><span class="nx">radians</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">width</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">size</span><span class="p">)</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">rotate</span><span class="p">(</span><span class="nx">radians</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="o">-</span><span class="nx">x</span><span class="p">,</span> <span class="o">-</span><span class="nx">y</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">beginPath</span><span class="p">();</span>
<span class="nx">transformContext</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">,</span> <span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">radians</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">fillRect</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">size</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">size</span><span class="p">,</span> <span class="nx">size</span><span class="p">);</span>
<span class="k">break</span><span class="p">;</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">:</span>
<span class="nx">w</span> <span class="o">=</span> <span class="nx">size</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.3</span><span class="p">;</span>
<span class="nx">h</span> <span class="o">=</span> <span class="nx">w</span> <span class="o">*</span> <span class="mf">0.27</span><span class="p">;</span>
<span class="nx">x</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">cos</span><span class="p">(</span><span class="nx">radians</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nx">h</span> <span class="o">+</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">-</span> <span class="nx">h</span><span class="p">)</span> <span class="o">*</span> <span class="mf">0.13</span><span class="p">)</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">width</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">sin</span><span class="p">(</span><span class="nx">radians</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nx">h</span> <span class="o">+</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">-</span> <span class="nx">h</span><span class="p">)</span> <span class="o">*</span> <span class="mf">0.13</span><span class="p">)</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">rotate</span><span class="p">(</span><span class="nx">radians</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="o">-</span><span class="nx">x</span><span class="p">,</span> <span class="o">-</span><span class="nx">y</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">beginPath</span><span class="p">();</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">fillRect</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">h</span><span class="p">);</span>
<span class="k">break</span><span class="p">;</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">:</span>
<span class="nx">w</span> <span class="o">=</span> <span class="nx">size</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.3</span><span class="p">;</span>
<span class="nx">w</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.3</span><span class="p">;</span>
<span class="nx">h</span> <span class="o">=</span> <span class="nx">w</span> <span class="o">*</span> <span class="mf">0.27</span><span class="p">;</span>
<span class="nx">radius</span> <span class="o">=</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.56</span><span class="p">;</span>
<span class="nx">x</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">cos</span><span class="p">(</span><span class="nx">radians</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nx">h</span> <span class="o">+</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">-</span> <span class="nx">h</span><span class="p">)</span> <span class="o">*</span> <span class="mf">0.13</span><span class="p">)</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">width</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">sin</span><span class="p">(</span><span class="nx">radians</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nx">h</span> <span class="o">+</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">-</span> <span class="nx">h</span><span class="p">)</span> <span class="o">*</span> <span class="mf">0.13</span><span class="p">)</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">.</span><span class="nx">height</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">rotate</span><span class="p">(</span><span class="nx">radians</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="o">-</span><span class="nx">x</span><span class="p">,</span> <span class="o">-</span><span class="nx">y</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">beginPath</span><span class="p">();</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">moveTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">x</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="nx">transformContext</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">,</span> <span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">radians</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">shape</span> <span class="o">===</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">fillRect</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">h</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">radius</span> <span class="o">=</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.7</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">moveTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">x</span> <span class="o">+</span> <span class="nx">w</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">h</span> <span class="o">-</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">lineTo</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">quadraticCurveTo</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nx">x</span> <span class="o">+</span> <span class="nx">radius</span><span class="p">,</span> <span class="nx">y</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">this</span><span class="p">.</span><span class="nx">cacheContext</span><span class="p">.</span><span class="nx">closePath</span><span class="p">();</span>
@@ -534,7 +516,7 @@
<span class="p">}</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">setCSS</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cont</span><span class="p">,</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">});</span>
<span class="nx">setCSS</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">,</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">});</span>
<span class="nx">setCSS</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">,</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="nx">border</span><span class="o">:</span> <span class="s2">&quot;1px solid #ff0000&quot;</span><span class="p">});</span>
<span class="k">switch</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">shape</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">:</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">:</span>
@@ -563,29 +545,39 @@
<span class="nx">x</span> <span class="o">=</span> <span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">size</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">size</span> <span class="o">*</span> <span class="nx">bitMod</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="p">(</span><span class="nx">size</span> <span class="o">-</span> <span class="nx">size</span> <span class="o">*</span> <span class="nx">bitMod</span><span class="p">)</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="k">break</span><span class="p">;</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">:</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">:</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">ie8</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">y</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">shape</span> <span class="o">===</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span> <span class="p">{</span>
<span class="nx">x</span> <span class="o">=</span> <span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span><span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">break</span><span class="p">;</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">:</span>
<span class="k">case</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">:</span>
<span class="nx">w</span> <span class="o">=</span> <span class="nx">size</span> <span class="o">*</span> <span class="mf">0.95</span><span class="p">;</span>
<span class="nx">h</span> <span class="o">=</span> <span class="nx">w</span> <span class="o">*</span> <span class="mf">0.28</span><span class="p">;</span>
<span class="nx">x</span> <span class="o">=</span> <span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">w</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="o">-</span><span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">ie8</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">x</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">x</span> <span class="o">=</span> <span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nx">w</span><span class="p">;</span>
<span class="nx">y</span> <span class="o">=</span> <span class="o">-</span><span class="nx">h</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">;</span>
<span class="p">}</span>
<span class="nx">arc</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">shape</span> <span class="o">===</span> <span class="nx">shapes</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">?</span> <span class="mf">0.6</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="c1">// Adds the group (shape needed to be grouped for accurate rotation)</span>
<span class="nx">g</span> <span class="o">=</span> <span class="nx">setAttr</span><span class="p">(</span><span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;group&quot;</span><span class="p">,</span> <span class="p">{},</span> <span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">),</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">rotation</span><span class="o">:</span> <span class="nx">angle</span><span class="p">}),</span> <span class="p">{</span><span class="nx">coordsize</span><span class="o">:</span> <span class="nx">d</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">coordorigin</span><span class="o">:</span> <span class="o">-</span><span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="p">(</span><span class="o">-</span><span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">)});</span>
<span class="c1">// Adds the shape</span>
<span class="nx">s</span> <span class="o">=</span> <span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="nx">sh</span><span class="p">,</span> <span class="p">{</span><span class="nx">stroked</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> <span class="nx">arcSize</span><span class="o">:</span> <span class="nx">arc</span><span class="p">},</span> <span class="nx">g</span><span class="p">),</span> <span class="p">{</span> <span class="nx">width</span><span class="o">:</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">top</span><span class="o">:</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">left</span><span class="o">:</span> <span class="nx">x</span><span class="p">});</span>
<span class="c1">// Adds the fill</span>
<span class="nx">f</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;fill&quot;</span><span class="p">,</span> <span class="p">{</span><span class="nx">color</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">color</span><span class="p">,</span> <span class="nx">opacity</span><span class="o">:</span> <span class="nx">bitMod</span><span class="p">},</span> <span class="nx">s</span><span class="p">);</span>
<span class="nx">g</span> <span class="o">=</span> <span class="nx">setAttr</span><span class="p">(</span><span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;group&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">),</span> <span class="p">{</span><span class="nx">width</span><span class="o">:</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">rotation</span><span class="o">:</span> <span class="nx">angle</span><span class="p">}),</span> <span class="p">{</span><span class="nx">coordsize</span><span class="o">:</span> <span class="nx">d</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="nx">d</span><span class="p">,</span> <span class="nx">coordorigin</span><span class="o">:</span> <span class="o">-</span><span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span> <span class="o">+</span> <span class="s2">&quot;,&quot;</span> <span class="o">+</span> <span class="p">(</span><span class="o">-</span><span class="nx">d</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">)});</span>
<span class="nx">s</span> <span class="o">=</span> <span class="nx">setCSS</span><span class="p">(</span><span class="nx">addEl</span><span class="p">(</span><span class="nx">sh</span><span class="p">,</span> <span class="nx">g</span><span class="p">,</span> <span class="p">{</span><span class="nx">stroked</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> <span class="nx">arcSize</span><span class="o">:</span> <span class="nx">arc</span><span class="p">}),</span> <span class="p">{</span> <span class="nx">width</span><span class="o">:</span> <span class="nx">w</span><span class="p">,</span> <span class="nx">height</span><span class="o">:</span> <span class="nx">h</span><span class="p">,</span> <span class="nx">top</span><span class="o">:</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">left</span><span class="o">:</span> <span class="nx">x</span><span class="p">});</span>
<span class="nx">f</span> <span class="o">=</span> <span class="nx">addEl</span><span class="p">(</span><span class="s2">&quot;fill&quot;</span><span class="p">,</span> <span class="nx">s</span><span class="p">,</span> <span class="p">{</span><span class="nx">color</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">color</span><span class="p">,</span> <span class="nx">opacity</span><span class="o">:</span> <span class="nx">bitMod</span><span class="p">});</span>
<span class="o">++</span><span class="nx">i</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="c1">// Render the changes on the canvas</span>
<span class="k">this</span><span class="p">.</span><span class="nx">tick</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Cleans the canvas.</span>
<span class="cm"> * Cleans the canvas</span>
<span class="cm"> * @method clean</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
@@ -593,7 +585,6 @@
<span class="k">if</span> <span class="p">(</span><span class="nx">engine</span> <span class="o">===</span> <span class="nx">engines</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">clearRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">canvas</span><span class="p">.</span><span class="nx">width</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">canvas</span><span class="p">.</span><span class="nx">height</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="c1">// Cleans the VML element from its children</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">.</span><span class="nx">hasChildNodes</span><span class="p">())</span> <span class="p">{</span>
<span class="k">while</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">.</span><span class="nx">childNodes</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">vml</span><span class="p">.</span><span class="nx">firstChild</span><span class="p">);</span>
@@ -602,7 +593,7 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Redraws the canvas.</span>
<span class="cm"> * Redraws the canvas</span>
<span class="cm"> * @method redraw</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
@@ -613,7 +604,7 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Resets the timer.</span>
<span class="cm"> * Resets the timer</span>
<span class="cm"> * @method reset</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
@@ -624,8 +615,8 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Renders the loader animation.</span>
<span class="cm"> * @event tick</span>
<span class="cm"> * Renders the loader animation</span>
<span class="cm"> * @method tick</span>
<span class="cm"> * @protected</span>
<span class="cm"> */</span>
<span class="nx">p</span><span class="p">.</span><span class="nx">tick</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">initialize</span><span class="p">)</span> <span class="p">{</span>
@@ -635,10 +626,7 @@
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">activeId</span> <span class="o">&gt;=</span> <span class="mi">360</span><span class="p">)</span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeId</span> <span class="o">-=</span> <span class="mi">360</span><span class="p">;</span> <span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">engine</span> <span class="o">===</span> <span class="nx">engines</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">clearRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">save</span><span class="p">();</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">rotate</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">PI</span> <span class="o">/</span> <span class="mi">180</span> <span class="o">*</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeId</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">translate</span><span class="p">(</span><span class="o">-</span><span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="o">-</span><span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">);</span>
<span class="nx">transformContext</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span> <span class="o">*</span> <span class="mf">0.5</span><span class="p">,</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">PI</span> <span class="o">/</span> <span class="mi">180</span> <span class="o">*</span> <span class="k">this</span><span class="p">.</span><span class="nx">activeId</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">drawImage</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">cacheCanvas</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">diameter</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">context</span><span class="p">.</span><span class="nx">restore</span><span class="p">();</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
@@ -646,7 +634,7 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Shows the rendering of the loader animation.</span>
<span class="cm"> * Shows the rendering of the loader animation</span>
<span class="cm"> * @method show</span>
<span class="cm"> * @public</span>
<span class="cm"> */</span>
@@ -658,7 +646,7 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Stop the rendering of the loader animation and hides the loader.</span>
<span class="cm"> * Stops the rendering of the loader animation and hides the loader</span>
<span class="cm"> * @method hide</span>
<span class="cm"> * @public</span>
<span class="cm"> */</span>
@@ -670,7 +658,7 @@
<span class="p">}</span>
<span class="p">};</span>
<span class="cm">/**</span>
<span class="cm"> * Remove the CanvasLoader instance and all references.</span>
<span class="cm"> * Removes the CanvasLoader instance and all its references</span>
<span class="cm"> * @method kill</span>
<span class="cm"> * @public</span>
<span class="cm"> */</span>
@@ -725,12 +713,12 @@
</div>
<div id="ft">
<hr />
Copyright &copy; 2004 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
Copyright &copy; 2011 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
</div>
</div>
<script type="text/javascript">
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_canvasSupport", "access": "", "host": "CanvasLoader", "type": "method", "name": "canvasSupport"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fading", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fading"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFading"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#property_running", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "running"}, {"url": "CanvasLoader.html#method_setAttr", "access": "", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFading"}, {"url": "CanvasLine truncated
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#method_setAttr", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFPS"}, {"url": "CanvasLoader.html#method_setRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "setRange"}, {"url": "CanvasLoader.html#method_setShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "setShape"}, {"url": "CanvasLoader.html#method_setSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "setSpeed"}, {"url": "CanvasLoader.html#property_shape", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "shape"}, {"url": "CanvasLoadLine truncated
</script>
</body>
</html>
Executable → Regular
+5 -5
View File
@@ -15,9 +15,9 @@
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://heartcode.robertpataki.com/demos/canvasloader" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a></h1>
<h1><a href="http://heartcode.robertpataki.com/canvasloader/" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a></h1>
<h3>&nbsp; <span class="subtitle">0.8.0</span></h3>
<a href="./index.html" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a>
<a href="./index.html" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a>
<form onsubmit="return false">
<div id="propertysearch">
Search: <input autocomplete="off" id="searchinput" />
@@ -42,7 +42,7 @@
<div class="summary description">
This is the API documentation for the
<a href="http://heartcode.robertpataki.com/demos/canvasloader">Heartcode CanvasLoader UI Library</a>.
<a href="http://heartcode.robertpataki.com/canvasloader/">Heartcode CanvasLoader YUI Library</a>.
<p>Choose a module name from the list for more information.</p>
</div>
@@ -82,13 +82,13 @@
</div>
<div id="ft">
<hr />
Copyright &copy; 2004 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
Copyright &copy; 2011 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
</div>
</div>
<script type="text/javascript">
YAHOO.yuidoc.init();
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_canvasSupport", "access": "", "host": "CanvasLoader", "type": "method", "name": "canvasSupport"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fading", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fading"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFading"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#property_running", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "running"}, {"url": "CanvasLoader.html#method_setAttr", "access": "", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFading"}, {"url": "CanvasLine truncated
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#method_setAttr", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFPS"}, {"url": "CanvasLoader.html#method_setRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "setRange"}, {"url": "CanvasLoader.html#method_setShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "setShape"}, {"url": "CanvasLoader.html#method_setSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "setSpeed"}, {"url": "CanvasLoader.html#property_shape", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "shape"}, {"url": "CanvasLoadLine truncated
</script>
</body>
</html>
Executable → Regular
+1 -1
View File
@@ -1 +1 @@
[{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_canvasSupport", "access": "", "host": "CanvasLoader", "type": "method", "name": "canvasSupport"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fading", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fading"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFading"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#property_running", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "running"}, {"url": "CanvasLoader.html#method_setAttr", "access": "", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFading"}, {"url": "CanvasLoader.html#method_setFPLine truncated
[{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#method_setAttr", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFPS"}, {"url": "CanvasLoader.html#method_setRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "setRange"}, {"url": "CanvasLoader.html#method_setShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "setShape"}, {"url": "CanvasLoader.html#method_setSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "setSpeed"}, {"url": "CanvasLoader.html#property_shape", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "shape"}, {"url": "CanvasLoader.html#method_show", "aLine truncated
Executable → Regular
+4 -4
View File
@@ -15,9 +15,9 @@
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://heartcode.robertpataki.com/demos/canvasloader" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a></h1>
<h1><a href="http://heartcode.robertpataki.com/canvasloader/" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a></h1>
<h3>CanvasLoader&nbsp; <span class="subtitle">0.8.0</span></h3>
<a href="./index.html" title="Heartcode CanvasLoader UI Library">Heartcode CanvasLoader UI Library</a>
<a href="./index.html" title="Heartcode CanvasLoader YUI Library">Heartcode CanvasLoader YUI Library</a>
&gt; <a href="./module_canvasloader.html" title="CanvasLoader">CanvasLoader</a>
@@ -109,12 +109,12 @@ The implementation is (hopefully) very simple and doesn't require any external l
</div>
<div id="ft">
<hr />
Copyright &copy; 2004 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
Copyright &copy; 2011 Róbert Pataki. The Heartcode CanvasLoader is released under the MIT licence. For more information and other open source stuff please visit the <a href="http://heartcode.robertpataki.com/" target="_blank">Heartcode blog</a>, check out my <a href="http://github.com/heartcode" target="_blank">GitHub profile</a> and follow the <a href="http://twitter.com/#!/@iHeartcode" target="_blank">Heartcode tweets</a>.
</div>
</div>
<script type="text/javascript">
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_canvasSupport", "access": "", "host": "CanvasLoader", "type": "method", "name": "canvasSupport"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fading", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fading"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFading"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#property_running", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "running"}, {"url": "CanvasLoader.html#method_setAttr", "access": "", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFading", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFading"}, {"url": "CanvasLine truncated
var ALL_YUI_PROPS = [{"url": "CanvasLoader.html#property_activeId", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "activeId"}, {"url": "CanvasLoader.html#method_addEl", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "addEl"}, {"url": "CanvasLoader.html#property_cacheCanvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheCanvas"}, {"url": "CanvasLoader.html#property_cacheContext", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "cacheContext"}, {"url": "CanvasLoader.html#property_canvas", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "canvas"}, {"url": "CanvasLoader.html#method_clean", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "clean"}, {"url": "CanvasLoader.html#property_color", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "color"}, {"url": "CanvasLoader.html#property_colorRGB", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "colorRGB"}, {"url": "CanvasLoader.html#property_container", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "container"}, {"url": "CanvasLoader.html#property_context", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "context"}, {"url": "CanvasLoader.html#property_density", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "density"}, {"url": "CanvasLoader.html#property_diameter", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "diameter"}, {"url": "CanvasLoader.html#method_draw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "draw"}, {"url": "CanvasLoader.html#property_fps", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "fps"}, {"url": "CanvasLoader.html#method_getColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "getColor"}, {"url": "CanvasLoader.html#method_getDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDensity"}, {"url": "CanvasLoader.html#method_getDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "getDiameter"}, {"url": "CanvasLoader.html#method_getFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "getFPS"}, {"url": "CanvasLoader.html#method_getRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "getRange"}, {"url": "CanvasLoader.html#method_getRGB", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "getRGB"}, {"url": "CanvasLoader.html#method_getShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "getShape"}, {"url": "CanvasLoader.html#method_getSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "getSpeed"}, {"url": "CanvasLoader.html#method_hide", "access": "", "host": "CanvasLoader", "type": "method", "name": "hide"}, {"url": "CanvasLoader.html#method_initialize", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "initialize"}, {"url": "CanvasLoader.html#method_kill", "access": "", "host": "CanvasLoader", "type": "method", "name": "kill"}, {"url": "CanvasLoader.html#property_range", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "range"}, {"url": "CanvasLoader.html#property_ready", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "ready"}, {"url": "CanvasLoader.html#method_redraw", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "redraw"}, {"url": "CanvasLoader.html#method_reset", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "reset"}, {"url": "CanvasLoader.html#method_setAttr", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setAttr"}, {"url": "CanvasLoader.html#method_setColor", "access": "", "host": "CanvasLoader", "type": "method", "name": "setColor"}, {"url": "CanvasLoader.html#method_setCSS", "access": "protected", "host": "CanvasLoader", "type": "method", "name": "setCSS"}, {"url": "CanvasLoader.html#method_setDensity", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDensity"}, {"url": "CanvasLoader.html#method_setDiameter", "access": "", "host": "CanvasLoader", "type": "method", "name": "setDiameter"}, {"url": "CanvasLoader.html#method_setFPS", "access": "", "host": "CanvasLoader", "type": "method", "name": "setFPS"}, {"url": "CanvasLoader.html#method_setRange", "access": "", "host": "CanvasLoader", "type": "method", "name": "setRange"}, {"url": "CanvasLoader.html#method_setShape", "access": "", "host": "CanvasLoader", "type": "method", "name": "setShape"}, {"url": "CanvasLoader.html#method_setSpeed", "access": "", "host": "CanvasLoader", "type": "method", "name": "setSpeed"}, {"url": "CanvasLoader.html#property_shape", "access": "protected", "host": "CanvasLoader", "type": "property", "name": "shape"}, {"url": "CanvasLoadLine truncated
</script>
</body>
</html>
Executable → Regular
+1 -1
View File
@@ -1 +1 @@
{"majorversion": 2, "classmap": {"CanvasLoader": {"name": "CanvasLoader", "constructors": [{"params": [{"type": "String", "name": "id", "description": " The id of the placeholder div."}], "description": "CanvasLoader is a JavaScript UI library that draws and animates circular preloaders using the Canvas HTML object.<br/>\r\nA CanvasLoader instance creates two canvas elements which are placed into a placeholder div (the id of the div has to be passed in the constructor). The second canvas is invisible and used for caching purposes only.<br/>\r\nIf no id is passed in the constructor, the canvas objects are paced in the document directly."}], "namespace": "", "module": "CanvasLoader", "events": {"tick": {"protected": "", "description": "Renders the loader animation.", "guessedname": "tick", "guessedtype": "function"}}, "methods": {"getRange": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the modified shape range in percent.", "guessedname": "getRange", "guessedtype": "function"}, "show": {"description": "Shows the rendering of the loader animation.", "public": "", "guessedname": "show", "guessedtype": "function"}, "setDensity": {"public": "", "params": [{"type": "Number", "name": "density", "description": " The default value is 40."}], "description": "Sets the number of shapes drawn on the loader canvas.", "guessedname": "setDensity", "guessedtype": "function"}, "getDiameter": {"public": "", "return": {"type": "", "description": "Number"}, "description": "Returns the diameter of the loader.", "guessedname": "getDiameter", "guessedtype": "function"}, "kill": {"description": "Remove the CanvasLoader instance and all references.", "public": "", "guessedname": "kill", "guessedtype": "function"}, "hide": {"description": "Stop the rendering of the loader animation and hides the loader.", "public": "", "guessedname": "hide", "guessedtype": "function"}, "addEl": {"description": "Creates a new element with the tag and applies the passed properties on it.", "guessedname": "addEl", "guessedtype": "function"}, "getShape": {"public": "", "return": {"type": "", "description": "String"}, "description": "Returns the type of the loader shapes.", "guessedname": "getShape", "guessedtype": "function"}, "setRange": {"public": "", "params": [{"type": "Number", "name": "range", "description": " The default value is 1.3."}], "description": "Sets the amount of the modified shapes in percent.<br/>\r\nWith this value the user can set what range of the shapes should be scaled and/or faded. The shapes that are out of this range will be scaled and/or faded with a minimum amount only.<br/>\r\nThis minimum amount is 0.1 which means every shape which is out of the range is scaled and/or faded to 10% of the original values.<br/>\r\nThe visually acceptable range value should be between 0.4 and 1.5.", "guessedname": "setRange", "guessedtype": "function"}, "getFPS": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the fps of the loader.", "guessedname": "getFPS", "guessedtype": "function"}, "draw": {"protected": "", "description": "Draw the shapes on the canvas", "guessedname": "draw", "guessedtype": "function"}, "clean": {"protected": "", "description": "Cleans the canvas.", "guessedname": "clean", "guessedtype": "function"}, "setAttr": {"description": "Sets the attributes on the element", "guessedname": "setAttr", "guessedtype": "function"}, "getColor": {"public": "", "return": {"type": "", "description": "String"}, "description": "Returns the loader color in a hexadecimal form.", "guessedname": "getColor", "guessedtype": "function"}, "getRGB": {"protected": "", "params": [{"type": "", "name": "color", "description": " (String) The HEX color value to be converted to RGB"}], "description": "Return the RGB values of the passed color.", "guessedname": "getRGB", "guessedtype": "function"}, "getDensity": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the number of shapes drawn on the loader canvas.", "guessedname": "getDensity", "guessedtype": "function"}, "initialize": {"protected": "", "params": [{"type": "", "name": "id", "description": " String The id of the placeholder div."}], "description": "Initialization method.", "guessedname": "initialize", "guessedtype": "function"}, "setCSS": {"description": "Sets the css properties on the element", "guessedname": "setCSS", "guessedtype": "function"}, "getSpeed": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the speed of the loader animation.", "guessedname": "getSpeed", "guessedtype": "function"}, "reset": {"protected": "", "description": "Resets the timer.", "guessedname": "reset", "guessedtype": "function"}, "setDiameter": {"public": "", "params": [{"type": "Number", "name": "diameter", "description": " The default value is 40."}], "description": "Sets the diameter of the loader.", "guessedname": "setDiameter", "guessedtype": "functionLine truncated
{"majorversion": 2, "classmap": {"CanvasLoader": {"name": "CanvasLoader", "constructors": [{"params": [{"type": "String", "name": "id", "description": " The id of the placeholder div"}], "description": "CanvasLoader is a JavaScript UI library that draws and animates circular preloaders using the Canvas HTML object.<br/>\r\nA CanvasLoader instance creates two canvas elements which are placed into a placeholder div (the id of the div has to be passed in the constructor). The second canvas is invisible and used for caching purposes only.<br/>\r\nIf no id is passed in the constructor, the canvas objects are paced in the document directly."}], "namespace": "", "module": "CanvasLoader", "guessedname": "CanvasLoader", "methods": {"getRange": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the modified shape range in percent", "guessedname": "getRange", "guessedtype": "function"}, "show": {"description": "Shows the rendering of the loader animation", "public": "", "guessedname": "show", "guessedtype": "function"}, "setDensity": {"public": "", "params": [{"type": "Number", "name": "density", "description": " The default value is 40"}], "description": "Sets the number of shapes drawn on the loader canvas", "guessedname": "setDensity", "guessedtype": "function"}, "getDiameter": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the diameter of the loader.", "guessedname": "getDiameter", "guessedtype": "function"}, "kill": {"description": "Removes the CanvasLoader instance and all its references", "public": "", "guessedname": "kill", "guessedtype": "function"}, "tick": {"protected": "", "description": "Renders the loader animation", "guessedname": "tick", "guessedtype": "function"}, "hide": {"description": "Stops the rendering of the loader animation and hides the loader", "public": "", "guessedname": "hide", "guessedtype": "function"}, "addEl": {"return": {"type": "Object", "description": "The DOM element"}, "description": "Creates a new element with the tag and applies the passed properties on it", "protected": "", "params": [{"type": "String", "name": "tag", "description": " The tag to be created"}, {"type": "String", "name": "par", "description": " The DOM element the new element will be appended to"}, {"type": "Object", "name": "props", "description": " Additional properties passed to the new DOM element"}], "guessedname": "addEl", "guessedtype": "function"}, "transformContext": {"protected": "", "params": [{"type": "Object", "name": "x", "description": " The canvas context to be transformed"}, {"type": "Number", "name": "x", "description": " x translation"}, {"type": "Number", "name": "y", "description": " y translation"}, {"type": "Number", "name": "r", "description": " Rotation radians"}], "description": "Prepares the cache canvas for drawing", "guessedname": "transformContext", "guessedtype": "function"}, "setRange": {"public": "", "params": [{"type": "Number", "name": "range", "description": " The default value is 1.3"}], "description": "Sets the amount of the modified shapes in percent.<br/>\r\nWith this value the user can set what range of the shapes should be scaled and/or faded. The shapes that are out of this range will be scaled and/or faded with a minimum amount only.<br/>\r\nThis minimum amount is 0.1 which means every shape which is out of the range is scaled and/or faded to 10% of the original values.<br/>\r\nThe visually acceptable range value should be between 0.4 and 1.5.", "guessedname": "setRange", "guessedtype": "function"}, "getFPS": {"public": "", "return": {"type": "Number", "description": ""}, "description": "Returns the fps of the loader", "guessedname": "getFPS", "guessedtype": "function"}, "draw": {"protected": "", "description": "Draw the shapes on the canvas", "guessedname": "draw", "guessedtype": "function"}, "setAttr": {"return": {"type": "Object", "description": "The DOM element"}, "description": "Sets the attributes on the element", "protected": "", "params": [{"type": "Object", "name": "el", "description": " The DOM element to add the attributes to"}, {"type": "Object", "name": "props", "description": " The attributes"}], "guessedname": "setAttr", "guessedtype": "function"}, "getColor": {"public": "", "return": {"type": "String", "description": ""}, "description": "Returns the loader color in a hexadecimal form", "guessedname": "getColor", "guessedtype": "function"}, "setFPS": {"public": "", "params": [{"type": "Number", "name": "fps", "description": " The default value is 24"}], "description": "Sets the rendering frequency.<br/>\r\nThis value tells the loader how many times to refresh and modify the canvas in 1 second.<br/>\r\nUsing the right combination of the <code>setSpeed</code> and the <code>setFPS</code> methods allows the users to optimize the CPU usage of the loader whilst keeping the animation on a visually pleasing level.", "guessedname": "setFPS", "guessedtype": "function"}, "getLine truncated
-61
View File
@@ -1,61 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<!--
Copyright (c) 2011 Róbert Pataki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
comyCles of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all comyCles or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
----------------------------------------------------------------------------------------
Check out my GitHub: http://github.com/heartcode/
Send me an email: heartcode@robertpataki.com
Follow me on Twitter: http://twitter.com/#iHeartcode
Blog: http://heartcode.robertpataki.com
-->
<title>Heartcode Canvas loader</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script src="js/heartcode-canvasloader.js"></script>
<style>
body, html {
margin:0;
padding:0;
}
.circle {
width:400px;
height:400px;
border:1px solid #ff0000;
}
</style>
</head>
<body>
<div id="circle" class="circle"></div>
<script>
var cl = new CanvasLoader("circle");
cl.setDensity(12);
cl.setDiameter(400);
cl.setFPS(1);
</script>
</body>
</html>
+57 -35
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!--
@@ -36,44 +36,66 @@
<meta name="language" content="en" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script src="js/heartcode-canvasloader.js"></script>
<style>
body, html {
margin:0;
padding:0;
}
ul {
display:inline;
list-style:none;
margin:0;
padding:0;
}
ul li {
display:inline-block;
float:left;
padding:20px;
margin:0;
width:400px;
height:400px;
border:1px solid #ff0000;
}
cvml\:* {
behavior: url(#default#VML);
}
<script type="text/javascript" src="js/heartcode-canvasloader-min.js"></script>
<style type="text/css">
div {float:left; display:table; padding:20px;}
canvas { /*border:1px solid #ff0000;*/ }
</style>
</head>
<body>
<ul>
<li id="circle"></li>
</ul>
<script>
<div id="circle"></div>
<div id="circle2"></div>
<div id="square"></div>
<div id="rectangle"></div>
<div id="roundRectangle"></div>
<div id="circle3"></div>
<script type="text/javascript">
var cl = new CanvasLoader("circle");
cl.setShape("rect");
cl.setDiameter(50);
cl.setDensity(8);
cl.setFPS(2);
cl.setSpeed(1);
cl.setColor("#000000");
cl.setDensity(60);
cl.setFPS(12);
cl.setSpeed(2);
cl.setRange(0.3);
cl.setColor("#0099ff");
/*
var cl1 = new CanvasLoader("circle2");
cl1.setShape("spiral");
cl1.setDensity(60);
cl1.setFPS(24);
cl1.setSpeed(1);
cl1.setColor("#DA20DB");
var cl2 = new CanvasLoader("square");
cl2.setShape("square");
cl2.setDensity(9);
cl2.setFPS(6);
cl2.setSpeed(1);
cl2.setColor("#000000");
var cl3 = new CanvasLoader("rectangle");
cl3.setShape("rect");
cl3.setDensity(18);
cl3.setFPS(12);
cl3.setSpeed(1);
cl3.setRange(0.85);
cl3.setColor("#000000");
var cl4 = new CanvasLoader("roundRectangle");
cl4.setShape("roundRect");
cl4.setDensity(24);
cl4.setFPS(12);
cl4.setSpeed(1);
cl4.setRange(0.9);
cl4.setColor("#000000");
var cl5 = new CanvasLoader("circle3");
cl5.setShape("oval");
cl5.setDensity(12);
cl5.setFPS(6);
cl5.setSpeed(1);
cl5.setColor("#99cc00");*/
</script>
</body>
</html>
+14 -1
View File
@@ -1 +1,14 @@
(function(j){var b=function(l){this.initialize(l)},d=b.prototype,k,a=["canvas","vml"],e=["oval","spiral","square","rect","roundRect"],h=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,i=function(l,p,o){var m=document.createElement(l),q;for(q in p){m[q]=p[q]}if(typeof(o)!=="undefined"){o.appendChild(m)}return m},g=function(m,l){var o;for(o in l){m.style[o]=l[o]}return m},c=function(m,l){var o;for(o in l){m.setAttribute(o,l[o])}return m},f=function(){return !!document.createElement("canvas").getContext};d.initialize=function(q,o){try{if(document.getElementById(q)!==undefined){this.mother=document.getElementById(q)}else{this.mother=document.body}}catch(m){this.mother=document.body}o=typeof(o)!=="undefined"?o:"canvasLoader";this.cont=g(i("div",{id:o},this.mother),{border:"1px solid #ff0000",position:"absolute"});if(f()){k=a[0];this.canvas=i("canvas",{},this.cont);this.context=this.canvas.getContext("2d");this.cacheCanvas=g(i("canvas",{},this.cont),{display:"none"});this.cacheContext=this.cacheCanvas.getContext("2d")}else{k=a[1];if(typeof(b.vmlSheet)==="undefined"){document.getElementsByTagName("head")[0].appendChild(i("style"));b.vmlSheet=document.styleSheets[document.styleSheets.length-1];var l=["group","oval","roundrect","fill"],p;for(p in l){b.vmlSheet.addRule(l[p],"behavior:url(#default#VML); position:absolute;")}}this.vml=i("group",{},this.cont)}this.setColor(this.color);d.ready=true;this.draw();this.show()};d.container={};d.canvas={};d.context={};d.cacheCanvas={};d.cacheContext={};d.running=false;d.ready=false;d.timer={};d.activeId=0;d.diameter=40;d.setDiameter=function(l){this.diameter=Math.round(Math.abs(l));this.redraw()};d.getDiameter=function(){return this.diameter};d.colorRGB={};d.color="#000000";d.setColor=function(l){this.color=h.test(l)?l:"#000000";this.colorRGB=this.getRGB(this.color);this.redraw()};d.getColor=function(){return this.color};d.shape=e[0];d.setShape=function(l){var m;for(m in e){if(l===e[m]){this.shape=l;this.redraw();break}}};d.getShape=function(){return this.shape};d.density=40;d.setDensity=function(l){this.density=Math.round(Math.abs(l));this.redraw()};d.getDensity=function(){return this.density};d.range=1.3;d.setRange=function(l){this.range=Math.abs(l);this.redraw()};d.getRange=function(){return this.range};d.fading=true;d.setFading=function(l){this.fading=l;this.redraw()};d.getFading=function(){return this.fading};d.speed=2;d.setSpeed=function(l){this.speed=Math.round(Math.abs(l));this.reset()};d.getSpeed=function(){return this.speed};d.fps=24;d.setFPS=function(l){this.fps=Math.round(Math.abs(l));this.reset()};d.getFPS=function(){return this.fps};d.getRGB=function(l){l=l.charAt(0)==="#"?l.substring(1,7):l;return{r:parseInt(l.substring(0,2),16),g:parseInt(l.substring(2,4),16),b:parseInt(l.substring(4,6),16)}};d.draw=function(){var u=0,t,q,v,p,o,B,F,l,D=Math.round(this.density*this.range),m,G=0,r,z,E,A,C=1000,n=0;if(k===a[0]){this.cacheContext.clearRect(0,0,this.cacheCanvas.width,this.cacheCanvas.height);c(this.canvas,{width:this.diameter,height:this.diameter});c(this.cacheCanvas,{width:this.diameter,height:this.diameter});while(u<this.density){m=u<=D?1-((1-G)/D*u):m=G;B=360-360/this.density*u;F=B/180*Math.PI;this.cacheContext.save();if(this.fading){this.cacheContext.fillStyle="rgba("+this.colorRGB.r+","+this.colorRGB.g+","+this.colorRGB.b+","+m.toString()+")"}else{this.cacheContext.fillStyle="rgba("+this.colorRGB.r+","+this.colorRGB.g+","+this.colorRGB.b+",1)"}switch(this.shape){case e[0]:case e[1]:t=this.diameter*0.07;p=this.canvas.width*0.5+Math.cos(F)*(this.diameter*0.5-t)-this.canvas.width*0.5;o=this.canvas.height*0.5+Math.sin(F)*(this.diameter*0.5-t)-this.canvas.height*0.5;this.cacheContext.beginPath();if(this.shape===e[1]){this.cacheContext.arc(this.diameter*0.5+p,this.diameter*0.5+o,t*m,0,Math.PI*2,false)}else{this.cacheContext.arc(this.diameter*0.5+p,this.diameter*0.5+o,t,0,Math.PI*2,false)}break;case e[2]:t=this.diameter*0.12;p=Math.cos(F)*(this.cacheCanvas.width*0.5-t)+this.cacheCanvas.width*0.5;o=Math.sin(F)*(this.cacheCanvas.width*0.5-t)+this.cacheCanvas.height*0.5;this.cacheContext.translate(p,o);this.cacheContext.rotate(F);this.cacheContext.translate(-p,-o);this.cacheContext.beginPath();this.cacheContext.fillRect(p,o-t*0.5,t,t);break;case e[3]:q=t=this.diameter*0.3;v=q*0.27;p=Math.cos(F)*(v+(this.cacheCanvas.height-v)*0.13)+this.cacheCanvas.width*0.5;o=Math.sin(F)*(v+(this.cacheCanvas.height-v)*0.13)+this.cacheCanvas.height*0.5;this.cacheContext.translate(p,o);this.cacheContext.rotate(F);this.cacheContext.translate(-p,-o);this.cacheContext.beginPath();this.cacheContext.fillRect(p,o-v*0.5,q,v);break;case e[4]:q=t=this.diameter*0.3;v=q*0.27;l=v*0.56;p=Math.cos(F)*(v+(this.cacheCanvas.height-v)*0.13)+this.cacheCanvas.width*0.5;o=Math.sin(F)*(v+(this.cacheCanvas.height-v)*0.13)+this.cacheCanvas.height*0.5;this.cacheContext.translate(p,o);this.cacheContext.rotate(F);this.cacheContext.translate(-p,-o);this.cacheContext.beginPath();this.cacheContext.moveTo(p+l,o-v*0.5);this.cacheLine truncated
(function(u){var j=function(b){this.initialize(b)},a=j.prototype,o,p=["canvas","vml"],f=["oval","spiral","square","rect","roundRect"],v=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,s=navigator.appVersion.indexOf("MSIE")!==-1&&parseFloat(navigator.appVersion.split("MSIE")[1])===8?true:false,w=!!document.createElement("canvas").getContext,l=function(b,i,a){var b=document.createElement(b),c;for(c in a)b[c]=a[c];typeof i!=="undefined"&&i.appendChild(b);return b},n=function(b,i){for(var a in i)b.style[a]=i[a];
return b},q=function(b,i){for(var a in i)b.setAttribute(a,i[a]);return b},r=function(b,i,a,c){b.save();b.translate(i,a);b.rotate(c);b.translate(-i,-a);b.beginPath()};a.initialize=function(b,a){try{this.mother=document.getElementById(b)!==void 0?document.getElementById(b):document.body}catch(f){this.mother=document.body}this.cont=l("div",this.mother,{id:typeof a!=="undefined"?a:"canvasLoader"});if(w)o=p[0],this.canvas=l("canvas",this.cont),this.context=this.canvas.getContext("2d"),this.cacheCanvas=
n(l("canvas",this.cont),{display:"none"}),this.cacheContext=this.cacheCanvas.getContext("2d");else{o=p[1];if(typeof j.vmlSheet==="undefined"){document.getElementsByTagName("head")[0].appendChild(l("style"));j.vmlSheet=document.styleSheets[document.styleSheets.length-1];var c=["group","oval","roundrect","fill"],d;for(d in c)j.vmlSheet.addRule(c[d],"behavior:url(#default#VML); position:absolute;")}this.vml=l("group",this.cont)}this.setColor(this.color);this.ready=true;this.draw();this.show()};a.container=
{};a.canvas={};a.context={};a.cacheCanvas={};a.cacheContext={};a.ready=false;a.timer={};a.activeId=0;a.diameter=40;a.setDiameter=function(b){this.diameter=Math.round(Math.abs(b));this.redraw()};a.getDiameter=function(){return this.diameter};a.colorRGB={};a.color="#000000";a.setColor=function(b){this.color=v.test(b)?b:"#000000";this.colorRGB=this.getRGB(this.color);this.redraw()};a.getColor=function(){return this.color};a.shape=f[0];a.setShape=function(b){for(var a in f)if(b===f[a]){this.shape=b;this.redraw();
break}};a.getShape=function(){return this.shape};a.density=40;a.setDensity=function(b){this.density=Math.round(Math.abs(b));this.redraw()};a.getDensity=function(){return this.density};a.range=1.3;a.setRange=function(b){this.range=Math.abs(b);this.redraw()};a.getRange=function(){return this.range};a.speed=2;a.setSpeed=function(b){this.speed=Math.round(Math.abs(b));this.reset()};a.getSpeed=function(){return this.speed};a.fps=24;a.setFPS=function(b){this.fps=Math.round(Math.abs(b));this.reset()};a.getFPS=
function(){return this.fps};a.getRGB=function(b){b=b.charAt(0)==="#"?b.substring(1,7):b;return{r:parseInt(b.substring(0,2),16),g:parseInt(b.substring(2,4),16),b:parseInt(b.substring(4,6),16)}};a.draw=function(){var b=0,a,g,c,d,e,m,h,j=Math.round(this.density*this.range),k,t=0;if(o===p[0]){this.cacheContext.clearRect(0,0,this.cacheCanvas.width,this.cacheCanvas.height);q(this.canvas,{width:this.diameter,height:this.diameter});for(q(this.cacheCanvas,{width:this.diameter,height:this.diameter});b<this.density;){k=
b<=j?1-1/j*b:k=0;m=360-360/this.density*b;h=m/180*Math.PI;this.cacheContext.fillStyle="rgba("+this.colorRGB.r+","+this.colorRGB.g+","+this.colorRGB.b+","+k.toString()+")";switch(this.shape){case f[0]:case f[1]:a=this.diameter*0.07;d=this.canvas.width*0.5+Math.cos(h)*(this.diameter*0.5-a)-this.canvas.width*0.5;e=this.canvas.height*0.5+Math.sin(h)*(this.diameter*0.5-a)-this.canvas.height*0.5;this.cacheContext.beginPath();this.shape===f[1]?this.cacheContext.arc(this.diameter*0.5+d,this.diameter*0.5+
e,a*k,0,Math.PI*2,false):this.cacheContext.arc(this.diameter*0.5+d,this.diameter*0.5+e,a,0,Math.PI*2,false);break;case f[2]:a=this.diameter*0.12;d=Math.cos(h)*(this.cacheCanvas.width*0.5-a)+this.cacheCanvas.width*0.5;e=Math.sin(h)*(this.cacheCanvas.width*0.5-a)+this.cacheCanvas.height*0.5;r(this.cacheContext,d,e,h);this.cacheContext.fillRect(d,e-a*0.5,a,a);break;case f[3]:case f[4]:g=this.diameter*0.3,c=g*0.27,d=Math.cos(h)*(c+(this.cacheCanvas.height-c)*0.13)+this.cacheCanvas.width*0.5,e=Math.sin(h)*
(c+(this.cacheCanvas.height-c)*0.13)+this.cacheCanvas.height*0.5,r(this.cacheContext,d,e,h),this.shape===f[3]?this.cacheContext.fillRect(d,e-c*0.5,g,c):(a=c*0.7,this.cacheContext.moveTo(d+a,e-c*0.5),this.cacheContext.lineTo(d+g-a,e-c*0.5),this.cacheContext.quadraticCurveTo(d+g,e-c*0.5,d+g,e-c*0.5+a),this.cacheContext.lineTo(d+g,e-c*0.5+c-a),this.cacheContext.quadraticCurveTo(d+g,e-c*0.5+c,d+g-a,e-c*0.5+c),this.cacheContext.lineTo(d+a,e-c*0.5+c),this.cacheContext.quadraticCurveTo(d,e-c*0.5+c,d,e-c*
0.5+c-a),this.cacheContext.lineTo(d,e-c*0.5+a),this.cacheContext.quadraticCurveTo(d,e-c*0.5,d+a,e-c*0.5))}this.cacheContext.closePath();this.cacheContext.fill();this.cacheContext.restore();++b}}else{n(this.cont,{width:this.diameter,height:this.diameter});n(this.vml,{width:this.diameter,height:this.diameter,border:"1px solid #ff0000"});switch(this.shape){case f[0]:case f[1]:h="oval";a=140;break;case f[2]:h="roundrect";a=120;break;case f[3]:case f[4]:h="roundrect",a=300}g=c=a;d=500-c;for(e=-c*0.5;b<
this.density;){k=b<=j?1-1/j*b:k=0;m=270-360/this.density*b;switch(this.shape){case f[1]:g=c=a*k;d=500-a*0.5-a*k*0.5;e=(a-a*k)*0.5;break;case f[0]:case f[2]:s&&(e=0,this.shape===f[2]&&(d=500-c*0.5));break;case f[3]:case f[4]:g=a*0.95,c=g*0.28,s?(d=0,e=500-c*0.5):(d=500-g,e=-c*0.5),t=this.shape===f[4]?0.6:0}m=q(n(l("group",this.vml),{width:1E3,height:1E3,rotation:m}),{coordsize:"1000,1000",coordorigin:"-500,-500"});m=n(l(h,m,{stroked:false,arcSize:t}),{width:g,height:c,top:e,left:d});l("fill",m,{color:this.color,
opacity:k});++b}}this.tick(true)};a.clean=function(){if(o===p[0])this.context.clearRect(0,0,this.canvas.width,this.canvas.height);else if(this.vml.hasChildNodes())for(;this.vml.childNodes.length>=1;)this.vml.removeChild(this.vml.firstChild)};a.redraw=function(){this.ready&&(this.clean(),this.draw())};a.reset=function(){typeof this.timer==="number"&&(this.hide(),this.show())};a.tick=function(a){var f=this.density>360?this.density/360:360/this.density;f*=this.speed;a||(this.activeId+=f);this.activeId>=
360&&(this.activeId-=360);o===p[0]?(this.context.clearRect(0,0,this.diameter,this.diameter),r(this.context,this.diameter*0.5,this.diameter*0.5,Math.PI/180*this.activeId),this.context.drawImage(this.cacheCanvas,0,0,this.diameter,this.diameter),this.context.restore()):this.vml.style.rotation=this.activeId};a.show=function(){if(typeof this.timer!=="number"){var a=this;this.timer=self.setInterval(function(){a.tick()},Math.round(1E3/this.fps));n(this.cont,{display:"block"})}};a.hide=function(){typeof this.timer===
"number"&&(clearInterval(this.timer),delete this.timer,n(this.cont,{display:"none"}))};a.kill=function(){typeof this.timer==="number"&&this.hide();o===p[0]?(this.cont.removeChild(this.canvas),this.cont.removeChild(this.cacheCanvas)):this.cont.removeChild(this.vml);for(var a in this)delete this[a]};u.CanvasLoader=j})(window);
+158 -170
View File
@@ -33,22 +33,28 @@
* @module CanvasLoader
**/
(function (window) {
"use strict";
/**
* CanvasLoader is a JavaScript UI library that draws and animates circular preloaders using the Canvas HTML object.<br/>
* A CanvasLoader instance creates two canvas elements which are placed into a placeholder div (the id of the div has to be passed in the constructor). The second canvas is invisible and used for caching purposes only.<br/>
* If no id is passed in the constructor, the canvas objects are paced in the document directly.
* @class CanvasLoader
* @constructor
* @param {String} id The id of the placeholder div.
* @param {String} id The id of the placeholder div
**/
"use strict";
var CanvasLoader = function (id) {
this.initialize(id);
}, p = CanvasLoader.prototype, engine, engines = ["canvas", "vml"], shapes = ["oval", "spiral", "square", "rect", "roundRect"], colorReg = /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
}, p = CanvasLoader.prototype, engine, engines = ["canvas", "vml"], shapes = ["oval", "spiral", "square", "rect", "roundRect"], colorReg = /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, ie8 = navigator.appVersion.indexOf("MSIE") !== -1 && parseFloat(navigator.appVersion.split("MSIE")[1]) === 8 ? true : false, canvasSupport = !!document.createElement('canvas').getContext,
/**
* Creates a new element with the tag and applies the passed properties on it.
* Creates a new element with the tag and applies the passed properties on it
* @method addEl
* @protected
* @param tag {String} The tag to be created
* @param par {String} The DOM element the new element will be appended to
* @param props {Object} Additional properties passed to the new DOM element
* @return {Object} The DOM element
*/
addEl = function (tag, props, par) {
addEl = function (tag, par, props) {
var el = document.createElement(tag), n;
for (n in props) { el[n] = props[n]; }
if(typeof(par) !== "undefined") {
@@ -58,36 +64,55 @@
},
/**
* Sets the css properties on the element
* @method setCSS
* @protected
* @param el {Object} The DOM element to be styled
* @param props {Object} The style properties
* @return {Object} The DOM element
*/
setCSS = function (el, props) {
var n;
for (n in props) { el.style[n] = props[n]; }
for (var n in props) { el.style[n] = props[n]; }
return el;
},
/**
* Sets the attributes on the element
* @method setAttr
* @protected
* @param el {Object} The DOM element to add the attributes to
* @param props {Object} The attributes
* @return {Object} The DOM element
*/
setAttr = function (el, props) {
var n;
for (n in props) { el.setAttribute(n, props[n]); }
for (var n in props) { el.setAttribute(n, props[n]); }
return el;
},
/**
* Checks if the browser supports Canvas
* Prepares the cache canvas for drawing
* @method transformContext
* @protected
* @param x {Object} The canvas context to be transformed
* @param x {Number} x translation
* @param y {Number} y translation
* @param r {Number} Rotation radians
*/
canvasSupport = function () {
return !!document.createElement('canvas').getContext;
transformContext = function(c, x, y, r) {
c.save();
c.translate(x, y);
c.rotate(r);
c.translate(-x, -y);
c.beginPath();
};
/**
* Initialization method.
* Initialization method
* @method initialize
* @param id String The id of the placeholder div.
* @protected
* @param parentId (String) The id of the placeholder div, where the loader will be nested into
* @param loaderId (String) The id of loader
*/
p.initialize = function (parentId, loaderId) {
/*
* Find the containing div by id (passed by the user).
* If the container element cannot be found we use the document body itself.
* Find the containing div by id
* If the container element cannot be found we use the document body itself
*/
try {
// Look for the parent element
@@ -101,15 +126,15 @@
}
// Creates the parent div of the loader instance
loaderId = typeof (loaderId) !== "undefined" ? loaderId : "canvasLoader";
this.cont = setCSS(addEl("div", {id: loaderId}, this.mother), {border: "1px solid #ff0000", position: "absolute"});
if (canvasSupport()) {
this.cont = addEl("div", this.mother, {id: loaderId});
if (canvasSupport) {
// For browsers with Canvas support...
engine = engines[0];
// Create the canvas element
this.canvas = addEl("canvas", {}, this.cont);
this.canvas = addEl("canvas", this.cont);
this.context = this.canvas.getContext("2d");
// Create the cache canvas element
this.cacheCanvas = setCSS(addEl("canvas", {}, this.cont), { display: "none" });
this.cacheCanvas = setCSS(addEl("canvas", this.cont), { display: "none" });
this.cacheContext = this.cacheCanvas.getContext("2d");
} else {
// For browsers without Canvas support...
@@ -121,153 +146,147 @@
var a = ["group", "oval", "roundrect", "fill"], n;
for (n in a) { CanvasLoader.vmlSheet.addRule(a[n], "behavior:url(#default#VML); position:absolute;"); }
}
this.vml = addEl("group", {}, this.cont);
this.vml = addEl("group", this.cont);
}
// Set the RGB color object
this.setColor(this.color);
// Set the instance ready
p.ready = true;
// Draw the shapes on the canvas
// Sets the instance to be ready
this.ready = true;
// Draws the shapes on the canvas
this.draw();
// Start rendering the preloader
// Starts rendering the preloader
this.show();
};
/////////////////////////////////////////////////////////////////////////////////////////////
// Property declarations
/**
* The div we place the canvas object into.
* The div we place the canvas object into
* @property container
* @type Object
* @protected
* @type Object
**/
p.container = {};
/**
* The div we draw the shapes into.
* The div we draw the shapes into
* @property canvas
* @type Object
* @protected
* @type Object
**/
p.canvas = {};
/**
* The canvas context.
* The canvas context
* @property context
* @type Object
* @protected
* @type Object
**/
p.context = {};
/**
* The canvas we use for caching.
* The canvas we use for caching
* @property cacheCanvas
* @type Object
* @protected
* @type Object
**/
p.cacheCanvas = {};
/**
* The context of the cache canvas.
* The context of the cache canvas
* @property cacheContext
* @type Object
* @protected
* @type Object
**/
p.cacheContext = {};
/**
* Tell if the loader rendering is running.
* @property running
* @type Boolean
* @protected
**/
p.running = false;
/**
* Tell if the canvas and its context is ready.
* Tells if the canvas and its context is ready
* @property ready
* @type Boolean
* @protected
* @type Boolean
**/
p.ready = false;
/**
* Add a timer for the rendering.
* Adds a timer for the rendering
* @property timer
* @type Boolean
* @protected
* @type Boolean
**/
p.timer = {};
/**
* The active shape id for rendering.
* The active shape id for rendering
* @property activeId
* @type Number
* @protected
* @type Number
**/
p.activeId = 0;
/**
* The diameter of the loader.
* The diameter of the loader
* @property diameter
* @protected
* @type Number
* @default 40
* @protected
**/
p.diameter = 40;
/**
* Sets the diameter of the loader.
* Sets the diameter of the loader
* @method setDiameter
* @param diameter {Number} The default value is 40.
* @public
* @param diameter {Number} The default value is 40
**/
p.setDiameter = function (diameter) { this.diameter = Math.round(Math.abs(diameter)); this.redraw(); };
/**
* Returns the diameter of the loader.
* @method getDiameter
* @return Number
* @public
* @return {Number}
**/
p.getDiameter = function () { return this.diameter; };
/**
* The color of the loader shapes in RGB.
* The color of the loader shapes in RGB
* @property colorRGB
* @type Object
* @protected
* @type Object
**/
p.colorRGB = {};
/**
* The color of the loader shapes in HEX.
* The color of the loader shapes in HEX
* @property color
* @protected
* @type String
* @default "#000000"
* @protected
**/
p.color = "#000000";
/**
* Sets hexadecimal color of the loader.
* Sets hexadecimal color of the loader
* @method setColor
* @param color {String} The default value is '#000000'.
* @public
* @param color {String} The default value is '#000000'
**/
p.setColor = function (color) { this.color = colorReg.test(color) ? color : "#000000"; this.colorRGB = this.getRGB(this.color); this.redraw(); };
/**
* Returns the loader color in a hexadecimal form.
* Returns the loader color in a hexadecimal form
* @method getColor
* @return String
* @public
* @return {String}
**/
p.getColor = function () { return this.color; };
/**
* The type of the loader shapes.
* The type of the loader shapes
* @property shape
* @protected
* @type String
* @default "oval"
* @protected
**/
p.shape = shapes[0];
/**
* Sets the type of the loader shapes.<br/>
* <br/><b>The acceptable values are:</b>
* <ul>
* <li>'circle'</li>
* <li>'oval'</li>
* <li>'spiral'</li>
* <li>'square'</li>
* <li>'rectangle'</li>
* <li>'roundedRectangle'</li>
* <li>'rect'</li>
* <li>'roundRect'</li>
* </ul>
* @method setShape
* @param shape {String} The default value is 'circle'.
* @public
* @param shape {String} The default value is 'oval'
**/
p.setShape = function (shape) {
var n;
@@ -276,39 +295,39 @@
}
};
/**
* Returns the type of the loader shapes.
* Returns the type of the loader shapes
* @method getShape
* @return String
* @public
* @return {String}
**/
p.getShape = function () { return this.shape; };
/**
* The number of shapes drawn on the loader canvas.
* The number of shapes drawn on the loader canvas
* @property density
* @protected
* @type Number
* @default 40
* @protected
**/
p.density = 40;
/**
* Sets the number of shapes drawn on the loader canvas.
* Sets the number of shapes drawn on the loader canvas
* @method setDensity
* @param density {Number} The default value is 40.
* @public
* @param density {Number} The default value is 40
**/
p.setDensity = function (density) { this.density = Math.round(Math.abs(density)); this.redraw(); };
/**
* Returns the number of shapes drawn on the loader canvas.
* Returns the number of shapes drawn on the loader canvas
* @method getDensity
* @return {Number}
* @public
* @return {Number}
**/
p.getDensity = function () { return this.density; };
/**
* Sets the amount of the modified shapes in percent.
* The amount of the modified shapes in percent.
* @property range
* @type Number
* @protected
* @type Number
**/
p.range = 1.3;
/**
@@ -317,43 +336,22 @@
* This minimum amount is 0.1 which means every shape which is out of the range is scaled and/or faded to 10% of the original values.<br/>
* The visually acceptable range value should be between 0.4 and 1.5.
* @method setRange
* @param range {Number} The default value is 1.3.
* @public
* @param range {Number} The default value is 1.3
**/
p.setRange = function (range) { this.range = Math.abs(range); this.redraw(); };
/**
* Returns the modified shape range in percent.
* Returns the modified shape range in percent
* @method getRange
* @return {Number}
* @public
* @return {Number}
**/
p.getRange = function () { return this.range; };
/**
* The fading of the loader shapes.
* @property fading
* @type Boolean
* @protected
**/
p.fading = true;
/**
* Sets the fading of the loader shapes.
* @method setFading
* @param fading {Boolean} The default value is true.
* @public
**/
p.setFading = function (fading) { this.fading = fading; this.redraw(); };
/**
* Returns the fading of the loader shapes.
* @method getFading
* @return {Boolean}
* @public
**/
p.getFading = function () { return this.fading; };
/**
* The speed of the loader animation.
* The speed of the loader animation
* @property speed
* @type Number
* @protected
* @type Number
**/
p.speed = 2;
/**
@@ -361,23 +359,22 @@
* This value tells the loader how many shapes to skip by each tick.<br/>
* Using the right combination of the <code>setFPS</code> and the <code>setSpeed</code> methods allows the users to optimize the CPU usage of the loader whilst keeping the animation on a visually pleasing level.
* @method setSpeed
* @param speed {Number} The default value is 2.
* @seealso setFPS
* @public
* @param speed {Number} The default value is 2
**/
p.setSpeed = function (speed) { this.speed = Math.round(Math.abs(speed)); this.reset(); };
/**
* Returns the speed of the loader animation.
* Returns the speed of the loader animation
* @method getSpeed
* @return {Number}
* @public
* @return {Number}
**/
p.getSpeed = function () { return this.speed; };
/**
* The FPS of the loader animation rendering.
* The FPS value of the loader animation rendering
* @property fps
* @type Number
* @protected
* @type Number
**/
p.fps = 24;
/**
@@ -385,25 +382,24 @@
* This value tells the loader how many times to refresh and modify the canvas in 1 second.<br/>
* Using the right combination of the <code>setSpeed</code> and the <code>setFPS</code> methods allows the users to optimize the CPU usage of the loader whilst keeping the animation on a visually pleasing level.
* @method setFPS
* @param fps {Number} The default value is 24.
* @seealso setSpeed
* @public
* @param fps {Number} The default value is 24
**/
p.setFPS = function (fps) { this.fps = Math.round(Math.abs(fps)); this.reset(); };
/**
* Returns the fps of the loader.
* Returns the fps of the loader
* @method getFPS
* @return {Number}
* @public
* @return {Number}
**/
p.getFPS = function () { return this.fps; };
// End of Property declarations
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* Return the RGB values of the passed color.
* Return the RGB values of the passed color
* @method getRGB
* @param color (String) The HEX color value to be converted to RGB
* @protected
* @param color {String} The HEX color value to be converted to RGB
*/
p.getRGB = function (color) {
color = color.charAt(0) === "#" ? color.substring(1, 7) : color;
@@ -417,7 +413,6 @@
p.draw = function () {
var i = 0, size, w, h, x, y, angle, radians, radius, animBits = Math.round(this.density * this.range), bitMod, minBitMod = 0, s, g, sh, f, d = 1000, arc = 0;
if (engine === engines[0]) {
// Clean the cache canvas
this.cacheContext.clearRect(0, 0, this.cacheCanvas.width, this.cacheCanvas.height);
setAttr(this.canvas, {width: this.diameter, height: this.diameter});
setAttr(this.cacheCanvas, {width: this.diameter, height: this.diameter});
@@ -425,8 +420,7 @@
bitMod = i <= animBits ? 1 - ((1 - minBitMod) / animBits * i) : bitMod = minBitMod;
angle = 360 - 360 / this.density * i;
radians = angle / 180 * Math.PI;
this.cacheContext.save();
if (this.fading) { this.cacheContext.fillStyle = "rgba(" + this.colorRGB.r + "," + this.colorRGB.g + "," + this.colorRGB.b + "," + bitMod.toString() + ")"; } else { this.cacheContext.fillStyle = "rgba(" + this.colorRGB.r + "," + this.colorRGB.g + "," + this.colorRGB.b + ",1)"; }
this.cacheContext.fillStyle = "rgba(" + this.colorRGB.r + "," + this.colorRGB.g + "," + this.colorRGB.b + "," + bitMod.toString() + ")";
switch (this.shape) {
case shapes[0]:
case shapes[1]:
@@ -440,42 +434,30 @@
size = this.diameter * 0.12;
x = Math.cos(radians) * (this.cacheCanvas.width * 0.5 - size) + this.cacheCanvas.width * 0.5;
y = Math.sin(radians) * (this.cacheCanvas.width * 0.5 - size) + this.cacheCanvas.height * 0.5;
this.cacheContext.translate(x, y);
this.cacheContext.rotate(radians);
this.cacheContext.translate(-x, -y);
this.cacheContext.beginPath();
transformContext(this.cacheContext, x, y, radians);
this.cacheContext.fillRect(x, y - size * 0.5, size, size);
break;
case shapes[3]:
w = size = this.diameter * 0.3;
h = w * 0.27;
x = Math.cos(radians) * (h + (this.cacheCanvas.height - h) * 0.13) + this.cacheCanvas.width * 0.5;
y = Math.sin(radians) * (h + (this.cacheCanvas.height - h) * 0.13) + this.cacheCanvas.height * 0.5;
this.cacheContext.translate(x, y);
this.cacheContext.rotate(radians);
this.cacheContext.translate(-x, -y);
this.cacheContext.beginPath();
this.cacheContext.fillRect(x, y - h * 0.5, w, h);
break;
case shapes[4]:
w = size = this.diameter * 0.3;
w = this.diameter * 0.3;
h = w * 0.27;
radius = h * 0.56;
x = Math.cos(radians) * (h + (this.cacheCanvas.height - h) * 0.13) + this.cacheCanvas.width * 0.5;
y = Math.sin(radians) * (h + (this.cacheCanvas.height - h) * 0.13) + this.cacheCanvas.height * 0.5;
this.cacheContext.translate(x, y);
this.cacheContext.rotate(radians);
this.cacheContext.translate(-x, -y);
this.cacheContext.beginPath();
this.cacheContext.moveTo(x + radius, y - h * 0.5);
this.cacheContext.lineTo(x + w - radius, y - h * 0.5);
this.cacheContext.quadraticCurveTo(x + w, y - h * 0.5, x + w, y - h * 0.5 + radius);
this.cacheContext.lineTo(x + w, y - h * 0.5 + h - radius);
this.cacheContext.quadraticCurveTo(x + w, y - h * 0.5 + h, x + w - radius, y - h * 0.5 + h);
this.cacheContext.lineTo(x + radius, y - h * 0.5 + h);
this.cacheContext.quadraticCurveTo(x, y - h * 0.5 + h, x, y - h * 0.5 + h - radius);
this.cacheContext.lineTo(x, y - h * 0.5 + radius);
this.cacheContext.quadraticCurveTo(x, y - h * 0.5, x + radius, y - h * 0.5);
transformContext(this.cacheContext, x, y, radians);
if(this.shape === shapes[3]) {
this.cacheContext.fillRect(x, y - h * 0.5, w, h);
} else {
radius = h * 0.7;
this.cacheContext.moveTo(x + radius, y - h * 0.5);
this.cacheContext.lineTo(x + w - radius, y - h * 0.5);
this.cacheContext.quadraticCurveTo(x + w, y - h * 0.5, x + w, y - h * 0.5 + radius);
this.cacheContext.lineTo(x + w, y - h * 0.5 + h - radius);
this.cacheContext.quadraticCurveTo(x + w, y - h * 0.5 + h, x + w - radius, y - h * 0.5 + h);
this.cacheContext.lineTo(x + radius, y - h * 0.5 + h);
this.cacheContext.quadraticCurveTo(x, y - h * 0.5 + h, x, y - h * 0.5 + h - radius);
this.cacheContext.lineTo(x, y - h * 0.5 + radius);
this.cacheContext.quadraticCurveTo(x, y - h * 0.5, x + radius, y - h * 0.5);
}
break;
}
this.cacheContext.closePath();
@@ -485,7 +467,7 @@
}
} else {
setCSS(this.cont, {width: this.diameter, height: this.diameter});
setCSS(this.vml, {width: this.diameter, height: this.diameter});
setCSS(this.vml, {width: this.diameter, height: this.diameter, border: "1px solid #ff0000"});
switch (this.shape) {
case shapes[0]:
case shapes[1]:
@@ -514,29 +496,39 @@
x = d * 0.5 - size * 0.5 - size * bitMod * 0.5;
y = (size - size * bitMod) * 0.5;
break;
case shapes[0]:
case shapes[2]:
if (ie8) {
y = 0;
if(this.shape === shapes[2]) {
x = d * 0.5 -h * 0.5;
}
}
break;
case shapes[3]:
case shapes[4]:
w = size * 0.95;
h = w * 0.28;
x = d * 0.5 - w;
y = -h * 0.5;
if (ie8) {
x = 0;
y = d * 0.5 - h * 0.5;
} else {
x = d * 0.5 - w;
y = -h * 0.5;
}
arc = this.shape === shapes[4] ? 0.6 : 0;
break;
}
// Adds the group (shape needed to be grouped for accurate rotation)
g = setAttr(setCSS(addEl("group", {}, this.vml), {width: d, height: d, rotation: angle}), {coordsize: d + "," + d, coordorigin: -d * 0.5 + "," + (-d * 0.5)});
// Adds the shape
s = setCSS(addEl(sh, {stroked: false, arcSize: arc}, g), { width: w, height: h, top: y, left: x});
// Adds the fill
f = addEl("fill", {color: this.color, opacity: bitMod}, s);
g = setAttr(setCSS(addEl("group", this.vml), {width: d, height: d, rotation: angle}), {coordsize: d + "," + d, coordorigin: -d * 0.5 + "," + (-d * 0.5)});
s = setCSS(addEl(sh, g, {stroked: false, arcSize: arc}), { width: w, height: h, top: y, left: x});
f = addEl("fill", s, {color: this.color, opacity: bitMod});
++i;
}
}
// Render the changes on the canvas
this.tick(true);
};
/**
* Cleans the canvas.
* Cleans the canvas
* @method clean
* @protected
*/
@@ -544,7 +536,6 @@
if (engine === engines[0]) {
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
} else {
// Cleans the VML element from its children
if (this.vml.hasChildNodes()) {
while (this.vml.childNodes.length >= 1) {
this.vml.removeChild(this.vml.firstChild);
@@ -553,7 +544,7 @@
}
};
/**
* Redraws the canvas.
* Redraws the canvas
* @method redraw
* @protected
*/
@@ -564,7 +555,7 @@
}
};
/**
* Resets the timer.
* Resets the timer
* @method reset
* @protected
*/
@@ -575,8 +566,8 @@
}
};
/**
* Renders the loader animation.
* @event tick
* Renders the loader animation
* @method tick
* @protected
*/
p.tick = function (initialize) {
@@ -586,10 +577,7 @@
if (this.activeId >= 360) { this.activeId -= 360; }
if (engine === engines[0]) {
this.context.clearRect(0, 0, this.diameter, this.diameter);
this.context.save();
this.context.translate(this.diameter * 0.5, this.diameter * 0.5);
this.context.rotate(Math.PI / 180 * this.activeId);
this.context.translate(-this.diameter * 0.5, -this.diameter * 0.5);
transformContext(this.context, this.diameter * 0.5, this.diameter * 0.5, Math.PI / 180 * this.activeId);
this.context.drawImage(this.cacheCanvas, 0, 0, this.diameter, this.diameter);
this.context.restore();
} else {
@@ -597,7 +585,7 @@
}
};
/**
* Shows the rendering of the loader animation.
* Shows the rendering of the loader animation
* @method show
* @public
*/
@@ -609,7 +597,7 @@
}
};
/**
* Stop the rendering of the loader animation and hides the loader.
* Stops the rendering of the loader animation and hides the loader
* @method hide
* @public
*/
@@ -621,7 +609,7 @@
}
};
/**
* Remove the CanvasLoader instance and all references.
* Removes the CanvasLoader instance and all its references
* @method kill
* @public
*/