diff options
| -rw-r--r-- | python/examples/futureHouse/waveViz.js | 54 | 
1 files changed, 37 insertions, 17 deletions
| diff --git a/python/examples/futureHouse/waveViz.js b/python/examples/futureHouse/waveViz.js index 5076e8c..02094a5 100644 --- a/python/examples/futureHouse/waveViz.js +++ b/python/examples/futureHouse/waveViz.js @@ -15,20 +15,15 @@ $(function () {          canvas.width = w = window.innerWidth * 0.9;          canvas.height = h = window.innerHeight * 0.9; +        var hOffset = h - 10; +        var wOffset = w - 10; +          var osc1 = new osc(0, 400, 0.09); -        var horizon = h * 0.4; // the bigger this gets, the lower the wave offsets          var count = 1000; // 40          var step = 1; //Math.ceil(w / count);          var buffer = new ArrayBuffer(count * 4);          var points = new Float32Array(buffer); -        // Change wave amplitude -        //osc1.max = 450; -        //osc1.min = -450; - -        // Change wait time -        //osc1.speed = 0.2 -          function fill() {              for (var i = 0; i < count; i++) {                  points[i] = osc1.getAmp(); @@ -65,11 +60,23 @@ $(function () {              ctx.strokeStyle = '#ffffff';              ctx.stroke(); -            // 0 + +            for (var z = 0; z < 5; z++) { + +            } +            // 0 line              ctx.beginPath(); -            ctx.moveTo(10, h - 10); -            ctx.lineTo(w, h - 10); +            ctx.moveTo(10, hOffset); +            ctx.lineTo(w, hOffset); +            ctx.strokeStyle = '#ff0000'; +            ctx.stroke(); + +            // 1 line + +            ctx.beginPath(); +            ctx.moveTo(10, hOffset / 2); +            ctx.lineTo(w, hOffset / 2);              ctx.strokeStyle = '#ff0000';              ctx.stroke(); @@ -78,17 +85,18 @@ $(function () {          loop(); -/// oscillator object +        /// oscillator object          function osc(minn, maxx, spd) { -            this.max = maxx; -            this.min = minn; -            this.speed = spd; -              var me = this,                  a = 0,                  max = getMax(), -                min = getMin(); +                min = getMin(), +                speed = 0; + +            setMax(maxx); +            setMin(minn); +            setSpeed(spd);              this.getAmp = function () { @@ -112,6 +120,18 @@ $(function () {                  return me.min;              } +            function setMax(x) { +                me.max = hOffset - x; +            } + +            function setMin(x) { +                me.min = hOffset - x; +            } + +            function setSpeed(x) { +                me.speed = x; +            } +              return this;          } | 
