mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[two.js] Update 'Object' type and 'distanceToSquared' method typo (#35914)
* Update index.d.ts * Update index.d.ts * Update two.js-tests.ts * Update two.js-tests.ts * Update two.js-tests.ts * Update two.js-tests.ts
This commit is contained in:
parent
fb623cb9bb
commit
bf0310e305
5
types/two.js/index.d.ts
vendored
5
types/two.js/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for js 0.7
|
||||
// Project: https://two.js.org
|
||||
// Definitions by: Carlos Precioso <https://github.com/cprecioso>
|
||||
// Konstantin <https://github.com/demkonst>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@ -273,7 +274,7 @@ declare namespace Two {
|
||||
number
|
||||
> {}
|
||||
|
||||
type Object = Path | Group;
|
||||
type Object = Path | Group | Text;
|
||||
|
||||
class Vector {
|
||||
constructor(x: number, y: number);
|
||||
@ -298,7 +299,7 @@ declare namespace Two {
|
||||
length(): number;
|
||||
normalize(): this;
|
||||
distanceTo(v: Vector): number;
|
||||
distanceSquared(v: Vector): number;
|
||||
distanceToSquared(v: Vector): number;
|
||||
setLength(length: number): this;
|
||||
equals(v: Vector): boolean;
|
||||
lerp(v: Vector, t: number): this;
|
||||
|
||||
@ -75,3 +75,15 @@ import Two = require("two.js");
|
||||
group.rotation += t * 4 * Math.PI;
|
||||
}).play(); // Finally, start the animation loop
|
||||
}
|
||||
|
||||
{
|
||||
const two = new Two({ width: 300, height: 500 });
|
||||
const text = new Two.Text('text test', 10, 10);
|
||||
two.add(text);
|
||||
}
|
||||
|
||||
{
|
||||
const v = new Two.Vector(0, 0);
|
||||
const dist = v.distanceToSquared(new Two.Vector(100, 200));
|
||||
v.x = dist;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user