Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
- // 220610 0232 Hydra scene selector (backup)
- // Hydra sketches created by Relaxnow
- // linktr.ee/relaxnow
- //
- // Setup
- //// Open https://hydra.ojack.xyz/ in Chrome browser
- //// Paste code
- //// F11 = fullscreen in Chrome
- //// CTRL+SHIFT+ENTER = run all code or press PLAY
- //// CTRL+SHIFT+H = hide/show code
- //
- //
- // Scene selector (video mixer)
- //
- my_source = 1 //1-4
- // 1 images 1 & 2
- // 2 images 3 & 4
- // 3 webcam + image
- // 4 image + webcam
- scene = 1 //1-10
- // 0 clear screen
- // 1-10
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- ////random scene and source between 1-10 (picks a new number on each RUN)
- //scene=Math.floor(Math.random() * 10) + 1 //uncomment to use
- //my_source=Math.floor(Math.random() * 3) + 1 //uncomment to use
- //
- //// To do: timed counter on scene's play 1, 1 min, play 2, 1 min ...
- //// To do : Pick random scen based on: manual, random, timed, time, audioreactivity
- //
- // Images used in scene 1-10
- if (my_source === 1) {
- s0.initImage("https://thrips.info/w/media/thumb/9/92/Stomatoangfull_cleaned.jpg/800px-Stomatoangfull_cleaned.jpg")
- s1.initImage("https://upload.wikimedia.org/wikipedia/commons/a/a6/Meat_eater_ant_feeding_on_honey02.jpg")
- }
- if (my_source === 2) {
- s0.initImage("https://upload.wikimedia.org/wikipedia/commons/8/8f/Scatophaga_stercoraria_macro_Luc_Viatour.jpg")
- s1.initImage("https://upload.wikimedia.org/wikipedia/commons/3/3c/Formica_polyctena_2.jpg")
- }
- if (my_source === 3) {
- s0.initCam()
- s1.initImage("https://upload.wikimedia.org/wikipedia/commons/3/3c/Formica_polyctena_2.jpg")
- }
- if (my_source === 4) {
- s0.initImage("https://upload.wikimedia.org/wikipedia/commons/3/3c/Formica_polyctena_2.jpg")
- s1.initCam()
- }
- //
- //
- // scene 0
- if (scene === 0) {
- hush() // clear screen
- }
- //
- //
- // scene 1
- if (scene === 1) {
- src(s1)
- .luma(() => (0.8 * Math.sin(time * 0.2)))
- .scrollX(0,0.025)
- .modulate(voronoi(4,0.2,1).blend(osc(4)))
- .modulate(voronoi(4,0.2,1).blend(osc(4)))
- .diff(src(s0),0.2)
- .mult(shape(99,2))
- .scale(1,9/16).out()
- }
- //
- //
- // scene 2
- if (scene === 2) {
- src(s1)
- .rotate(0,0.1)
- .diff(src(s0),0.2)
- .scale(2,9/16).out()
- }
- //
- //
- // scene 3
- if (scene === 3) {
- src(s1)
- .rotate(0,0.1)
- .modulate(voronoi(4).scale(.2))
- .diff(src(s0),0.2)
- .scale(2,9/16).out()
- }
- //
- // scene 4
- if (scene === 4) {
- src(s1)
- .rotate(0,0.1)
- .diff(src(s0),0.2)
- .diff(voronoi(4,0.01,0.1))
- .scale(2,9/16).out()
- }
- //
- // scene 5
- if (scene === 5) {
- src(s1)
- .rotate(0,0.1)
- .diff(src(s0),0.2)
- .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .diff(voronoi(4,0.01,0.1))
- .scale(2,9/16).out()
- }
- //
- // scene 6
- if (scene === 6) {
- src(s1)
- .rotate(0,0.03)
- .diff(src(s0),0.2)
- .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .scrollX(0,0.01)
- .scale(2,9/16).out()
- }
- //
- //
- // scene 7
- if (scene === 7) {
- src(s1)
- .rotate(0,0.03)
- .scale(1,function(){return 20 * Math.tan(time *0.01)})
- .diff(src(s0),0.2)
- .luma(0.2)
- .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .scrollX(0,-0.01)
- .scale(2,9/16).out()
- }
- //
- //
- // scene 8
- if (scene === 8) {
- src(s1)
- .rotate(0,0.03)
- .diff(src(s0),0.2)
- .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .scrollX(0,-0.01)
- .mult(voronoi(20,1,100),0.1)
- .scale(2,9/16).out()
- }
- //
- // scene 9
- if (scene === 9) {
- src(s1)
- .rotate(0,0.03)
- .diff(src(s0),0.2)
- .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .scrollX(0,-0.01)
- .mult(voronoi(20,1,100),0.1)
- .pixelate(1000,2)
- .scale(2,9/16).out()
- }
- //
- // scene 10
- if (scene === 10) {
- src(s1)
- .rotate(0,0.03)
- .scale(1,function(){return 20 * Math.tan(time *0.01)})
- .diff(src(s0),0.2)
- .luma(0.2)
- .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
- .scrollX(0,-0.01)
- .blend(voronoi(10,1,20),0.08)
- .scale(2,9/16).out()
- }
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement