Skip to content

Commit 4e46847

Browse files
committed
add better docs from wiggle options
1 parent 900114b commit 4e46847

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,16 @@ export interface TimestampProvider {
234234
export const canvasPath: (timestampProvider?: TimestampProvider) => Animation;
235235

236236
export interface WiggleOptions {
237+
// Speed of the wiggle movement. Higher is faster.
237238
speed: number;
239+
// Delay before the first wiggle frame.
240+
// Default: 0
238241
initialDelay?: number;
242+
// Length of the transition from the current state to the wiggle blob.
243+
// Default: 0
239244
initialTransition?: number;
245+
// Interpolation function.
246+
// Default: linear
240247
initialTimingFunction?: Keyframe["timingFunction"];
241248
}
242249
// Preset animation that produces natural-looking random movement.

public/animate.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,16 @@ export interface TimestampProvider {
7878
}
7979

8080
export interface WiggleOptions {
81+
// Speed of the wiggle movement. Higher is faster.
8182
speed: number;
83+
// Delay before the first wiggle frame.
84+
// Default: 0
8285
initialDelay?: number;
86+
// Length of the transition from the current state to the wiggle blob.
87+
// Default: 0
8388
initialTransition?: number;
89+
// Interpolation function.
90+
// Default: linear
8491
initialTimingFunction?: Keyframe["timingFunction"];
8592
}
8693

public/blobs.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,27 @@ import {mapPoints} from "../internal/util";
55
import {checkBlobOptions, checkCanvasOptions, checkSvgOptions} from "../internal/check";
66

77
export interface BlobOptions {
8+
// A given seed will always produce the same blob.
9+
// Use `Math.random()` for pseudorandom behavior.
810
seed: string | number;
11+
// Actual number of points will be `3 + extraPoints`.
912
extraPoints: number;
13+
// Increases the amount of variation in point position.
1014
randomness: number;
15+
// Size of the bounding box.
1116
size: number;
1217
}
1318

1419
export interface CanvasOptions {
20+
// Coordinates of top-left corner of the blob.
1521
offsetX?: number;
1622
offsetY?: number;
1723
}
1824

1925
export interface SvgOptions {
20-
fill?: string;
21-
stroke?: string;
22-
strokeWidth?: number;
26+
fill?: string; // Default: "#ec576b".
27+
stroke?: string; // Default: "none".
28+
strokeWidth?: number; // Default: 0.
2329
}
2430

2531
export const canvasPath = (blobOptions: BlobOptions, canvasOptions: CanvasOptions = {}): Path2D => {

0 commit comments

Comments
 (0)