Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

๐Ÿ›  Vector return this

+5 -4
+5 -4
js/vector.js
··· 42 42 this.x = pos.x != undefined ? pos.x : this.x; 43 43 this.y = pos.y != undefined ? pos.y : this.y; 44 44 this.z = pos.z != undefined ? pos.z : this.z; 45 + return this; 45 46 }; 46 47 47 48 Vector.prototype.rotate = function( rotation ) { ··· 81 82 82 83 Vector.prototype.add = function( vec ) { 83 84 if ( !vec ) { 84 - return; 85 + return this; 85 86 } 86 87 vec = Vector.sanitize( vec ); 87 88 this.x += vec.x; ··· 92 93 93 94 Vector.prototype.subtract = function( vec ) { 94 95 if ( !vec ) { 95 - return; 96 + return this; 96 97 } 97 98 vec = Vector.sanitize( vec ); 98 99 this.x -= vec.x; ··· 103 104 104 105 Vector.prototype.multiply = function( value ) { 105 106 if ( value === undefined ) { 106 - return; 107 + return this; 107 108 } 108 109 // multiple all values by same number 109 110 if ( typeof value == 'number' ) { 110 111 this.x *= value; 111 112 this.y *= value; 112 113 this.z *= value; 113 - return; 114 + return this; 114 115 } 115 116 // multiply object 116 117 var vec = Vector.sanitize( value, 1 );