Advertisement
Guest User

220610 0232 Hydra scene selector

a guest
Jun 9th, 2022
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. // licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
  2. // 220610 0232 Hydra scene selector (backup)
  3. // Hydra sketches created by Relaxnow
  4. // linktr.ee/relaxnow
  5. //
  6. // Setup
  7. //// Open https://hydra.ojack.xyz/ in Chrome browser
  8. //// Paste code
  9. //// F11 = fullscreen in Chrome
  10. //// CTRL+SHIFT+ENTER = run all code or press PLAY
  11. //// CTRL+SHIFT+H = hide/show code
  12. //
  13. //
  14. // Scene selector (video mixer)
  15. //
  16. my_source = 1 //1-4
  17. // 1 images 1 & 2
  18. // 2 images 3 & 4
  19. // 3 webcam + image
  20. // 4 image + webcam
  21. scene = 1 //1-10
  22. // 0 clear screen
  23. // 1-10
  24. //
  25. //
  26. //
  27. //
  28. //
  29. //
  30. //
  31. //
  32. //
  33. //
  34. //
  35. //
  36. //
  37. //
  38. //
  39. //
  40. //
  41. //
  42. //
  43. //
  44. //
  45. //
  46. //
  47. //
  48. //
  49. //
  50. //
  51. //
  52. //
  53. ////random scene and source between 1-10 (picks a new number on each RUN)
  54. //scene=Math.floor(Math.random() * 10) + 1 //uncomment to use
  55. //my_source=Math.floor(Math.random() * 3) + 1 //uncomment to use
  56. //
  57. //// To do: timed counter on scene's play 1, 1 min, play 2, 1 min ...
  58. //// To do : Pick random scen based on: manual, random, timed, time, audioreactivity
  59. //
  60. // Images used in scene 1-10
  61. if (my_source === 1) {
  62. s0.initImage("https://thrips.info/w/media/thumb/9/92/Stomatoangfull_cleaned.jpg/800px-Stomatoangfull_cleaned.jpg")
  63. s1.initImage("https://upload.wikimedia.org/wikipedia/commons/a/a6/Meat_eater_ant_feeding_on_honey02.jpg")
  64. }
  65. if (my_source === 2) {
  66. s0.initImage("https://upload.wikimedia.org/wikipedia/commons/8/8f/Scatophaga_stercoraria_macro_Luc_Viatour.jpg")
  67. s1.initImage("https://upload.wikimedia.org/wikipedia/commons/3/3c/Formica_polyctena_2.jpg")
  68. }
  69. if (my_source === 3) {
  70. s0.initCam()
  71. s1.initImage("https://upload.wikimedia.org/wikipedia/commons/3/3c/Formica_polyctena_2.jpg")
  72. }
  73. if (my_source === 4) {
  74. s0.initImage("https://upload.wikimedia.org/wikipedia/commons/3/3c/Formica_polyctena_2.jpg")
  75. s1.initCam()
  76. }
  77. //
  78. //
  79. // scene 0
  80. if (scene === 0) {
  81. hush() // clear screen
  82. }
  83. //
  84. //
  85. // scene 1
  86. if (scene === 1) {
  87. src(s1)
  88. .luma(() => (0.8 * Math.sin(time * 0.2)))
  89. .scrollX(0,0.025)
  90. .modulate(voronoi(4,0.2,1).blend(osc(4)))
  91. .modulate(voronoi(4,0.2,1).blend(osc(4)))
  92. .diff(src(s0),0.2)
  93. .mult(shape(99,2))
  94. .scale(1,9/16).out()
  95. }
  96. //
  97. //
  98. // scene 2
  99. if (scene === 2) {
  100. src(s1)
  101. .rotate(0,0.1)
  102. .diff(src(s0),0.2)
  103. .scale(2,9/16).out()
  104. }
  105. //
  106. //
  107. // scene 3
  108. if (scene === 3) {
  109. src(s1)
  110. .rotate(0,0.1)
  111. .modulate(voronoi(4).scale(.2))
  112. .diff(src(s0),0.2)
  113. .scale(2,9/16).out()
  114. }
  115. //
  116. // scene 4
  117. if (scene === 4) {
  118. src(s1)
  119. .rotate(0,0.1)
  120. .diff(src(s0),0.2)
  121. .diff(voronoi(4,0.01,0.1))
  122. .scale(2,9/16).out()
  123. }
  124. //
  125. // scene 5
  126. if (scene === 5) {
  127. src(s1)
  128. .rotate(0,0.1)
  129. .diff(src(s0),0.2)
  130. .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  131. .diff(voronoi(4,0.01,0.1))
  132. .scale(2,9/16).out()
  133. }
  134. //
  135. // scene 6
  136. if (scene === 6) {
  137. src(s1)
  138. .rotate(0,0.03)
  139. .diff(src(s0),0.2)
  140. .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  141. .scrollX(0,0.01)
  142. .scale(2,9/16).out()
  143. }
  144. //
  145. //
  146. // scene 7
  147. if (scene === 7) {
  148. src(s1)
  149. .rotate(0,0.03)
  150. .scale(1,function(){return 20 * Math.tan(time *0.01)})
  151. .diff(src(s0),0.2)
  152. .luma(0.2)
  153. .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  154. .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  155. .scrollX(0,-0.01)
  156. .scale(2,9/16).out()
  157. }
  158. //
  159. //
  160. // scene 8
  161. if (scene === 8) {
  162. src(s1)
  163. .rotate(0,0.03)
  164. .diff(src(s0),0.2)
  165. .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  166. .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  167. .scrollX(0,-0.01)
  168. .mult(voronoi(20,1,100),0.1)
  169. .scale(2,9/16).out()
  170. }
  171. //
  172. // scene 9
  173. if (scene === 9) {
  174. src(s1)
  175. .rotate(0,0.03)
  176. .diff(src(s0),0.2)
  177. .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  178. .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  179. .scrollX(0,-0.01)
  180. .mult(voronoi(20,1,100),0.1)
  181. .pixelate(1000,2)
  182. .scale(2,9/16).out()
  183. }
  184. //
  185. // scene 10
  186. if (scene === 10) {
  187. src(s1)
  188. .rotate(0,0.03)
  189. .scale(1,function(){return 20 * Math.tan(time *0.01)})
  190. .diff(src(s0),0.2)
  191. .luma(0.2)
  192. .modulate(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  193. .diff(src(s1).rotate(1,-0.02).scale(0.5),0.2)
  194. .scrollX(0,-0.01)
  195. .blend(voronoi(10,1,20),0.08)
  196. .scale(2,9/16).out()
  197. }
  198. //
  199.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement