Glitch animation generator

Developer
Size
2,321 Kb
Views
38,456

How do I make an glitch animation generator?

With bas64 manipulation.. What is a glitch animation generator? How do you make a glitch animation generator? This script and codes were developed by Martin Grand on 11 August 2022, Thursday.

Glitch animation generator Previews

Glitch animation generator - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>glitch animation generator</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ html, body { width:100%; height:100%; padding:0; margin:0; font:16px/20px arial;
}
canvas { max-width:100%;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <label>Image File:</label><br/>
<input type="file" id="imageLoader" name="imageLoader"/><br/>
<canvas id="imageCanvas"></canvas> <script src="js/index.js"></script>
</body>
</html>

Glitch animation generator - Script Codes CSS Codes

html, body { width:100%; height:100%; padding:0; margin:0; font:16px/20px arial;
}
canvas { max-width:100%;
}

Glitch animation generator - Script Codes JS Codes

var imageLoader = document.getElementById('imageLoader'); imageLoader.addEventListener('change', handleImage, false);
var canvas = document.getElementById('imageCanvas');
var ctx = canvas.getContext('2d');
function handleImage(e){ var reader = new FileReader(); reader.onload = function(event){ var img = new Image(); img.onload = function(){ canvas.width = img.width; canvas.height = img.height; ctx.drawImage(img,0,0); requestAnimationFrame(function(){ img.src = createGlitch(event.target.result); }); } img.error = function(){ alert('fail'); } img.src = createGlitch(event.target.result); } reader.readAsDataURL(e.target.files[0]);
}
function createGlitch(input) { var urlParts, separator = ';base64,', what, whatRegexp, end; urlParts = input.split(separator); end = urlParts[1].slice(-10); urlParts[1] = urlParts[1].slice(0, -10); what = urlParts[1].substr(Math.random()*(urlParts[1].length),2); whatRegexp = new RegExp(what.replace('+', '/+'),"g"); urlParts[1] = urlParts[1].replace(what, what.split('').reverse().join('')) + end; return urlParts.join(separator);
}
Glitch animation generator - Script Codes
Glitch animation generator - Script Codes
Home Page Home
Developer Martin Grand
Username martingrand
Uploaded August 11, 2022
Rating 3
Size 2,321 Kb
Views 38,456
Do you need developer help for Glitch animation generator?

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!

Martin Grand (martingrand) Script Codes
Create amazing Facebook ads with AI!

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!