mirror of
https://github.com/ad044/lainTSX.git
synced 2024-10-22 23:19:06 +00:00
fixed sprite animation
This commit is contained in:
parent
6e53b78fc7
commit
9d7e17bf8f
3 changed files with 13 additions and 7 deletions
|
@ -203,9 +203,12 @@ const Game = () => {
|
||||||
// only change sprite focus
|
// only change sprite focus
|
||||||
default:
|
default:
|
||||||
setCurrentSprite(move);
|
setCurrentSprite(move);
|
||||||
|
// toggle hud to go back in
|
||||||
updateHUD();
|
updateHUD();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
// change hud while its hidden
|
||||||
setCurrentSpriteHUD((level_sprite_huds as SpriteHuds)[move]);
|
setCurrentSpriteHUD((level_sprite_huds as SpriteHuds)[move]);
|
||||||
|
// toggle it again to be shown in the new position
|
||||||
updateHUD();
|
updateHUD();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ export type HUDElementProps = {
|
||||||
bigHudType: string;
|
bigHudType: string;
|
||||||
|
|
||||||
longHudPosition: PositionAndScaleProps;
|
longHudPosition: PositionAndScaleProps;
|
||||||
longHUDPosX: Interpolation<any, any>;
|
longHUDPosX: Interpolation<number, any>;
|
||||||
longHudScale: PositionAndScaleProps;
|
longHudScale: PositionAndScaleProps;
|
||||||
|
|
||||||
// boringHudPosition: PositionAndScaleProps;
|
// boringHudPosition: PositionAndScaleProps;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useRef } from "react";
|
import React, { useRef, useMemo } from "react";
|
||||||
import { useFrame, useLoader } from "react-three-fiber";
|
import { useFrame, useLoader } from "react-three-fiber";
|
||||||
import * as THREE from "three";
|
import * as THREE from "three";
|
||||||
import copland from "../static/sprites/copland.png";
|
import copland from "../static/sprites/copland.png";
|
||||||
|
@ -44,11 +44,14 @@ const LevelSprite = (props: LevelSpriteConstructorProps) => {
|
||||||
const nonActiveTexture: any = useLoader(THREE.TextureLoader, spriteSheet[0]);
|
const nonActiveTexture: any = useLoader(THREE.TextureLoader, spriteSheet[0]);
|
||||||
const activeTexture: any = useLoader(THREE.TextureLoader, spriteSheet[1]);
|
const activeTexture: any = useLoader(THREE.TextureLoader, spriteSheet[1]);
|
||||||
|
|
||||||
const uniforms = {
|
const uniforms = useMemo(
|
||||||
|
() => ({
|
||||||
tex1: { type: "t", value: nonActiveTexture },
|
tex1: { type: "t", value: nonActiveTexture },
|
||||||
tex2: { type: "t", value: activeTexture },
|
tex2: { type: "t", value: activeTexture },
|
||||||
timeMSeconds: { value: Date.now() },
|
timeMSeconds: { value: Date.now() },
|
||||||
};
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
const vertexShader = `
|
const vertexShader = `
|
||||||
varying vec2 vUv;
|
varying vec2 vUv;
|
||||||
|
|
Loading…
Reference in a new issue