Skip to content

Commit

Permalink
docs: describe usage of CharTransform in jsDoc (#486) cherry-pick (#489)
Browse files Browse the repository at this point in the history
Co-authored-by: Erb3 <[email protected]>
  • Loading branch information
niceEli and Erb3 authored Oct 31, 2024
1 parent cae018b commit 74c4002
Showing 1 changed file with 24 additions and 0 deletions.
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

0 comments on commit 74c4002

Please sign in to comment.