Back To Top

hydra

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>CP//DS WEBSITE 2024</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <!-- import the webpage's stylesheet -->
    <link rel="stylesheet" href="/style.css" />

    <!-- import the latest version of hydra synth-->
    <script src="https://unpkg.com/hydra-synth"></script>

    <script src="/script.js" defer></script>

    <style>
      body, html {
        margin: 0;
        padding: 0;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: helvetica, arial, sans-serif;
        color: white;
        background-color: black;
      }

      a {
        color: cyan;
        text-decoration: none;
      }

      a:hover {
        text-decoration: underline;
        color: white;
      }

      canvas {
        z-index: 0;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
      }

      main {
        position: relative;
        z-index: 1;
        text-align: center;
        background-color: rgba(0, 0, 0, 0.8);
        padding: 20px;
      }

      h1 {
        font-style: italic;
        font-size: 20px;
        color: white;
      }

      button {
        font-size: 16px;
        padding: 10px;
        margin: 20px;
        color: white;
        background-color: rgba(0, 0, 0, 0.8);
      }
    </style>
  </head>

  <body>

    <canvas id="myCanvas"></canvas>

    <main>
      <h1>
        <a href="https://cpdesignstudio.com">CP//DS</a> 2024
      </h1>
      <p>Animation written with 
        <a href="https://hydra-editor.glitch.me">hydra</a> live coding video synth
      </p>
    </main>

    <script>
      const canvas = document.getElementById("myCanvas");

      canvas.width = 1024;
      canvas.height = 1024;

      // create a new hydra-synth instance
      var hydra = new Hydra({
        canvas,
        detectAudio: true,
        enableStreamCapture: false,
      });

      osc(18, 0.1, 0).color(2, 0.1, 2)
        .modulateKaleid(osc(55), 0.1, 1)
        .mult(osc(20, 0.01, 0))
        .repeat(2, 2)
        .rotate(-0.5)
        .modulate(o1)
        .scale(5, () => (a.fft[0] * 0.9 + 2))
        .diff(o1)
        .out(o0);

      osc(20, 0.2, 0)
        .color(2, 0.7, 20)
        .mult(osc(40))
        .modulateRotate(o0, 0.2)
        .rotate(-0.2)
        .out(o1);
    </script>
    
  </body>
</html>