Regresar
A_Leandro_Estrella_mosaic
--[[

  ----------------------------------------------------------
  Mosaic | OF Visual Patching Developer Platform
  Copyright (c) 2018 Emanuele Mazza aka n3m3da

  Mosaic is distributed under the MIT License. This gives everyone the
    freedoms to use Mosaic in any context: commercial or non-commercial,
    public or private, open or closed source.

    See https://github.com/d3cod3/Mosaic for documentation
  ----------------------------------------------------------
  Estructura de repetición modulada por audio input
  created by Alexis Leandro Estrella con Lua-GAmuza
  Traducido a Lua-Mosaic por mj
  
]]

p = 0
inc = 10
averag = 0
colFondo = 0.0
suma = 0

mouseX = 0
mouseY = 0

----------------------------------------------------
function setup()

end

----------------------------------------------------
function update()
  p = p + inc
  if p > OUTPUT_HEIGHT or p < 0 then
    inc = inc * -1   -- control movimiento
  end
  for k,v in pairs (_mosaic_data_table) do
    suma = suma + _mosaic_data_table[k]

  end
    averag = math.ceil((suma/129)*100)
            -- media de los valores fft
    if averag > 120 then
      colFondo = averag
    else
      colFondo = 0
    end
end

----------------------------------------------------
function draw()
  of.setColor(colFondo, colFondo, colFondo, 1)    -- fondo
  of.drawRectangle(0, 0, OUTPUT_WIDTH, OUTPUT_HEIGHT)

  of.setLineWidth(2)
  for i = p, OUTPUT_WIDTH do
    of.setColor(30, 255, 255, 1)
    of.drawLine(OUTPUT_WIDTH, 0, OUTPUT_WIDTH/2+i, OUTPUT_HEIGHT/4+i)
    of.setColor(255, 30, 255, 1)
    of.drawLine(2+p, 2-i, OUTPUT_HEIGHT/2+i, OUTPUT_WIDTH/4+i)
  end

  for i = -p, OUTPUT_WIDTH do
    of.setColor(30, 30, 255, 1)
    of.drawLine(2+i, 2-i, OUTPUT_HEIGHT/2+i, OUTPUT_WIDTH/4+i)
    of.setColor(255, 30, 30, 1)
    of.drawLine(0, OUTPUT_HEIGHT, OUTPUT_HEIGHT/2+i, OUTPUT_WIDTH/4+i)
  end
end