-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
effect-controls now is an external file
- Loading branch information
Enzo Francesca
committed
Feb 17, 2025
1 parent
42e62d6
commit 329c3bb
Showing
2 changed files
with
48 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import AFRAME from 'aframe'; | ||
AFRAME.registerComponent('effect-controls', { | ||
schema: { | ||
hand: { type: 'string', default: 'left' } | ||
}, | ||
|
||
events: { | ||
pinchstarted: function () { | ||
this.toggleEffect(); | ||
}, | ||
buttondown: function () { | ||
this.toggleEffect(); | ||
} | ||
}, | ||
|
||
init: function () { | ||
// initialize control variable | ||
this.effectOn = true; | ||
|
||
// set the proper controller on the specified hand | ||
this.el.setAttribute('meta-touch-controls', { | ||
hand: this.data.hand | ||
}); | ||
this.el.setAttribute('hand-tracking-controls', { | ||
hand: this.data.hand | ||
}); | ||
}, | ||
|
||
toggleEffect: function () { | ||
// get the scene | ||
var scene = this.el.sceneEl; | ||
|
||
// toggle the effect | ||
if (this.effectOn) { | ||
scene.setAttribute('bloom', { | ||
enabled: false | ||
}); | ||
} else { | ||
scene.setAttribute('bloom', { | ||
enabled: true | ||
}); | ||
} | ||
|
||
// set the control variable | ||
this.effectOn = !this.effectOn; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters