forked from tbenst/eye-candy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.html
217 lines (184 loc) · 5.65 KB
/
examples.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!doctype html>
<html>
<body>
<xmp>
------------------------------------------------------------
const metadata = {name: "letters", version: "0.1.0", inverted: false}
let repetitions = 12
let sizes = [200,400,600]
let durations = [60,120,180]
function* measureIntegrity(stimuli,every=5*60) {
// every N seconds, do a flash
let integrityMeta
let elapsedTime = every
for (let s of stimuli) {
if (elapsedTime>=every && s.metadata.block===undefined) {
integrityMeta = {group: r.uuid(), label: "integrity"}
yield new Wait(120, integrityMeta)
yield new Solid(60, "white", integrityMeta)
yield new Wait(240, integrityMeta)
elapsedTime = 0
yield s
} else {
yield s
}
elapsedTime=elapsedTime+s["lifespan"]/120
}
}
let letters = ["C", "D", "H", "K", "N", "O", "R", "S", "V", "Z"]
let x
let y
let stimuli = []
let l
let before
let after
let id
let cohort
for (let i = 0; i < repetitions; i++) {
for (let size of sizes) {
for (let duration of durations) {
cohort = r.uuid(i)
for (let letter of letters) {
id = r.uuid(i)
// block means "do not insert a integrity check before me"
// backgroundColor, letter, x, y, size, color
x = windowWidth/2 - size/2
y = windowHeight/2 + size/2
l = new Letter(duration, "black", letter,x,y,size,
"white", {group: id, cohort: cohort, block: true})
before = new Wait(r.randi(60,120), {group: id})
after = new Wait(r.randi(60,120), {group: id, block: true})
// before + lit + after = lifespan
// this pads the white flash
stimuli.push([before, l, after])
}
}
}
}
r.shuffle(stimuli)
let stimulusGenerator = measureIntegrity(flatten(stimuli))
for (let s of stimulusGenerator) {
yield s
}
const metadata = {name: "letters", version: "0.1.0", inverted: true}
let repetitions = 12
let sizes = [200,400,600]
let durations = [60,120,180]
function* measureIntegrity(stimuli,every=5*60) {
// every N seconds, do a flash
let integrityMeta
let elapsedTime = every
for (let s of stimuli) {
if (elapsedTime>=every && s.metadata.block===undefined) {
integrityMeta = {group: r.uuid(), label: "integrity"}
yield new Solid(120, "white",integrityMeta)
yield new Solid(60, "black", integrityMeta)
yield new Solid(240, "white",integrityMeta)
elapsedTime = 0
yield s
} else {
yield s
}
elapsedTime=elapsedTime+s["lifespan"]/120
}
}
let letters = ["C", "D", "H", "K", "N", "O", "R", "S", "V", "Z"]
let x
let y
let stimuli = []
let l
let before
let after
let id
let cohort
for (let i = 0; i < repetitions; i++) {
for (let size of sizes) {
for (let duration of durations) {
cohort = r.uuid(i)
for (let letter of letters) {
id = r.uuid(i)
// block means "do not insert a integrity check before me"
// backgroundColor, letter, x, y, size, color
x = windowWidth/2 - size/2
y = windowHeight/2 + size/2
l = new Letter(duration, "white", letter,x,y,size,
"black", {group: id, cohort: cohort, block: true})
before = new Solid(r.randi(60,120), "white" {group: id})
after = new Solid(r.randi(60,120), "white" {group: id, block: true})
// before + lit + after = lifespan
// this pads the white flash
stimuli.push([before, l, after])
}
}
}
}
r.shuffle(stimuli)
let stimulusGenerator = measureIntegrity(flatten(stimuli))
for (let s of stimulusGenerator) {
yield s
}
------------------------------------------------------------
const metadata = {name: "acuity", version: "0.3.2"}
function* measureIntegrity(stimuli,every=5*60) {
// every N seconds, do a flash
let integrityMeta
let elapsedTime = every
for (let s of stimuli) {
if (elapsedTime>=every && s.metadata.block===undefined) {
integrityMeta = {group: r.uuid(), label: "integrity"}
yield new Wait(120, integrityMeta)
yield new Solid(60, "white", integrityMeta)
yield new Wait(240, integrityMeta)
elapsedTime = 0
yield s
} else {
yield s
}
elapsedTime=elapsedTime+s["lifespan"]/120
}
}
let widths = [...Array(12).keys()].map(x => (x+1)*10)
let speeds = [...Array(8).keys()].map(x => (1+x)*100)
// 12 angles, offset by 22 degrees to reduce diamond artifact
let angles = [...Array(12).keys()].map(x => (x*2+1)*PI/12)
let stimuli = []
let width
let lit
let lifespan
let group = Array(3)
let id
let before
let after
let solid
for (let speed of speeds) {
for (let width of widths) {
lifespan = calcBarLifespan(speed,width,windowHeight,windowWidth)
id = r.uuid()
for (let angle of angles) {
stimuli.push(new Bar(lifespan,"black",
speed, width, angle, "white", {group: id}))
}
// block means "do not insert a integrity check before me"
lit = ceil(width/speed*120)
solid = new Solid(lit, "white", {group: id, block: true})
before = new Wait(floor((lifespan-lit)/2), {group: id})
after = new Wait(ceil((lifespan-lit)/2), {group: id, block: true})
// before + lit + after = lifespan
// this pads the white flash
stimuli.push([before, solid, after])
}
}
r.shuffle(stimuli)
let stimulusGenerator = measureIntegrity(flatten(stimuli))
for (let s of stimulusGenerator) {
yield s
}
------------------------------------------------------------
// BELOW THIS IS NOT FINISHED
---
// BELOW THIS IS NOT FINISHED
---
// BELOW THIS IS NOT FINISHED
</xmp>
</body>
</html>