Notifications can now be removed

Added the corresponding method
This commit is contained in:
2024-01-09 22:38:04 +01:00
parent ad02c2e065
commit aff8499005
3 changed files with 12 additions and 4 deletions

View File

@@ -4,11 +4,11 @@
<meta charset="utf-8">
<title>My first three.js app</title>
<style>
body { margin: 0; }
body { margin: 0; overflow: hidden;}
#notification_bar {
position: absolute;
top:0;
top:20px;
right: 0;
height: 80px;

View File

@@ -2,6 +2,7 @@ import * as THREE from 'three';
import * as MathUtils from 'three/src/math/MathUtils.js';
import { createGround } from '../objects/ground.js';
import {loadModel} from './import.js';
import * as Notifications from '../utils/notification.js';
const textureLoader = new THREE.TextureLoader();
@@ -387,7 +388,8 @@ export async function addAssetsOnScene(scene){
linkPlate.scene.position.y = 2;
linkPlate.scene.position.z = 1;
scene.add( linkPlate.scene );
linkPlate.onEnterHitbox = ()=>{console.log('"Hello World !"')};
linkPlate.onEnterHitbox = ()=>{Notifications.showNotification("Hello World !")};
linkPlate.onLeaveHitbox = ()=>{Notifications.hideNotification()};
linkPlates.push(linkPlate);
/* --------------------

View File

@@ -6,3 +6,9 @@ export function showNotification(HTMLText){
width:320
}, 500);
}
export function hideNotification(){
$("#notification_bar").animate({
width:0
}, 500, function(){ $(this).css( 'opacity', 0 ) });
}