mirror of
https://github.com/FMS-Cat/condition.git
synced 2025-08-14 01:33:58 +02:00
feature: screenshake
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -4,6 +4,6 @@ import { MusicRealtime } from '../music/MusicRealtime';
|
|||||||
import { automatonSetupMusic } from './automaton';
|
import { automatonSetupMusic } from './automaton';
|
||||||
|
|
||||||
export const audio = new AudioContext();
|
export const audio = new AudioContext();
|
||||||
// export const music: Music = new MusicRealtime();
|
export const music: Music = new MusicRealtime();
|
||||||
export const music: Music = new MusicOffline();
|
// export const music: Music = new MusicOffline();
|
||||||
automatonSetupMusic( music );
|
automatonSetupMusic( music );
|
||||||
|
27
src/scene.ts
27
src/scene.ts
@@ -269,6 +269,7 @@ camera.components.unshift( new Lambda( {
|
|||||||
const y = auto( 'Camera/pos/y' );
|
const y = auto( 'Camera/pos/y' );
|
||||||
const z = auto( 'Camera/pos/z' );
|
const z = auto( 'Camera/pos/z' );
|
||||||
const roll = auto( 'Camera/roll' );
|
const roll = auto( 'Camera/roll' );
|
||||||
|
const shake = auto( 'Camera/shake' );
|
||||||
|
|
||||||
const st = Math.sin( t );
|
const st = Math.sin( t );
|
||||||
const ct = Math.cos( t );
|
const ct = Math.cos( t );
|
||||||
@@ -282,18 +283,32 @@ camera.components.unshift( new Lambda( {
|
|||||||
|
|
||||||
camera.transform.lookAt(
|
camera.transform.lookAt(
|
||||||
new Vector3( [
|
new Vector3( [
|
||||||
r * ct * sp + wubPosAmp * Math.sin( wubPosTheta ) + x,
|
r * ct * sp + wubPosAmp * Math.sin( wubPosTheta ),
|
||||||
r * st + wubPosAmp * Math.sin( 2.0 + wubPosTheta ) + y,
|
r * st + wubPosAmp * Math.sin( 2.0 + wubPosTheta ),
|
||||||
r * ct * cp + wubPosAmp * Math.sin( 4.0 + wubPosTheta ) + z,
|
r * ct * cp + wubPosAmp * Math.sin( 4.0 + wubPosTheta ),
|
||||||
] ),
|
] ),
|
||||||
new Vector3( [
|
new Vector3( [
|
||||||
wubTarAmp * Math.sin( wubTarTheta ) + x,
|
wubTarAmp * Math.sin( wubTarTheta ),
|
||||||
wubTarAmp * Math.sin( 2.0 + wubTarTheta ) + y,
|
wubTarAmp * Math.sin( 2.0 + wubTarTheta ),
|
||||||
wubTarAmp * Math.sin( 4.0 + wubTarTheta ) + z,
|
wubTarAmp * Math.sin( 4.0 + wubTarTheta ),
|
||||||
] ),
|
] ),
|
||||||
undefined,
|
undefined,
|
||||||
0.02 * Math.sin( 2.74 * time ) + roll,
|
0.02 * Math.sin( 2.74 * time ) + roll,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
camera.transform.position = camera.transform.position.add(
|
||||||
|
new Vector3( [ x, y, z ] )
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( shake > 0.0 ) {
|
||||||
|
camera.transform.position = camera.transform.position.add(
|
||||||
|
new Vector3( [
|
||||||
|
Math.sin( 145.0 * time ),
|
||||||
|
Math.sin( 2.0 + 148.0 * time ),
|
||||||
|
Math.sin( 4.0 + 151.0 * time )
|
||||||
|
] ).scale( shake )
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
name: process.env.DEV && 'main/updateCamera',
|
name: process.env.DEV && 'main/updateCamera',
|
||||||
} ) );
|
} ) );
|
||||||
|
Reference in New Issue
Block a user