Import a 3D Model and automatically assign and export animations
TypeScript
update 3d floor color with theme change
Scott Petrovica8e46b4fbfd8
diff --git a/src/lib/Generators.ts b/src/lib/Generators.tsindex 5c5332f..aa38bca 100644--- a/src/lib/Generators.ts+++ b/src/lib/Generators.ts@@ -146,15 +146,15 @@ export class Generators {return mesh_object}- static create_default_lights (): Array<DirectionalLight | AmbientLight> {- const light_1 = new DirectionalLight(0x777777, 7)+ static create_default_lights (light_strength: number): Array<DirectionalLight | AmbientLight> {+ const light_1 = new DirectionalLight(0x777777, light_strength)light_1.castShadow = truelight_1.position.set(-2, 2, 2)const light_2 = new AmbientLight(0xffffff, 0.3)// backfill light- const backfill_light = new DirectionalLight(0x777777, 3)+ const backfill_light = new DirectionalLight(0x777777, light_strength * 0.5)backfill_light.castShadow = false // one shadow is enoughbackfill_light.position.set(2, 2, -2)diff --git a/src/script.ts b/src/script.tsindex 1572f44..286e278 100644--- a/src/script.ts+++ b/src/script.ts@@ -57,7 +57,7 @@ export class Bootstrap {private readonly clock = new THREE.Clock()- private readonly environment_container: Group = new Group()+ private environment_container: Group = new Group()private readonly eventListeners: EventListenerspublic readonly theme_manager = new ThemeManager()@@ -122,21 +122,25 @@ export class Bootstrap {} // end setup_environment()public regenerate_floor_grid (): void {+ // remove previous setup objects from scene if they existconst setup_container = this.scene.getObjectByName('Setup objects')if (setup_container !== null) {this.scene.remove(setup_container)}// change color of grid based on theme- let grid_color = 0x4496a8- let floor_color = 0x4e4e7a+ let grid_color = 0x4b6368+ let floor_color = 0x2d4353+ let light_strength: number = 12if (this.theme_manager.get_current_theme() === 'light') {- grid_color = 0xcccccc // light theme color- floor_color = 0xeeeeee // light theme color+ grid_color = 0xaaaaaa // light theme color+ floor_color = 0xe3eef0 // light theme color+ light_strength = 12}+ this.environment_container = new Group()this.environment_container.name = 'Setup objects'- this.environment_container.add(...Generators.create_default_lights())+ this.environment_container.add(...Generators.create_default_lights(light_strength))this.environment_container.add(...Generators.create_grid_helper(grid_color, floor_color))this.scene.add(this.environment_container)}diff --git a/src/styles.css b/src/styles.cssindex ede03b5..0f94977 100644--- a/src/styles.css+++ b/src/styles.css@@ -54,7 +54,7 @@ h1, h2, h3, h4, h5, h6, input, button, select {#animation-filter {width: 100%;padding: 0.5rem;- background-color: var(--bg-tertiary);+ background-color: var(--bg-primary);border: none;border-radius: 4px;}