forked from lilymatcha/1300-eye-tracking
/
sketch.js
48 lines (38 loc) · 1.22 KB
/
sketch.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
var table;
function preload() {
//table is comma separated value "csv"
//and has a header specifying the columns labels
table = loadTable("PUT YOUR CSV NAME HERE", "csv", "header");
}
//create a global index, and initialize it to 1
index = 1;
function setup() {
//create canvas and load background image
//(make sure that your background image isn't
//too big of a file, as its going to be
//rerendered a lot)
//initialize variables and store the columns in
//them, using the getColumn accessor
//find the max and min epoch times
//so that you can map them into usable
//time intervals
//initialize an list to store the time values
//then map each epoch time value to a reasonable
//range and add them to the list
//Heres a map() example:
//m = map(value, 0, 100, 0, width);
//draw realtimes by calling anonymous function after timeouts -
//note that we have to redraw the entire background image and
//every line each time too because of the way processing
//draw works :'(
for () {
setTimeout(function () {
//redraw the background
//draw every everyline again
//call redraw()
//increment the global index
},
//this is where the timeout goes :)
);
}
}