-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaframe-spflat2particlecount-component.js
More file actions
55 lines (47 loc) · 1.55 KB
/
aframe-spflat2particlecount-component.js
File metadata and controls
55 lines (47 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
AFRAME.registerComponent('spflat2particlecount', {
schema: {
propertyAssignedToSpectralCentroid: {
type: 'string',
default: 'particleCount'
},
BaseValue: {
type: 'int',
default: 0
},
ScaleFactor: {
type: 'int',
default: 20
}
},
init: function() {
// Closure to access fresh `this.data` from event handler context.
var self = this;
// this.features = document.querySelectorAll('[meyda]')[0].components.meyda.features || {};
},
update: function() {
},
tick: function() {
let features = document.querySelectorAll('[meyda]')[0].components.meyda.features || {};
// console.log(features.spectralFlatness);
// this.el.setAttribute("radius",features.spectralCentroid/20)
// this.el.setAttribute("radius",features.spectralCentroid/20)
// this.el.setAttribute("radius",features.spectralCentroid/20)
// this.el.setAttribute("maxAge",features.spectralFlatness * 10)
// this.el.setAttribute("maxParticleCount",features.spectralFlatness * 10)
// this.el.setAttribute(this.data.propertyAssignedToSpectralCentroid, features.spectralFlatness * 10000)
if (Math.random() > .9) {
// console.log(features.spectralFlatness);
// console.log(this.features.spectralFlatness);
this.el.setAttribute('particle-system', {
particleCount: features.spectralFlatness * 100000
// preset: snow;
// particleCount: this.features.spectralFlatness * 100000
});
}
}
});
// console.log(this.data)
// console.log(features)
//
// }
// });