Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90545c6

Browse files
committed
fix(soba): clean up animations
1 parent 451aa0b commit 90545c6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libs/soba/misc/src/animations/animations.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ export function injectNgtsAnimations(
1212
}: { ref?: NgtRef<THREE.Object3D>; playFirstClip?: boolean; injector?: Injector } = {},
1313
) {
1414
injector = assertInjector(injectNgtsAnimations, injector);
15+
16+
const mixer = new THREE.AnimationMixer(null!);
17+
const actions = {} as Record<string, THREE.AnimationAction>;
18+
let cached = {} as Record<string, THREE.AnimationAction>;
19+
let object: THREE.Object3D | null = null;
20+
const names = [] as string[];
21+
const clips = [] as THREE.AnimationClip[];
22+
1523
return runInInjectionContext(injector, () => {
1624
let actualRef = injectNgtRef<THREE.Object3D>();
1725

@@ -23,14 +31,6 @@ export function injectNgtsAnimations(
2331
}
2432
}
2533

26-
const mixer = new THREE.AnimationMixer(null!);
27-
const actions = {} as Record<string, THREE.AnimationAction>;
28-
let cached = {} as Record<string, THREE.AnimationAction>;
29-
let object: THREE.Object3D | null = null;
30-
31-
const clips = [] as THREE.AnimationClip[];
32-
const names = [] as string[];
33-
3434
injectBeforeRender(({ delta }) => mixer.update(delta));
3535

3636
const ready = computed(() => !!actualRef.nativeElement && !!animationsFactory().length);

0 commit comments

Comments
 (0)