@@ -22,6 +22,7 @@ interface PulseMarker {
2222 flashRate: number ;
2323 flashPhase: number ;
2424 lastProgress: number ;
25+ initialized: boolean ;
2526}
2627
2728interface CircuitLine {
@@ -252,9 +253,9 @@ function layoutLetterBlocks(blocks: LetterBlock[]) {
252253 const col = i % BLOCK_COLS ;
253254 const row = Math .floor (i / BLOCK_COLS ) % BLOCK_ROWS ;
254255 const layer = Math .floor (i / (BLOCK_COLS * BLOCK_ROWS ));
255- const x = ( col - ( BLOCK_COLS - 1 ) * 0.5 ) * (BLOCK_SIZE + BLOCK_GAP );
256+ const x = col * (BLOCK_SIZE + BLOCK_GAP );
256257 const y = row * (BLOCK_SIZE + BLOCK_GAP );
257- const z = layer * (BLOCK_SIZE * 0.78 + BLOCK_GAP * 0.6 );
258+ const z = BLOCK_SIZE * 0.56 + layer * (BLOCK_SIZE * 0.78 + BLOCK_GAP * 0.6 );
258259 blocks [i ].group .position .set (x , y , z );
259260 }
260261}
@@ -349,7 +350,7 @@ function createCircuitFlow() {
349350 endpointDirection .normalize ();
350351 }
351352 const blockGroup = new THREE .Group ();
352- blockGroup .position .copy (endpoint ).addScaledVector (endpointDirection , BLOCK_SIZE * 0.65 );
353+ blockGroup .position .copy (endpoint ).addScaledVector (endpointDirection , BLOCK_SIZE * 0.06 );
353354 blockGroup .quaternion .setFromUnitVectors (new THREE .Vector3 (0 , 0 , 1 ), endpointDirection );
354355 group .add (blockGroup );
355356 const hue = rand (0.51 , 0.57 );
@@ -423,6 +424,7 @@ function createCircuitFlow() {
423424 flashRate: rand (5.2 , 13.8 ),
424425 flashPhase: rand (0 , Math .PI * 2 ),
425426 lastProgress: normalizedPhase ,
427+ initialized: false ,
426428 });
427429 }
428430 }
@@ -521,10 +523,15 @@ function animate() {
521523 for (const pulse of circuit .pulses ) {
522524 let progress = (elapsed * linePulseSpeed + pulse .phase ) % 1 ;
523525 if (progress < 0 ) progress += 1 ;
524- const wrappedAtEnd = pulse .lastProgress > 0.74 && progress < 0.26 ;
525- pulse .lastProgress = progress ;
526- if (wrappedAtEnd ) {
527- spawnLetterBlock (circuit , elapsed );
526+ if (! pulse .initialized ) {
527+ pulse .lastProgress = progress ;
528+ pulse .initialized = true ;
529+ } else {
530+ const wrappedAtEnd = pulse .lastProgress > 0.9 && progress < 0.1 ;
531+ pulse .lastProgress = progress ;
532+ if (wrappedAtEnd ) {
533+ spawnLetterBlock (circuit , elapsed );
534+ }
528535 }
529536 if (proximity > 0.58 ) {
530537 const jumpStep = THREE .MathUtils .lerp (0.028 , 0.11 , (proximity - 0.58 ) / 0.42 );
0 commit comments