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