This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.esc.js
82 lines (72 loc) · 2 KB
/
index.esc.js
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Previous Demo Components
import * as game from "../3-game-development/controlled.esc.js"
// New Demo Components
import * as average from "./components/average.esc.js"
import * as threshold from "./components/threshold.esc.js"
// External Components
import * as devices from 'https://cdn.jsdelivr.net/npm/escode-device@0.0.3'
import * as timeseries from 'https://cdn.jsdelivr.net/npm/escode-plot-timeseries@0.0.4'
export const __compose = game
export const __attributes = { style: { position: 'relative' } }
export const __listeners = {
'player.jump': {
threshold: true
},
threshold: 'average',
average: {
'devices.output': {
__format: (o) => {
const res = o[0]
if (!res) return
else return [res] // First channel only
}
}
},
['timeseries.plot']: 'devices.output',
}
export const __children = {
// ---------- Blink Detector ----------
average: {
maxBufferSize: 20,
buffer: [],
__compose: average,
},
threshold: {
value: 100,
__compose: threshold,
},
// ---------- Device Connection ----------
devices,
timeseries: {
__compose: timeseries,
__attributes: {
style: {
position: "absolute",
bottom: "15px",
right: "15px",
width: "250px",
height: "150px",
zIndex: 1,
}
},
// Style the Internal Canvases
__children: {
signalCanvas: {
__attributes: {
style: {
width: '100%',
height: '150px'
}
},
},
overlayCanvas: {
__attributes: {
style: {
width: '100%',
height: '150px'
}
},
},
},
},
}