mirror of
https://github.com/ad044/lainTSX.git
synced 2024-10-22 15:09:05 +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
|
||||
default:
|
||||
setCurrentSprite(move);
|
||||
// toggle hud to go back in
|
||||
updateHUD();
|
||||
setTimeout(() => {
|
||||
// change hud while its hidden
|
||||
setCurrentSpriteHUD((level_sprite_huds as SpriteHuds)[move]);
|
||||
// toggle it again to be shown in the new position
|
||||
updateHUD();
|
||||
}, 500);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export type HUDElementProps = {
|
|||
bigHudType: string;
|
||||
|
||||
longHudPosition: PositionAndScaleProps;
|
||||
longHUDPosX: Interpolation<any, any>;
|
||||
longHUDPosX: Interpolation<number, any>;
|
||||
longHudScale: 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 * as THREE from "three";
|
||||
import copland from "../static/sprites/copland.png";
|
||||
|
@ -44,11 +44,14 @@ const LevelSprite = (props: LevelSpriteConstructorProps) => {
|
|||
const nonActiveTexture: any = useLoader(THREE.TextureLoader, spriteSheet[0]);
|
||||
const activeTexture: any = useLoader(THREE.TextureLoader, spriteSheet[1]);
|
||||
|
||||
const uniforms = {
|
||||
tex1: { type: "t", value: nonActiveTexture },
|
||||
tex2: { type: "t", value: activeTexture },
|
||||
timeMSeconds: { value: Date.now() },
|
||||
};
|
||||
const uniforms = useMemo(
|
||||
() => ({
|
||||
tex1: { type: "t", value: nonActiveTexture },
|
||||
tex2: { type: "t", value: activeTexture },
|
||||
timeMSeconds: { value: Date.now() },
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
const vertexShader = `
|
||||
varying vec2 vUv;
|
||||
|
|
Loading…
Reference in a new issue