Glitch Video
How do I make an glitch video?
What is a glitch video? How do you make a glitch video? This script and codes were developed by Uriuriuriu on 10 January 2023, Tuesday.
Glitch Video - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Glitch Video</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="myCanvas" width="854px" height="480px"></canvas>
<br>synced canvas & glitch <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Glitch Video - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Economica);
body { text-align: center; padding: 20px; background-color: #3498db; font-family: 'Economica', sans-serif; color: #FFF; font-size: 30px;
}
#myVideo,
#myCanvas { border: solid 10px #FFF;
}
#myCanvas { background-color: #000;
}
Glitch Video - Script Codes JS Codes
$(function(){ /* :glitchBoy */ function glitchBoy(canvas, options){ this.canvas = canvas; this.ctx = canvas.getContext('2d'); this.origCanvas = document.createElement('canvas'); this.origContext = this.origCanvas.getContext('2d'); this.width = canvas.width; this.height = canvas.height; this.options = options; } glitchBoy.prototype.drawImage = function(img, x, y){ this.canvas.getContext("2d").drawImage(img, x, y); }; glitchBoy.prototype.glitchWave = function(renderLineHeight, cuttingHeight){ var image = this.ctx.getImageData(0, renderLineHeight, this.width, cuttingHeight); this.ctx.putImageData(image, 0, renderLineHeight - 10); }; glitchBoy.prototype.glitchSlip = function(waveStrength, startHeight, endHeight){ if(endHeight < startHeight){ var temp = endHeight; endHeight = startHeight; startHeight = temp; } for(var h = startHeight; h < endHeight; h++){ if(Math.random() < 0.1)h++; var image = this.ctx.getImageData(0, h, this.width, 1); this.ctx.putImageData(image, Math.random()*waveStrength-(waveStrength/2), h); } }; glitchBoy.prototype.glitchFillRandom = function(fillCnt, cuttingMaxHeight){ var cw = this.width; var ch = this.height; for(var i = 0; i< fillCnt; i++){ var rndX = cw * Math.random(); var rndY = ch * Math.random(); var rndW = cw * Math.random(); var rndH = cuttingMaxHeight * Math.random(); var image = this.ctx.getImageData(rndX,rndY,rndW, rndH); this.ctx.putImageData(image, (rndX* Math.random())%cw, rndY); } } glitchBoy.prototype.process = function () { } /* :videoGirl */ function videoGirl(options, callback){ var options = $.extend({ src:"", type:'video/ogg', controls:false, autoplay:true, loop:true, muted:true }, options); var video = document.createElement('video'); video.crossOrigin = 'anonymous'; // important!!!! video.controls = options.controls; video.autoplay = options.autoplay; video.loop = options.loop; video.muted = options.muted; var source = document.createElement('source'); source.src = options.src; source.type = options.type; video.appendChild(source); this.video = video; this.source = source; //video.play(); // load if(callback !== null){ video.addEventListener('loadeddata', callback); } }; // sync var FPS = 30; var frm = 0; var vGirl = new videoGirl({ src:'http://upload.wikimedia.org/wikipedia/commons/b/b1/Big_buck_bunny_zoom_in.ogv', type:'video/ogg' }, sync); function sync(){ var canvas = document.getElementById("myCanvas"); var glitch = new glitchBoy(canvas); setInterval(function(){ frm++; glitch.drawImage(vGirl.video, 0, 0); glitch.glitchWave((frm * 3) % glitch.height, 10); if(frm %100 < 10){ // fillCnt, cuttingMaxHeight glitch.glitchFillRandom(5, 20); } if(80 < frm%100){ glitch.glitchSlip(10,200,300); } if(95 < frm%100){ glitch.glitchSlip(10,100* Math.random(),400 * Math.random()); } }, 1000/FPS); }
});
Developer | Uriuriuriu |
Username | uriuriuriu |
Uploaded | January 10, 2023 |
Rating | 4.5 |
Size | 3,178 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Masonry | 5,005 Kb |
Enchant.js sample | 3,131 Kb |
Three.js ver.1 rotate camera | 2,769 Kb |
AngularJS - first step - | 3,009 Kb |
Css action sideBar | 3,928 Kb |
ClickPanel | 3,068 Kb |
TV effect | 3,293 Kb |
Canvas Gaussian Blur | 3,439 Kb |
Css background animation | 2,854 Kb |
Simple genetic algorithm | 10,179 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Ball physics | Blackkbot | 3,874 Kb |
Hc first draft | Stepfray | 5,104 Kb |
Fluid Grid 12 | Alexoliverwd | 2,309 Kb |
Electric worm | Jeffibacache | 2,377 Kb |
Box Shadow Effects | Retrofuturistic | 2,143 Kb |
Portfolio Layout Flex | Lahvjal | 3,489 Kb |
Mapbox Directions with geolocation tracking | Pollardld | 5,827 Kb |
Working around OS X Dynamic Scrollbars | Jrjenk | 2,279 Kb |
Header Line Issue | Charlie-volpe | 1,768 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!