Created
March 28, 2021 02:27
-
-
Save odedw/0d971dbb453061d3dd522d74120d3901 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
document.addEventListener("DOMContentLoaded", function () { | |
// create a new hydra-synth instance | |
const canvas = document.getElementById("myCanvas"); | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
new window.Hydra({ | |
canvas: canvas, | |
detectAudio: false, | |
}); | |
const button = document.getElementById("myButton"); | |
function hydracode() { | |
canvas.style.display = "block"; | |
button.style.display = "none"; | |
unmute(); | |
osc().out(); | |
s0.initVideo("MollyMP4.mp4"); | |
src(s0) | |
.rotate(0, 0) | |
.repeat() | |
.invert(0, 0) | |
//.saturateHue() | |
.scale(1) | |
//.mult(osc(0,-0.1,0.0)) | |
.color(1, 0.6, -1) | |
.out(); | |
} | |
button.addEventListener("click", hydracode); | |
}); | |
function unmute() { | |
// if video hasn't loaded, try again in 10 miliseconds | |
if (!s0.src) return setTimeout(unmute, 10); | |
// otherwise unmute the video | |
s0.src.muted = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment