mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 13:09:51 +01:00
black background
This commit is contained in:
1 parent
dd83da91ff
commit
f10065887d
1 file changed
+13
-3
@@ -1,3 +1,4 @@
|
|||||||
|
import type { QuicklimeEvent } from "quicklime";
|
||||||
import { Suspense, useEffect, useRef } from "react";
|
import { Suspense, useEffect, useRef } from "react";
|
||||||
import { applyPitchYawLimits } from "../../core/blitz/applyPitchYawLimits";
|
import { applyPitchYawLimits } from "../../core/blitz/applyPitchYawLimits";
|
||||||
import { modelTransformEvent } from "../../core/blitzkit/modelTransform";
|
import { modelTransformEvent } from "../../core/blitzkit/modelTransform";
|
||||||
@@ -14,7 +15,7 @@ import { CanvasAutoClear } from "../CanvasAutoClear";
|
|||||||
import { CanvasControl } from "../CanvasControl";
|
import { CanvasControl } from "../CanvasControl";
|
||||||
import { DynamicArmor } from "../DynamicArmor";
|
import { DynamicArmor } from "../DynamicArmor";
|
||||||
import { InitialCameraAligner } from "../InitialCameraAligner";
|
import { InitialCameraAligner } from "../InitialCameraAligner";
|
||||||
import { Lighting } from "../Lighting";
|
import { Lighting, transitionEvent } from "../Lighting";
|
||||||
import { SceneProps } from "../SceneProps";
|
import { SceneProps } from "../SceneProps";
|
||||||
import { ShotDisplay } from "../ShotDisplay";
|
import { ShotDisplay } from "../ShotDisplay";
|
||||||
import { SmartCanvas } from "../SmartCanvas";
|
import { SmartCanvas } from "../SmartCanvas";
|
||||||
@@ -31,6 +32,7 @@ export function TankopediaSandbox({
|
|||||||
skeleton,
|
skeleton,
|
||||||
thicknessRange,
|
thicknessRange,
|
||||||
}: TankSandboxProps) {
|
}: TankSandboxProps) {
|
||||||
|
const wrapper = useRef<HTMLDivElement>(null);
|
||||||
const canvas = useRef<HTMLCanvasElement>(null);
|
const canvas = useRef<HTMLCanvasElement>(null);
|
||||||
const hasImprovedVerticalStabilizer = useEquipment("protagonist", 122);
|
const hasImprovedVerticalStabilizer = useEquipment("protagonist", 122);
|
||||||
const hasDownImprovedVerticalStabilizer = useEquipment("protagonist", 124);
|
const hasDownImprovedVerticalStabilizer = useEquipment("protagonist", 124);
|
||||||
@@ -104,12 +106,20 @@ export function TankopediaSandbox({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleTransitionEvent(event: QuicklimeEvent<number>) {
|
||||||
|
if (!wrapper.current) return;
|
||||||
|
|
||||||
|
wrapper.current.style.backgroundColor = `rgba(0, 0, 0, ${1 - event.data})`;
|
||||||
|
}
|
||||||
|
|
||||||
poseEvent.on(handlePoseEvent);
|
poseEvent.on(handlePoseEvent);
|
||||||
|
transitionEvent.on(handleTransitionEvent);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
poseEvent.off(handlePoseEvent);
|
poseEvent.off(handlePoseEvent);
|
||||||
|
transitionEvent.off(handleTransitionEvent);
|
||||||
};
|
};
|
||||||
});
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
@@ -138,7 +148,7 @@ export function TankopediaSandbox({
|
|||||||
}, [display]);
|
}, [display]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper} ref={wrapper}>
|
||||||
<SmartCanvas
|
<SmartCanvas
|
||||||
className={styles.canvas}
|
className={styles.canvas}
|
||||||
resize={{ debounce: 0 }}
|
resize={{ debounce: 0 }}
|
||||||
|
|||||||
Reference in new issue
Block a user