-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
132 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
225 changes: 109 additions & 116 deletions
225
apps/playground/src/routes/instanced-sprite/AnimatedInstancedSprite.svelte.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,114 @@ | ||
import type { Events, Props, Slots } from '@threlte/core' | ||
import { SvelteComponent } from 'svelte' | ||
import { Material } from 'three' | ||
import type { Events, Props, Slots } from '@threlte/core'; | ||
import { SvelteComponent } from 'svelte'; | ||
import { Material } from 'three'; | ||
|
||
export type AnimatedInstancedSpriteProps = Props<Material> & { | ||
/** Number of instances */ | ||
count: number | ||
|
||
/** The URL of the spritesheet texture image. */ | ||
textureUrl: string | ||
|
||
/** The URL of the spritesheet JSON. */ | ||
// dataUrl?: string | ||
|
||
/** The current playing animation name. */ | ||
// animation?: string | ||
|
||
/** | ||
* Whether or not the current animation should loop. | ||
* | ||
* @default true | ||
*/ | ||
// loop?: boolean | ||
|
||
/** | ||
* Controls whether or not to automatically run an animation on load. | ||
* | ||
* @default true | ||
*/ | ||
// autoplay?: boolean | ||
|
||
/** | ||
* The desired frames per second of the animation | ||
* | ||
* This will override any frame durations specified in JSON | ||
*/ | ||
fps?: number | ||
|
||
/** | ||
* The texture filtering applied to the spritesheet. | ||
* | ||
* @default 'nearest' | ||
*/ | ||
filter?: 'nearest' | 'linear' | ||
|
||
/** | ||
* Sets the alpha value to be used when running an alpha test. | ||
* | ||
* @see https://threejs.org/docs/#api/en/materials/Material.alphaTest | ||
* | ||
* @default 0.1 | ||
*/ | ||
// alphaTest?: number | ||
|
||
/** | ||
* Delay the start of the animation in ms. | ||
* | ||
* @default 0 | ||
*/ | ||
// delay?: number | ||
|
||
/** | ||
* Whether or not the material should be transparent. | ||
* | ||
* @default true | ||
*/ | ||
// transparent?: boolean | ||
|
||
/** | ||
* Whether or not the Sprite should flip sides on the x-axis. | ||
* | ||
* @default false | ||
*/ | ||
// flipX?: boolean | ||
|
||
/** | ||
* The start frame of the current animation. | ||
* | ||
* @default 0 | ||
*/ | ||
// startFrame?: number | ||
|
||
/** | ||
* The end frame of the current animation. | ||
* | ||
* @default rows * columns - 1 | ||
*/ | ||
endFrame?: number | ||
|
||
/** | ||
* The total number of frames in the spritesheet. | ||
*/ | ||
totalFrames?: number | ||
|
||
/** | ||
* The number of rows in the spritesheet. | ||
* | ||
* @default 1 | ||
*/ | ||
rows?: number | ||
|
||
/** | ||
* The number of columns in the spritesheet. | ||
* | ||
* @default 1 | ||
*/ | ||
columns?: number | ||
|
||
readonly play?: () => void | ||
readonly pause?: () => void | ||
} | ||
|
||
export type AnimatedInstancedSpriteEvents = any | ||
|
||
export type AnimatedInstancedSpriteSlots = any | ||
/** Number of instances */ | ||
count: number; | ||
|
||
/** The URL of the spritesheet texture image. */ | ||
textureUrl: string; | ||
|
||
/** The URL of the spritesheet JSON. */ | ||
// dataUrl?: string | ||
|
||
/** The current playing animation name. */ | ||
// animation?: string | ||
|
||
/** | ||
* Controls whether or not to automatically run an animation on load. | ||
* | ||
* @default true | ||
*/ | ||
// autoplay?: boolean | ||
|
||
/** | ||
* The desired frames per second of the animation | ||
* | ||
* This will override any frame durations specified in JSON | ||
*/ | ||
fps?: number; | ||
|
||
/** | ||
* The texture filtering applied to the spritesheet. | ||
* | ||
* @default 'nearest' | ||
*/ | ||
filter?: 'nearest' | 'linear'; | ||
|
||
/** | ||
* Sets the alpha value to be used when running an alpha test. | ||
* | ||
* @see https://threejs.org/docs/#api/en/materials/Material.alphaTest | ||
* | ||
* @default 0.1 | ||
*/ | ||
// alphaTest?: number | ||
|
||
/** | ||
* Delay the start of the animation in ms. | ||
* | ||
* @default 0 | ||
*/ | ||
// delay?: number | ||
|
||
/** | ||
* Whether or not the material should be transparent. | ||
* | ||
* @default true | ||
*/ | ||
// transparent?: boolean | ||
|
||
/** | ||
* Whether or not the Sprite should flip sides on the x-axis. | ||
* | ||
* @default false | ||
*/ | ||
// flipX?: boolean | ||
|
||
/** | ||
* The start frame of the current animation. | ||
* | ||
* @default 0 | ||
*/ | ||
// startFrame?: number | ||
|
||
/** | ||
* The end frame of the current animation. | ||
* | ||
* @default rows * columns - 1 | ||
*/ | ||
endFrame?: number; | ||
|
||
/** | ||
* The total number of frames in the spritesheet. | ||
*/ | ||
totalFrames?: number; | ||
|
||
/** | ||
* The number of rows in the spritesheet. | ||
* | ||
* @default 1 | ||
*/ | ||
rows?: number; | ||
|
||
/** | ||
* The number of columns in the spritesheet. | ||
* | ||
* @default 1 | ||
*/ | ||
columns?: number; | ||
|
||
readonly play?: () => void; | ||
readonly pause?: () => void; | ||
}; | ||
|
||
export type AnimatedInstancedSpriteEvents = any; | ||
|
||
export type AnimatedInstancedSpriteSlots = any; | ||
|
||
export default class AnimatedInstancedSprite extends SvelteComponent< | ||
AnimatedInstancedSpriteProps, | ||
AnimatedInstancedSpriteEvents, | ||
AnimatedInstancedSpriteSlots | ||
AnimatedInstancedSpriteProps, | ||
AnimatedInstancedSpriteEvents, | ||
AnimatedInstancedSpriteSlots | ||
> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
d878a5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
threejs-kit-playground – ./apps/playground
threejs-kit-playground.vercel.app
threejs-kit-playground-git-main-jerzakm.vercel.app
threejs-kit-playground-jerzakm.vercel.app