Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions types/flubber/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
22 changes: 22 additions & 0 deletions types/flubber/flubber-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import flubber = require("flubber");

var triangle = "M1,0 L2,2 L0,2 Z",
pentagon = [[0, 0], [2, 0], [2, 1], [1, 2], [0, 1]];

var interpolator = flubber.interpolate(triangle, pentagon);
interpolator(0); // returns an SVG triangle path string
interpolator(0.5); // returns something halfway between the triangle and the octagon
interpolator(1); // returns an SVG octagon path string

var interpolator = flubber.toCircle(triangle, 100, 100, 10);
interpolator(0); // returns an SVG triangle path string
interpolator(0.5); // returns something halfway between the triangle and the circle
interpolator(1); // returns a circle path string centered at 100, 100 with a radius of 10

var interpolator = flubber.toRect(triangle, 10, 50, 100, 200);
interpolator(0); // returns an SVG triangle path string
interpolator(0.5); // returns something halfway between the triangle and the rectangle
interpolator(1); // returns a rectangle path string from [10, 50] in the upper left to [110, 250] in the lower right

flubber.toPathString([[1, 1], [2, 1], [1.5, 2]]);
flubber.splitPathString("M1,1 L2,1 L1.5,2Z M3,3 L4,3 L3.5,4 Z");
29 changes: 29 additions & 0 deletions types/flubber/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export type Interpolator = (t: number) => string

export type Shape = number[][] | string

export interface Options {
maxSegmentLength?: number;
string?: boolean;
single?: boolean;
}

export function interpolate(fromShape: Shape, toShape: Shape, options?: Options): Interpolator;

export function toCircle(fromShape: Shape, x: number, y: number, r: number): Interpolator;

export function toRect(fromShape: Shape, x: number, y: number, width: number, height: number, options?: Options): Interpolator;

export function fromCircle(x: number, y: number, radius: number, toShape: Shape, options?: Options): Interpolator;

export function fromRect(x: number, y: number, width: number, height: number, toShape: Shape, options?: Options): Interpolator;

export function separate(fromShape: Shape, toShapeList: Shape[], options?: Options): Interpolator;

export function combine(fromShapeList: Shape[], toShape: Shape, options?: Options): Interpolator;

export function interpolateAll(fromShapeList: Shape[], toShapeList: Shape[], options?: Options): Interpolator;

export function toPathString(ring: Array<[number, number]>): string;

export function splitPathString(pathString: string): string[];
17 changes: 17 additions & 0 deletions types/flubber/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"name": "@types/flubber",
"version": "0.4.9999",
"projects": [
"https://github.com/veltman/flubber#readme"
],
"devDependencies": {
"@types/flubber": "workspace:."
},
"owners": [
{
"name": "Huxulm",
"githubUsername": "huxulm"
}
]
}
19 changes: 19 additions & 0 deletions types/flubber/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "node16",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"flubber-tests.ts"
]
}