mirror of
https://github.com/FMS-Cat/condition.git
synced 2025-08-16 18:44:01 +02:00
fix: trivial, tweak time stuff
This commit is contained in:
@@ -106,9 +106,9 @@ export class Music {
|
||||
const { audio, isPlaying } = this;
|
||||
|
||||
const genTime = audio.currentTime;
|
||||
this.deltaTime = genTime - this.__prevAudioTime;
|
||||
|
||||
if ( isPlaying ) {
|
||||
this.deltaTime = genTime - this.__prevAudioTime;
|
||||
this.time += this.deltaTime;
|
||||
|
||||
const buffer = this.__bufferPool.next();
|
||||
@@ -125,6 +125,8 @@ export class Music {
|
||||
bufferSource.start( audio.currentTime, audio.currentTime - genTime );
|
||||
this.__prevBufferSource = bufferSource;
|
||||
} else {
|
||||
this.deltaTime = 0.0;
|
||||
|
||||
this.__prevBufferSource?.stop( audio.currentTime );
|
||||
this.__prevBufferSource = null;
|
||||
}
|
||||
|
@@ -17,13 +17,15 @@ export class Cube {
|
||||
public constructor() {
|
||||
this.entity = new Entity();
|
||||
|
||||
this.entity.transform.rotation = Quaternion.fromAxisAngle(
|
||||
const rot0 = Quaternion.fromAxisAngle(
|
||||
new Vector3( [ 1.0, 0.0, 0.0 ] ),
|
||||
0.4,
|
||||
).multiply( Quaternion.fromAxisAngle(
|
||||
new Vector3( [ 0.0, 0.0, 1.0 ] ),
|
||||
0.4,
|
||||
) );
|
||||
|
||||
this.entity.transform.rotation = rot0;
|
||||
this.entity.transform.scale = this.entity.transform.scale.scale( 0.8 );
|
||||
|
||||
this.geometry = this.__createGeometry();
|
||||
@@ -37,9 +39,9 @@ export class Cube {
|
||||
this.entity.components.push( this.mesh );
|
||||
|
||||
this.entity.components.push( new Lambda( {
|
||||
onUpdate: ( { deltaTime } ) => {
|
||||
this.entity.transform.rotation = this.entity.transform.rotation.multiply(
|
||||
Quaternion.fromAxisAngle( new Vector3( [ 0.0, 1.0, 0.0 ] ), deltaTime )
|
||||
onUpdate: ( { time } ) => {
|
||||
this.entity.transform.rotation = rot0.multiply(
|
||||
Quaternion.fromAxisAngle( new Vector3( [ 0.0, 1.0, 0.0 ] ), time )
|
||||
);
|
||||
},
|
||||
visible: false,
|
||||
|
Reference in New Issue
Block a user