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: add some examples to some comps #466

Merged
merged 2 commits into from
Oct 22, 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
39 changes: 37 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,18 @@ export interface KAPLAYCtx<
*
* @param a The angle to rotate by. Defaults to 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worthwhile to note that angles for this are in degrees, some other game libs use radians

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

Copy link
Contributor Author

@amyspark-ng amyspark-ng Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't it already say (in degrees)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh duh, it was the line that got cut off by the GitHub diff

*
* @group Components
* @example
* ```js
* let bean = add([
* sprite("bean"),
* rotate(),
* ])
*
* // bean will be upside down!
* bean.angle = 180
* ```

* @group Components
*/
rotate(a?: number): RotateComp;
/**
Expand Down Expand Up @@ -871,7 +882,7 @@ export interface KAPLAYCtx<
*/
follow(obj: GameObj | null, offset?: Vec2): FollowComp;
/**
* Custom shader.
* Custom shader to manipulate sprite.
*
* @group Components
*/
Expand Down Expand Up @@ -1121,6 +1132,22 @@ export interface KAPLAYCtx<
/**
* A component to animate properties.
*
* @example
* ```js
* let movingBean = add([
* sprite("bean"),
* pos(50, 150),
* anchor("center"),
* animate(),
* ]);
*
* // Moving right to left using ping-pong
* movingBean.animate("pos", [vec2(50, 150), vec2(150, 150)], {
* duration: 2,
* direction: "ping-pong",
* });
* ```
*
* @since v3001.0
* @group Components
*/
Expand Down Expand Up @@ -2368,6 +2395,14 @@ export interface KAPLAYCtx<
/**
* Flash the camera.
*
* @example
* ```js
* onClick(() => {
* // flashed
* camFlash(WHITE, 0.5)
* })
* ```
*
* @group Info
*/
camFlash(flashColor: Color, fadeOutTime: number): TimerController;
Expand Down