aboutsummaryrefslogtreecommitdiff
path: root/assets/canvas-runtime.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-07-09 11:52:02 -0700
committerNivesh Rajbhandari2012-07-09 11:52:02 -0700
commitfebfdb18042d1c73ac58ee4e35c5f176428dee00 (patch)
tree516a29ca99d4aae0d5228223fff438c1a3c4e0d3 /assets/canvas-runtime.js
parentac27d538af33ca8d67d3d88729f49c05793afda7 (diff)
parentaedd14b18695d031f695d27dfbd94df5614495bb (diff)
downloadninja-febfdb18042d1c73ac58ee4e35c5f176428dee00.tar.gz
Merge branch 'refs/heads/ninja-internal' into MaterialsUI
Conflicts: js/panels/Materials/materials-library-panel.reel/materials-library-panel.css js/panels/Materials/materials-popup.reel/materials-popup.css Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'assets/canvas-runtime.js')
-rw-r--r--assets/canvas-runtime.js48
1 files changed, 36 insertions, 12 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index c441a98d..ce392f34 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -1,7 +1,31 @@
1/* <copyright> 1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 2Copyright (c) 2012, Motorola Mobility, Inc
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3All Rights Reserved.
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4BSD License.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
5</copyright> */ 29</copyright> */
6 30
7// namespace for the Ninja Canvas Runtime 31// namespace for the Ninja Canvas Runtime
@@ -609,7 +633,7 @@ NinjaCvsRt.RuntimeGeomObj = Object.create(Object.prototype, {
609 case "uber": mat = Object.create(NinjaCvsRt.RuntimeUberMaterial, {}); break; 633 case "uber": mat = Object.create(NinjaCvsRt.RuntimeUberMaterial, {}); break;
610 case "plasma": mat = Object.create(NinjaCvsRt.RuntimePlasmaMaterial, {}); break; 634 case "plasma": mat = Object.create(NinjaCvsRt.RuntimePlasmaMaterial, {}); break;
611 case "taper": mat = Object.create(NinjaCvsRt.RuntimeTaperMaterial, {}); break; 635 case "taper": mat = Object.create(NinjaCvsRt.RuntimeTaperMaterial, {}); break;
612 636
613 case "paris": 637 case "paris":
614 case "water": mat = Object.create(NinjaCvsRt.RuntimeWaterMaterial, {}); break; 638 case "water": mat = Object.create(NinjaCvsRt.RuntimeWaterMaterial, {}); break;
615 639
@@ -633,7 +657,7 @@ NinjaCvsRt.RuntimeGeomObj = Object.create(Object.prototype, {
633 case "twistVert": 657 case "twistVert":
634 mat = Object.create(NinjaCvsRt.RuntimeTwistVertMaterial, {}); 658 mat = Object.create(NinjaCvsRt.RuntimeTwistVertMaterial, {});
635 break; 659 break;
636 660
637 case "flag": 661 case "flag":
638 mat = Object.create(NinjaCvsRt.RuntimeFlagMaterial, {}); 662 mat = Object.create(NinjaCvsRt.RuntimeFlagMaterial, {});
639 break; 663 break;
@@ -1398,7 +1422,7 @@ NinjaCvsRt.RuntimeMaterial = Object.create(Object.prototype, {
1398 // Property Accessors 1422 // Property Accessors
1399 /////////////////////////////////////////////////////////////////////// 1423 ///////////////////////////////////////////////////////////////////////
1400 1424
1401 // a material can be animated or not. default is not. 1425 // a material can be animated or not. default is not.
1402 // Any material needing continuous rendering should override this method 1426 // Any material needing continuous rendering should override this method
1403 isAnimated: { value: function() { return false; }}, 1427 isAnimated: { value: function() { return false; }},
1404 1428
@@ -1490,7 +1514,7 @@ NinjaCvsRt.RuntimeTwistVertMaterial = Object.create(NinjaCvsRt.RuntimeMaterial,
1490 // they may share this update method 1514 // they may share this update method
1491 update: { 1515 update: {
1492 value: function(time) { 1516 value: function(time) {
1493 1517
1494 var angle = this._angle; 1518 var angle = this._angle;
1495 angle += this._dTime * this._speed; 1519 angle += this._dTime * this._speed;
1496 if (angle > this._twistAmount) 1520 if (angle > this._twistAmount)
@@ -1521,7 +1545,7 @@ NinjaCvsRt.RuntimeTaperMaterial = Object.create(NinjaCvsRt.RuntimeMaterial, {
1521 1545
1522 1546
1523 isAnimated: { value: function() { return true; }}, 1547 isAnimated: { value: function() { return true; }},
1524 1548
1525 importJSON: { 1549 importJSON: {
1526 value: function(jObj) { 1550 value: function(jObj) {
1527 for (var prop in jObj) 1551 for (var prop in jObj)
@@ -1568,7 +1592,7 @@ NinjaCvsRt.RuntimeTaperMaterial = Object.create(NinjaCvsRt.RuntimeMaterial, {
1568 // they may share this update method 1592 // they may share this update method
1569 update: { 1593 update: {
1570 value: function(time) { 1594 value: function(time) {
1571 1595
1572 var speed = this.u_speed; 1596 var speed = this.u_speed;
1573 this._dTime += 0.01 * speed; 1597 this._dTime += 0.01 * speed;
1574 1598
@@ -1844,7 +1868,7 @@ NinjaCvsRt.RuntimeRadialGradientMaterial = Object.create(NinjaCvsRt.RuntimeMater
1844 1868
1845 if (this._textureTransform && this._shader["default"].u_texTransform) 1869 if (this._textureTransform && this._shader["default"].u_texTransform)
1846 this._shader["default"].u_texTransform.set( this._textureTransform ); 1870 this._shader["default"].u_texTransform.set( this._textureTransform );
1847 1871
1848 if (this.u_cos_sin_angle && this._shader["default"].u_cos_sin_angle) 1872 if (this.u_cos_sin_angle && this._shader["default"].u_cos_sin_angle)
1849 this._shader["default"].u_cos_sin_angle.set( this.u_cos_sin_angle ); 1873 this._shader["default"].u_cos_sin_angle.set( this.u_cos_sin_angle );
1850 } 1874 }
@@ -2323,7 +2347,7 @@ NinjaCvsRt.RuntimeSubPath = Object.create(NinjaCvsRt.RuntimeGeomObj, {
2323 var position, gradient, cs, inset; //vars used in gradient calculations 2347 var position, gradient, cs, inset; //vars used in gradient calculations
2324 inset = Math.ceil( lw ) - 0.5; 2348 inset = Math.ceil( lw ) - 0.5;
2325 inset=0; 2349 inset=0;
2326 2350
2327 if(ipColor.gradientMode === "radial") { 2351 if(ipColor.gradientMode === "radial") {
2328 var ww = w - 2*lw, hh = h - 2*lw; 2352 var ww = w - 2*lw, hh = h - 2*lw;
2329 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2); 2353 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2);
@@ -2663,7 +2687,7 @@ NinjaCvsRt.RuntimeBrushStroke = Object.create(NinjaCvsRt.RuntimeGeomObj, {
2663 } else { 2687 } else {
2664 ctx.strokeStyle = this.buildColor(ctx, this._strokeColor, w,h, this._strokeWidth, alphaVal); 2688 ctx.strokeStyle = this.buildColor(ctx, this._strokeColor, w,h, this._strokeWidth, alphaVal);
2665 } 2689 }
2666 2690
2667 for (var l=0;l<numlayers;l++){ 2691 for (var l=0;l<numlayers;l++){
2668 ctx.beginPath(); 2692 ctx.beginPath();
2669 p = points[0]; 2693 p = points[0];