-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
93f35b8
commit 866410b
Showing
18 changed files
with
184 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# umanager-animation-parser | ||
|
||
## Installation | ||
|
||
```sh | ||
pnpm i umanager-animation-parser | ||
``` | ||
|
||
## Usage | ||
|
||
```ts | ||
const player = new AnimationPlayer(ssp, target); | ||
``` | ||
|
||
## Properties | ||
|
||
### tweenSet | ||
|
||
## Methods | ||
|
||
### play | ||
|
||
``` | ||
player.paly(frames) | ||
``` | ||
|
||
### stop | ||
|
||
``` | ||
player.stop() | ||
``` | ||
|
||
### reset | ||
|
||
``` | ||
player.reset() | ||
``` | ||
|
||
### dispose | ||
|
||
``` | ||
player.dispose() | ||
``` | ||
|
||
## Events | ||
|
||
### update | ||
|
||
### start |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
libs/umanager-animation-parser/dist/types/AnimationParser.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { EventDispatcher, Object3D } from 'three'; | ||
import SoonSpace from 'soonspacejs'; | ||
import { TAnimationFrame, TEventMap, TTransformObject, TTweenType } from './types'; | ||
declare class AnimationPlayer extends EventDispatcher<TEventMap> { | ||
readonly ssp: SoonSpace; | ||
readonly target: Object3D; | ||
tweenSet: Set<TTweenType>; | ||
constructor(ssp: SoonSpace, target: Object3D); | ||
initTransform(defaultTransform?: TTransformObject): TTransformObject; | ||
getInitialTransform(): TTransformObject | undefined; | ||
play(frames: TAnimationFrame[]): Promise<void>; | ||
stop(): void; | ||
reset(): void; | ||
dispose(): void; | ||
} | ||
export { AnimationPlayer }; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './AnimationParser'; | ||
export * from './types'; |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { AnimationModeType, IVector3 } from 'soonspacejs'; | ||
import { Tween } from 'three/examples/jsm/libs/tween.module.js'; | ||
export type TAnimationFrame = { | ||
position: IVector3; | ||
rotation: IVector3; | ||
scale: IVector3; | ||
duration: number; | ||
delay: number; | ||
repeat: number; | ||
yoyo: boolean; | ||
easing: AnimationModeType; | ||
}; | ||
export type TTransformObject = Pick<TAnimationFrame, 'position' | 'rotation' | 'scale'>; | ||
export type TTweenSource = { | ||
x: number; | ||
y: number; | ||
z: number; | ||
rotationX: number; | ||
rotationY: number; | ||
rotationZ: number; | ||
scaleX: number; | ||
scaleY: number; | ||
scaleZ: number; | ||
}; | ||
export type TTweenType = Tween<TTweenSource>; | ||
export type TEventMap = { | ||
update: { | ||
source: TTweenSource; | ||
tween: TTweenType; | ||
}; | ||
start: { | ||
tween: TTweenType; | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "umanager-animation-parser", | ||
"description": "动画解析", | ||
"version": "0.0.6", | ||
"type": "module", | ||
"module": "./dist/index.js", | ||
"main": "./dist/index.js", | ||
"types": "./dist/types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"types": "./dist/types/index.d.ts" | ||
} | ||
}, | ||
"scripts": { | ||
"build": "rollup -c rollup.config.js" | ||
}, | ||
"peerDependencies": { | ||
"soonspacejs": ">=2.11.x", | ||
"three": ">=0.169.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^16.0.0", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^12.1.2", | ||
"@types/three": "^0.170.0", | ||
"rollup": "^4.28.1", | ||
"tslib": "^2.8.1", | ||
"typescript": "^5.7.2" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import terser from '@rollup/plugin-terser'; | ||
|
||
export default { | ||
input: './src/index.ts', | ||
output: { | ||
dir: './dist', | ||
format: 'es', | ||
}, | ||
external: ['three', 'soonspacejs'], | ||
plugins: [ | ||
nodeResolve(), | ||
typescript({ | ||
tsconfig: './tsconfig.json', | ||
}), | ||
terser(), | ||
], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"moduleResolution": "bundler", | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "./dist/types" | ||
} | ||
} |
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
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
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
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
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
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
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
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