This is an old revision of the document!
Hydra Presentations
Made by: Zoey
introduce Hydra
Hydra is a computer program, most people use a computer program to make the computer work but now we are using a computer program to make photos or animation in Hydra.
Kaleid
Simple Example
Code
osc(25,-0.1,0.5).kaleid(50).out()
Explanation
osc(25,-0.1,0.5) osc(frequency: like how many line in one round, speed, color) .kaleid(50) - The number inside the parentheses is mean how many corners for the shape ,so if i set corners to 3 it will return triangle .out() - out is mean tell the Hydra to return the function and show the photo.
Complex Example
Code
osc(25,-0.1) .kaleid(5) .color(3,0.91,0.39) .rotate(0.9, 0.1) .modulate(o0, () => mouse.x * 0.0003) .out()
Explanation
osc(25,-0.1) .kaleid(5) - over here I set the kaleid to five, so you can see the shape is pentagon. .color(3,0.91,0.39) - This color function is hard for me. Because the color function over here is different from SVG.js and p5.js So i am still find the answer .rotate(0.9, 0.1) - I am still finding what is the first number mean, but the second number is mean how fast the rotate should be. .modulate(o0, () => mouse.x * 0.0003) - In this function it is work when you move your mouse. The first number is texture, In hydra there have 4 different texture, ex.o0,o1,o2,o3 .out()
Repeat
Simple Example
Code
shape(4,0.8).repeat(6.0,7.0).out()
Complex Example
Code
osc(9, -0.1, 19) .kaleid(6) .repeat(2, 4) .out();
modulateScroll
Simple Example
Code
noise(10) .modulateScrollY(osc(50),0.1,0) .out()
Explanation
noise(10) noise is one kind of texture, and the number inside parentheses is the mean scale so the bigger the scale, the more it returns. .modulateScrollY(osc(50),0.1,0) - modulateScroll you can set it for Y-position or X-position. - Because I set osc to 50 so the number of scrolls will be 50 times. - If I set modulateScroll the Y so the second number is how much move in Y-position. The last number is speed, number bigger is faster. .out() - out is mean tell the Hydra to return the function and show the photo. So at the end of code need to have this.
Complex Example
Code
noise(10, 1) .modulateScrollY(osc([10,100]),0.1,0) .rotate( () => time%360 ,0.1) .color(1,0,3) .out()
Explanation
noise(10, 1) noice(scale, movement speed) .modulateScrollY(osc([10,100]),0.1,0) - over here I set osc to 10 and 100, It is mean the modulateScrollY will return two time one time is 10 the other time is 100. .rotate( () => time%360 ,0.1) - 360 is mean rotate 360 degree, and how fast it return each time. .color(1,0,3) - The three number here is mean Red, Green and Blue, But I am still confused about how to use the color function, I will ask Dr.bell. .out() - out is mean tell the Hydra to return the function and show the photo. So at the end of code need to have this.
Color
Simple Example
Code
osc().color([1,0,0],[0,1,0],[0,0,1]).out(o0)
Explanation of color
the reason that the color changes is that I set three different colors, and each square bracket means one color, there are three numbers inside the square bracket the order of numbers is red, green, and blue. So if you look at the first number I set you can see [1,0,0] This is mean I only want red so set red to "1" and the other two be "0".Then if you want blue you need to set the number for blue to 1.The order of the colors is important. Once you set the wrong position, the color won't be the one that you want. You must be curious here I only set red, green, and blue. But why is there black? This is because in hydra the original color is white and black. White is good to be overshadowed by other colors but black is hard to be overshadowed by other colors, so white is covered by the three other colors I set, black does not. Consequently, you can see black in this art.
Complex Example
Code
noise(10,0.1).color(0,1,0) .add(osc(10,0.1,0).color(1,1,0)) .add(osc(60,0.1,0).color(0,0,1)) .add(osc(64,0.1,0).color(1,0,0)) .out(o0)
Explanation
Just now I talked about setting colors but I only said red green and blue so why are there other colors in this art. hydra is very cool. It is just like painting, you can make many colors, but you need to make the color yourself. For example, if you want purple you need to add blue and red together, so if you set red, green, and blue at the same time. All the colors will be overlapped so there will be many different colors. * The setting color in hydra is hard so I am still trying. get me some time🙃.
Render
Simple Example
Code
noise().color(1,0,1).out(o0) noise().color(3,0,5).out(o1) noise().color(0,5,2).out(o2) noise().color(0,1,1).out(o3) render()
Explanation of render and out
usually, we use one out to show the photo but over here I have 4 out. The reason that there have 4 out is that I want hydra to show 4 different photos at the same time. So "out(o0)" is mean the top left screen, "out(o1)" is the bottom left screen, "out(o2)" is the top right screen, and "out(o3)" is the bottom right screen. Inside each out, you can put any hydra function. "render()" is to show the 4 out. render also have another very cool usage if you put any each out that you want inside the render function it can show the only screen that you put inside
Complex Example
Code
//o0 noise() .pixelate(30,40) .color(1,0,3) .out(o0) //o1 osc(50, -0.1, 10) .kaleid(5) .repeat(8, 5) .out(o1) //o2 noise(10,0.1) .color(0,1,0) .add(osc(10,0.1,0).color(1,1,0)) .add(osc(60,0.1,0).color(0,0,1)) .out(o2) //o3 noise(10, 0.1).color(3,1,9).out(o3) render()