Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#18011 from drichard/patch-1
Browse files Browse the repository at this point in the history
Update Victor.js definition. Add missing methods
  • Loading branch information
RyanCavanaugh authored Jul 14, 2017
2 parents 4b6aa2a + 17c921a commit e7bfb2e
Showing 1 changed file with 99 additions and 10 deletions.
109 changes: 99 additions & 10 deletions types/victor/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for Victor.js 0.2.5
// Type definitions for Victor.js 1.1.0
// Project: http://victorjs.org/
// Definitions by: Ivane Gegia <https://twitter.com/ivanegegia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
Expand Down Expand Up @@ -89,6 +89,27 @@ declare class Victor
*/
add(vector:Victor):Victor;

/**
* Adds the given scalar to both vector axis.
*
* @param scalar
*/
addScalar(scalar: number): Victor;

/**
* Adds the given scalar to the X axis.
*
* @param scalar
*/
addScalarX(scalar: number): Victor;

/**
* Adds the given scalar to the Y axis.
*
* @param scalar
*/
addScalarY(scalar: number): Victor;

/**
* Subtracts another vector's X component from itself.
* @param vector
Expand All @@ -107,6 +128,27 @@ declare class Victor
*/
subtract(vector:Victor):Victor;

/**
* Subtracts the given scalar from both axis.
*
* @param scalar
*/
subtractScalar(scalar: number): Victor;

/**
* Subtracts the given scalar from the X axis.
*
* @param scalar
*/
subtractScalarX(scalar: number): Victor;

/**
* Subtracts the given scalar from the Y axis.
*
* @param scalar
*/
subtractScalarY(scalar: number): Victor;

/**
* Multiplies the X component with the X component of another vector.
* @param vector
Expand All @@ -128,21 +170,21 @@ declare class Victor
/**
* Multiplies both vector axis by the given scalar value
*
* @param victor
* @param scalar
*/
multiplyScalar(scalar: number): Victor;

/**
* Multiplies the X axis by the given scalar
*
* @param victor
* @param scalar
*/
multiplyScalarX(scalar: number): Victor;

/**
* Multiplies the Y axis by the given scalar
*
* @param vector
* @param scalar
*/
multiplyScalarY(scalar: number): Victor;

Expand All @@ -164,6 +206,27 @@ declare class Victor
*/
divide(scalar:Victor):Victor;

/**
* Divides both vector axis by the given scalar value.
*
* @param scalar
*/
divideScalar(scalar: number): Victor;

/**
* Divides the X axis by the given scalar value.
*
* @param scalar
*/
divideScalarX(scalar: number): Victor;

/**
* Divides the Y axis by the given scalar value.
*
* @param scalar
*/
divideScalarY(scalar: number): Victor;

/**
* Inverts the X component.
*/
Expand All @@ -182,23 +245,23 @@ declare class Victor
/**
* Performs a linear blend / interpolation of the X component towards another vector.
* @param vector Number amount Value between 0 and 1. Default: 0.5
* @param ammount
* @param amount
*/
mixX(vector:Victor, ammount:number):Victor;
mixX(vector:Victor, amount:number):Victor;

/**
* Performs a linear blend / interpolation of the Y component towards another vector.
* @param vector
* @param ammount
* @param amount
*/
mixY(vector:Victor, ammount:number):Victor;
mixY(vector:Victor, amount:number):Victor;

/**
* Performs a linear blend / interpolation towards another vector.
* @param vector
* @param ammount
* @param amount
*/
mix(vector:Victor, ammount:number):Victor;
mix(vector:Victor, amount:number):Victor;

/**
* Normalizes the vector by scaling it down to a length of 1 while keeping its direction.
Expand Down Expand Up @@ -274,6 +337,22 @@ declare class Victor
*/
randomizeAny(topLeft:Victor, bottomRight:Victor):Victor;

/**
* Rounds both axis to a certain precision.
*/
toFixed():Victor;

/**
* Sets the vector to zero (0,0).
*/
zero():Victor;

/**
* Projects a vector onto another vector, setting itself to the result.
* @param vector
*/
projectOnto(vector:Victor):Victor;

/**
* Returns the dot product of two vectors.
* @param vector
Expand Down Expand Up @@ -372,6 +451,16 @@ declare class Victor
*/
verticalAngleDeg():number;

/**
* Returns a true if vector is (0, 0).
*/
isZero():boolean;

/**
* Returns a true if this vector is the same as another.
* @param vector
*/
isEqualTo(vector:Victor):boolean;
}

export = Victor;

0 comments on commit e7bfb2e

Please sign in to comment.