Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

victor

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victor - npm Package Compare versions

Comparing version 0.1.2 to 0.1.4

.sass-cache/014aa749d127f05005792b647681f04a1880f635/screen.scssc

2

bower.json

@@ -8,3 +8,3 @@ {

},
"version": "0.1.2",
"version": "0.1.4",
"homepage": "https://github.com/maxkueng/victor",

@@ -11,0 +11,0 @@ "authors": [

@@ -23,3 +23,27 @@ exports = module.exports = Victor;

}
/**
* The X axis
*
* ### Examples:
* var vec = new Victor.fromArray(42, 21);
*
* vec.x;
* // => 42
*
* @api public
*/
this.x = x || 0;
/**
* The Y axis
*
* ### Examples:
* var vec = new Victor.fromArray(42, 21);
*
* vec.y;
* // => 21
*
* @api public
*/
this.y = y || 0;

@@ -29,32 +53,2 @@ };

/**
* # Properties
*/
/**
* The X axis
*
* ### Examples:
* var vec = new Victor.fromArray(42, 21);
*
* vec.x;
* // => 42
*
* @api public
*/
Victor.prototype.x = 0;
/**
* The Y axis
*
* ### Examples:
* var vec = new Victor.fromArray(42, 21);
*
* vec.y;
* // => 21
*
* @api public
*/
Victor.prototype.y = 0;
/**
* # Static

@@ -116,3 +110,6 @@ */

Victor.mix = function (vecA, vecB, amount) {
amount = amount || 0.5
if (typeof amount === 'undefined') {
amount = 0.5;
}
var x = (1 - amount) * vecA.x + amount * vecB.x;

@@ -436,7 +433,9 @@ var y = (1 - amount) * vecA.y + amount * vecB.y;

Victor.prototype.normalize = function () {
if (this.length() === 0) {
var length = this.length();
if (length === 0) {
this.x = 1;
this.y = 0;
} else {
this.divide(this.length());
this.divide(length);
}

@@ -595,3 +594,6 @@ return this;

Victor.prototype.mixX = function (vec, amount) {
amount = amount || 0.5;
if (typeof amount === 'undefined') {
amount = 0.5;
}
this.x = (1 - amount) * this.x + amount * vec.x;

@@ -618,3 +620,6 @@ return this;

Victor.prototype.mixY = function (vec, amount) {
amount = amount || 0.5;
if (typeof amount === 'undefined') {
amount = 0.5;
}
this.y = (1 - amount) * this.y + amount * vec.y;

@@ -641,3 +646,2 @@ return this;

Victor.prototype.mix = function (vec, amount) {
amount = amount || 0.5;
this.mixX(vec, amount);

@@ -876,6 +880,24 @@ this.mixY(vec, amount);

Victor.prototype.distance = function (vec) {
return Math.sqrt(this.distanceSq(vec));
};
/**
* Calculates the squared euclidean distance between this vector and another
*
* ### Examples:
* var vec1 = new Victor(100, 50);
* var vec2 = new Victor(200, 60);
*
* vec1.distanceSq(vec2);
* // => 10100
*
* @param {Victor} vector The second vector
* @return {Number} Distance
* @api public
*/
Victor.prototype.distanceSq = function (vec) {
var dx = this.distanceX(vec),
dy = this.distanceY(vec);
return Math.sqrt(dx * dx + dy * dy);
return dx * dx + dy * dy;
};

@@ -896,5 +918,21 @@

Victor.prototype.length = function () {
return Math.sqrt(this.x * this.x + this.y * this.y);
return Math.sqrt(this.lengthSq());
};
/**
* Squared length / magnitude
*
* ### Examples:
* var vec = new Victor(100, 50);
*
* vec.lengthSq();
* // => 12500
*
* @return {Number} Length / Magnitude
* @api public
*/
Victor.prototype.lengthSq = function () {
return this.x * this.x + this.y * this.y;
};
Victor.prototype.magnitude = Victor.prototype.length;

@@ -901,0 +939,0 @@

{
"name": "victor",
"version": "0.1.2",
"version": "0.1.4",
"description": "A JavaScript 2D vector class with methods for common vector operations",

@@ -19,2 +19,3 @@ "keywords": [

},
"homepage": "http://victorjs.org/",
"author": "Max Kueng <me@maxkueng.com> (http://maxkueng.com/)",

@@ -21,0 +22,0 @@ "contributors": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc