11import * as THREE from 'three' ;
22import * as Functions from './functions.js' ;
3- import * as Shaders from './shaders.js' ;
43import * as UI from './ui.js' ;
54import * as Fluid from './fluid.js' ;
65import { PostProcessing , WebGPURenderer } from 'three/webgpu' ;
@@ -192,13 +191,13 @@ if ( WebGL.isWebGL2Available() ) {
192191 }
193192 } ) ;
194193
195- window . addEventListener ( "keydown" , ( e ) => {
196- if ( e . key === " " ) {
197- if ( UI . inProject ) {
198- Fluid . addEmitter ( Fluid . canvas . width / 2 , Fluid . canvas . height / 2 , 20 , 0.2 , { x : 0 , y : 500 } ) ;
199- }
200- }
201- } ) ;
194+ // window.addEventListener("keydown", (e) => {
195+ // if (e.key === " ") {
196+ // if (UI.inProject) {
197+ // Fluid.addEmitter(Fluid.canvas.width / 2, Fluid.canvas.height /2, 20, 0.2, {x: 0, y: 500});
198+ // }
199+ // }
200+ // });
202201
203202 //* =-=-=-=-=-=| GEOMETRY SETUP |=-=-=-=-=-=
204203
@@ -215,8 +214,8 @@ if ( WebGL.isWebGL2Available() ) {
215214 scene . add ( laser ) ;
216215
217216 const fluidTexture = new THREE . CanvasTexture ( document . getElementById ( "fluid-canvas" ) ) ;
218- const planeGeometry = new THREE . PlaneGeometry ( 1 * Fluid . fluid . _aspectRatio , 1 ) ; // adjust size to fit keyboard
219- const planeMaterial = new THREE . MeshBasicMaterial ( { map : fluidTexture , transparent : true , side : THREE . DoubleSide , alphaMap : fluidTexture , } ) ;
217+ const planeGeometry = new THREE . PlaneGeometry ( 0.025 * 52 , 1 / Fluid . fluid . _aspectRatio , 1 ) ; // adjust size to fit keyboard
218+ const planeMaterial = new THREE . MeshBasicMaterial ( { color : globalColor , map : fluidTexture , transparent : true , side : THREE . DoubleSide , alphaMap : fluidTexture , } ) ;
220219 const fluidPlane = new THREE . Mesh ( planeGeometry , planeMaterial ) ;
221220
222221 // position it slightly above the keyboard
@@ -229,6 +228,7 @@ if ( WebGL.isWebGL2Available() ) {
229228 const { note, velocity } = e . detail ;
230229
231230 Functions . lightKeyOn ( note ) ;
231+ Functions . spawnFluid ( note , velocity ) ;
232232
233233 const newnote = Functions . createNote ( note ) ;
234234 activeNotes . push ( newnote ) ;
0 commit comments