Extensions for Hydra focusing on usability.
You can load extensions into Hydra with the following syntax:
await loadScript("https://hyper-hydra.glitch.me/hydra-src.js")
await loadScript("https://hyper-hydra.glitch.me/hydra-wrap.js")
osc().out()
Order is merely alphabetical
Write very small hydra code.
o(10, 0.1, 1.2).bl(ns(3)).df(sh(4, 0.6).rt(0, 0.1)).out()
All the functions you needed to make complex visual arithmetics, easily.
osc(10,.1,2)
.mod(gradient().asin().cos())
.step(noise(2).unipolar().div(o0))
.blend(o0,.2)
.out()
Extends the functionality of arrays in Hydra, letting you operate between different arrays and generate new ones.
gradient().diff(o0)
.hue([0,2,3,8].div(10).addWrap([0.2,0.1]).smooth())
.rotate(Array.run(8).mult(Math.PI*2/8))
.add(shape(64,.02)
.scrollX(Array.random(16,-0.4,0.4).smooth())
.scrollY(Array.random(16,-0.4,0.4).smooth()))
.blend(o0,.6)
.out()
bpm = 50
Adds most blending modes you know from raster image softwares. Ideal for compositing.
osc(30)
.screen(noise(3,1).pm())
.linearBurn(gradient(1).hue(.3))
.out()
Let's you easily control Hydra's canvas.
setResolution(256,256)
canvas.setRelativeSize(2)
canvas.setAlign("right")
canvas.setLinear()
solid(1).diff(o0).scale(.5).diff(noise(2,0.4)).out()
All the function you might need to work with color in different colorspaces such as CMYK, HSV, YUV, etc.
gradient().rgb.aSet(0)
.cmyk.from()
.hsv.hOffsetFrom(noise(1,1),.3)
.yuv(1,.5)
.out()
WARNING: doesn't work in atom / pulsar
Adds a .debug()
function that allows you to easily read the fragment shader of your sketch and test changes in real time.
osc().rotate().debug(o0)
Adds some functions that when feedbacked are useful for creating fractals. Thanks to Kali for the idea.
src(o0)
.scale(.75)
.add(noise(2,1),.4)
.invert()
.inversion()
.mirrorX2()
.blend(o0,.3)
.out()
WARNING: doesn't work on instance mode as of now
Let's you load .gif
files into Hydra.
s0.initGif('https://i.giphy.com/media/kZqbBT64ECtjy/giphy.gif')
src(s0)
.out()
Write GLSL code directly in your patches.
glsl('vec4(sin(uv.x*i0+(time*i1*vec3(i2,i2*2.,i2*3.))),1.0)',16,2,.3)
.glslColor('vec4(c0.brg-(sin(c0.b)*i0),1.)',()=>Math.cos(time))
.out()
Create gradients with css colors and use them for gradient mapping.
const myGradient = createGradient("#000", "#0bf", "red", "white");
osc(30,.05).kaleid(720).scale(1,()=>innerHeight/innerWidth)
.lookupX(myGradient)
.out()
Replaces Hydra's standard mouse
object adding useful properties.
noise(1)
.add(shape(64,.01,.2).scrollX(()=>mouse.posx).scrollY(()=>mouse.posy))
.out()
Change the properties of Hydra's outputs' framebuffers. Most importantly: try linear interpolation.
o1.setLinear()
src(o1)
.layer(osc(30,.2,1).mask(shape(4,.1,0)))
.scale(1.01).rotate(.01)
.out(o1)
Adds a function to toggle picture-in-picture. Note that colors might look a bit washed out since this extension uses hydra's canvas' MediaStream.
osc().out()
hydraPictureInPicture() // alias: hydraPip()
Retrieve pixel values from Hydra's outputs.
osc(40,.09,1.5)
.diff(osc(20).luma())
.color(1,1,()=>1+pixel[0]/255)
.out()
update = ()=> {
pixel = o0.read(width/2,height/2) // center of the screen
}
Adds srcAbs
and srcRel
functions. srcAbs
will act as src()
but will show the source with its original width and height on screen. scrRel
will act as src()
but will mantain the source's aspect ratio. Works great with hydra-wrap. There's also srcMask
, srcAbsMask
and srcAbsMark
which will mask out the wrapping.
src(o0)
.scale(1.01)
.colorama(-.02).brightness(-.2)
.blend(o0,.8)
.layer(srcAbs(s0).luma(.4,.1))
.out()
Replicates the swizzling functionality from GLSL.
gradient(1).gbg
.layer(osc(30,.1,2).bggr)
.layer(gradient().r.mask(shape(2)))
.out()
Adds a tap control for bpm and basic envelopes. Inspired by Resolume.
osc(30,.01,beats(1)).out()
osc().rotate(beats_(2).curve(-3)).out()
osc().scale(beats(1).curve(2).range(1,2)).out()
// Ctrl + Space Bar for tapping
// Ctrl + , (Comma) for re-sync
Adds a text generator to Hydra
hydraText.font = "serif"
hydraText.lineWidth = "2%"
str = " hydra_! "
solid(1,.2)
.blend(src(o0).scale(1.02).colorama(.02))
.layer(text(str))
.diff(strokeText(str).modulateScale(noise(1,1), .4))
.out()
Adds wrapper functions that allow you to construct vec4's like you would in GLSL.
noise()
.mult( vec4( vec3(0.5) , 1 ) )
.add( vec4( [0.5,0].smooth() ) )
.layer(
vec4( vec3( [0, 1, 0.5] , vec2( ()=>time%1 ) ) , 1)
.mask(shape(4))
)
.out()
Change how Hydra wraps textures, and control the wrapping of generators.
hydraWrap.setMirror()
src(o0)
.layer(osc().rotate().mask(shape(4,1,0)))
.scale(.5)
.blend(noise(),.2)
.out()
extra-shaders-for-hydra
: another really useful repo of hydra extensions made by Thomas Jourdanhydra-midi
: a super complete midi extension for hydra, made by Arnno Schlipf.hydra-antlia
: my extension of hydra for colors, geometry and interactivity.