Created
February 27, 2023 16:52
-
-
Save flordefuego/2e431dddbac37a94a58b36b2b3168c87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Animated gif with Ted Davis help | |
| await loadScript("https://cdn.jsdelivr.net/npm/p5.glitch@latest/p5.glitch.js") //loads p5glitch library in Hydra | |
| let glitch; | |
| p = new P5() //comment this line after using it once | |
| glitch = new Glitch(p); | |
| img = p.loadImage('https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExYzA0ZmE1ZDNmNTU1NzJkNDg3MWFmZWViZWVkOTk1OTEzMmQ5OWQ4OSZjdD1z/3o6fJ3xFENBRxVFvUc/giphy.gif', function(im) { | |
| }); | |
| glitch.loadType('png'); | |
| glitch.loadQuality(0.01); //define glitch quality | |
| p.imageMode(p.CENTER); | |
| p.frameRate(15) | |
| glitch.pixelate(0.5) | |
| p.draw = () => { | |
| img.setFrame(p.floor(p.frameCount)%img.numFrames()) | |
| p.clear(); | |
| glitch.loadImage(img); | |
| glitch.resetBytes(); | |
| glitch.replaceBytes(100, 104); | |
| glitch.randomBytes(20); | |
| glitch.limitBytes(p.sin(time/2)*0.5+0.4); | |
| glitch.buildImage(); | |
| p.image(glitch.image, p.width/2,p.height/2) | |
| } | |
| p.hide(); | |
| s0.init({src: p.canvas}) | |
| gradient(1).layer(src(s0)).out() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment