content/hifi-content/elisalj/music_visualizer/outdated_scripts/effectAdjuster.js
2022-02-13 23:16:46 +01:00

36 lines
No EOL
894 B
JavaScript

///
/// effectAdjuster.js
/// An entity script to track audio changes in a particle effect
///
/// Author: Elisa Lupin-Jimenez
/// Copyright High Fidelity 2017
///
/// Licensed under the Apache 2.0 License
/// See accompanying license file or http://apache.org/
///
/// All assets are under CC Attribution Non-Commerical
/// http://creativecommons.org/licenses/
///
(function() {
print("Script is now attached");
var _this = this;
_this.preload = function(entityID) {
_this.entityID = entityID;
};
Script.setInterval(function() {
var effectProps = Entities.getEntityProperties(_this.entityID);
if (Audio.inputLevel === 0) {
effectProps.particleRadius = 0.25;
} else {
effectProps.particleRadius = (Audio.inputLevel) * 2;
}
Entities.editEntity(_this.entityID, effectProps);
}, 200);
});