mirror of
https://github.com/Akascape/Datamosher-Pro.git
synced 2025-12-12 03:09:59 +01:00
Add files via upload
This commit is contained in:
29
Python Version/ffglitch/jscripts/Vibrate.js
Normal file
29
Python Version/ffglitch/jscripts/Vibrate.js
Normal file
@@ -0,0 +1,29 @@
|
||||
var randomness = 10;
|
||||
var bias = (randomness/2);
|
||||
function glitch_frame(frame)
|
||||
{
|
||||
// bail out if we have no motion vectors
|
||||
let mvs = frame["mv"];
|
||||
if ( !mvs )
|
||||
return;
|
||||
// bail out if we have no forward motion vectors
|
||||
let fwd_mvs = mvs["forward"];
|
||||
if ( !fwd_mvs )
|
||||
return;
|
||||
|
||||
// clear horizontal element of all motion vectors
|
||||
for ( let i = 0; i < fwd_mvs.length; i++ )
|
||||
{
|
||||
// loop through all rows
|
||||
let row = fwd_mvs[i];
|
||||
for ( let j = 0; j < row.length; j++ )
|
||||
{
|
||||
// loop through all macroblocks
|
||||
let mv = row[j];
|
||||
|
||||
// THIS IS WHERE THE MAGIC HAPPENS
|
||||
mv[0] = mv[0] + (Math.floor((Math.random() * randomness) -bias));
|
||||
mv[1] = mv[1] + (Math.floor((Math.random() * randomness) -bias));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user