Created
May 25, 2019 02:42
-
-
Save khoparzi/5248a14e9d21e9ef20ab5dcf5118fef8 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
// With p5 | |
p = new P5() | |
s0.init({src: p.canvas}) | |
p.hide() | |
img = null; | |
// With beta api | |
url = "http://api.giphy.com/v1/gifs/search?api_key="+giphyApiKey+"&limit=1" | |
makeGif = (giphy) => { | |
if (img != null && img.elt != null) { img.remove() } | |
img = p.createImg(giphy.data[0].images.original.url) | |
img.elt.style.zIndex = -10 // Push back the image element | |
// Connect the canvas to buffer after loading image | |
img.elt.onload = () => { | |
s0.init({src: img.elt}) | |
} | |
} | |
query = "&q=hydration&offset=1" | |
p.loadJSON(url+query, makeGif) | |
p.draw = () => { | |
if (img != null && img.elt != null) | |
img.position(p.random(),0) | |
} | |
src(s0)//.scale(1,1.7,1) | |
.repeat(5).invert(0).luma(0.15) | |
// .scrollX(0.7) | |
// .scrollY(0,0.11) | |
// .scale(0.5) | |
// .kaleid(18) | |
// .rotate(0,1) | |
.out() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment