aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/linear-gradient-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/linear-gradient-material.js')
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index 50ef56f0..137ced27 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -26,7 +26,7 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29 </copyright> */
30 30
31var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser; 31var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser;
32var Material = require("js/lib/rdge/materials/material").Material; 32var Material = require("js/lib/rdge/materials/material").Material;
@@ -104,6 +104,26 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
104 this.update( 0 ); 104 this.update( 0 );
105 }; 105 };
106 106
107 this.resetToDefault = function()
108 {
109 this._propValues[this._propNames[0]] = this._color1.slice(0);
110 this._propValues[this._propNames[1]] = this._color2.slice(0);
111 this._propValues[this._propNames[2]] = this._color3.slice(0);
112 this._propValues[this._propNames[3]] = this._color4.slice(0);
113
114 this._propValues[this._propNames[4]] = this._colorStop1;
115 this._propValues[this._propNames[5]] = this._colorStop2;
116 this._propValues[this._propNames[6]] = this._colorStop3;
117 this._propValues[this._propNames[7]] = this._colorStop4;
118
119 this._propValues[this._propNames[8]] = [ Math.cos(this._angle), Math.sin(this._angle) ];
120
121 var nProps = this._propNames.length;
122 for (var i=0; i<nProps; i++) {
123 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
124 }
125 };
126
107 // Only Linear Gradient and Radial Gradients support gradients; 127 // Only Linear Gradient and Radial Gradients support gradients;
108 this.gradientType = "linear"; 128 this.gradientType = "linear";
109 129
@@ -134,7 +154,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
134 css += ')'; 154 css += ')';
135 155
136 return css; 156 return css;
137 }; 157 };
138 158
139 // Only Linear Gradient and Radial Gradient have gradient data. 159 // Only Linear Gradient and Radial Gradient have gradient data.
140 this.setGradientData = function(colors) { 160 this.setGradientData = function(colors) {