Repository navigation
Expand file tree
/
Copy pathtest1.js
More file actions
56 lines (42 loc) · 1.42 KB
/
Copy pathtest1.js
File metadata and controls
56 lines (42 loc) · 1.42 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
56
script.addFloatParameter("Position", "The position of the point", 0.5, 0, 1);
var accel = root.props.flowtoysCreatorClub.imu.accel;
var orientation = root.props.flowtoysCreatorClub.imu.orientation;
var projectAngle = root.props.flowtoysCreatorClub.imu.projectedAngle;
// root.props.flowtoysCreatorClub2.imu.projectedAngle
// script.log(typeof root.props.flowtoysCreatorClub.imu.accel);
// script.log(JSON.stringify(accel));
// script.log(accel.get()[0]);
// var abc = "hello" + accel;
// // for (var i = 0; i < Object.keys(accel).length; i++) {
// // script.log(i);
// // }
// script.log(abc);
// // const ( x, y, z ) = root.props.flowtoysCreatorClub.imu.accel;
// script.log(x);
var counter = 0;
function updateColors(colours, id, resolution, time, params) {
script.log(projectAngle);
for (var i = 0; i < resolution; i++) {
if (projectAngle.get() > 0.98 || projectAngle.get() < 0.02) {
counter = counter + 1;
if (counter > 1200) {
colours.set(i, 0, i / 32, 1 - i / 32);
} else {
colours.set(i, 1, 0, 0);
}
} else if (projectAngle.get() > 0.5) {
counter = 0;
colours.set(i, 1, 0, 0);
} else {
counter = 0;
colours.set(i, 0, 0, 1);
}
}
// colours.set(
// i,
// Math.abs(orientation.get()[2] - 90) / 90,
// Math.abs(orientation.get()[0] - 90) / 90,
// Math.abs(orientation.get()[1] - 90) / 90
// );
// }
}