2026-10-20 18:41:01 +13:00
|
|
|
import { invalidate, useFrame } from "@react-three/fiber";
|
2026-11-30 22:42:12 -06:00
|
|
|
import { sceneChangeEvent } from "../core/three/sceneChange";
|
2026-10-20 18:41:01 +13:00
|
|
|
import type { Skin } from "./useSkin";
|
|
|
|
|
|
2026-10-31 22:15:57 +13:00
|
|
|
export function useSkinAnimation(skins: Skin[]) {
|
|
|
|
|
useFrame((_, delta) => {
|
|
|
|
|
for (const { mixer } of skins) {
|
|
|
|
|
if (!mixer) continue;
|
2026-10-20 18:41:01 +13:00
|
|
|
|
2026-10-31 22:15:57 +13:00
|
|
|
mixer.update(delta);
|
2026-10-20 18:41:01 +13:00
|
|
|
invalidate();
|
2026-11-30 22:42:12 -06:00
|
|
|
sceneChangeEvent.dispatch();
|
2026-10-20 18:41:01 +13:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|