mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-09 19:41:32 +00:00
fixed track clip.
This commit is contained in:
1 parent
ebb8741330
commit
9316e45cc1
1 file changed
+18
-12
@@ -1,27 +1,23 @@
|
||||
export interface Vector3 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
import * as THREE from 'three';
|
||||
|
||||
export interface TransformTrackClip {
|
||||
version: number;
|
||||
media_id: number;
|
||||
type: "transform";
|
||||
position: Vector3[];
|
||||
rotation: Vector3[];
|
||||
scale: Vector3[];
|
||||
position: THREE.Vector3[];
|
||||
rotation: THREE.Vector3[];
|
||||
scale: THREE.Vector3[];
|
||||
}
|
||||
|
||||
export class TransformTrackClipClass implements TransformTrackClip {
|
||||
version: number;
|
||||
media_id: number;
|
||||
type: "transform";
|
||||
position: Vector3[];
|
||||
rotation: Vector3[];
|
||||
scale: Vector3[];
|
||||
position: THREE.Vector3[];
|
||||
rotation: THREE.Vector3[];
|
||||
scale: THREE.Vector3[];
|
||||
|
||||
constructor(version: number, media_id: number, position: Vector3[], rotation: Vector3[], scale: Vector3[]) {
|
||||
constructor(version: number, media_id: number, position: THREE.Vector3[], rotation: THREE.Vector3[], scale: THREE.Vector3[]) {
|
||||
this.version = version;
|
||||
this.media_id = media_id;
|
||||
this.type = "transform";
|
||||
@@ -29,6 +25,16 @@ export class TransformTrackClipClass implements TransformTrackClip {
|
||||
this.rotation = rotation;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
add_position(position: THREE.Vector3) {
|
||||
this.position.push(position);
|
||||
}
|
||||
|
||||
remove_position(position: THREE.Vector3) {
|
||||
this.position = this.position.filter(position => {
|
||||
return !position.equals(position);
|
||||
});
|
||||
}
|
||||
|
||||
toJSON(): string {
|
||||
return JSON.stringify({
|
||||
|
||||
Reference in new issue
Block a user