-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtestGlitchingFunction.js
More file actions
30 lines (29 loc) · 890 Bytes
/
Copy pathtestGlitchingFunction.js
File metadata and controls
30 lines (29 loc) · 890 Bytes
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
module.exports = function (g) {
while (g.hasNextFrame()) {
let frame = g.nextFrame();
const r = 5;
if (frame.mv.forward) {
// const h = frame.mv.forward.length;
// const w = frame.mv.forward[1].length;
// for (let i = 0; i < h; i++){
// for (let j = 0; j < w; j++) {
// if ((j - w/2)* (j - w/2) + (i - h/2) * (i - h/2) - (r*r) < 0) {
// frame.mv.forward[i][j][0] = 0;
// frame.mv.forward[i][j][1] = -10;
// }
// }
// }
var i = 0;
frame.mv.forward.forEach(vectorArray => {
var j = 0;
vectorArray.forEach(vector => {
vector[0] = (Math.random() * vector[0] * Math.sin(i)).toFixed(5);
vector[1] = (Math.random() * vector[1] * Math.sin(j)).toFixed(5);
j++;
});
i++;
});
g.saveFrame(frame);
}
}
}