Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: describe usage of CharTransform in jsDoc #486

Merged
merged 1 commit into from
Oct 30, 2024
Merged
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
24 changes: 24 additions & 0 deletions src/gfx/draw/drawText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,34 @@ export type CharTransformFunc = (idx: number, ch: string) => CharTransform;
* @group Options
*/
export interface CharTransform {
/**
* Offset to apply to the position of the text character.
* Shifts the character's position by the specified 2D vector.
*/
pos?: Vec2;

/**
* Scale transformation to apply to the text character's current scale.
* When a number, it is scaled uniformly.
* Given a 2D vector, it is scaled independently along the X and Y axis.
*/
scale?: Vec2 | number;

/**
* Increases the amount of degrees to rotate the text character.
*/
angle?: number;

/**
* Color transformation applied to the text character.
* Multiplies the current color with this color.
*/
color?: Color;

/**
* Opacity multiplication applied to the text character.
* For example, an opacity of 0.4 with 2 set in the transformation, the resulting opacity will be 0.8 (0.4 × 2).
*/
opacity?: number;
}

Expand Down