-- Lua paint scribble spline script

--@TBCONFIG SLIDER: Variant, 20
--@TBCONFIG SLIDER: Stroke Points, 5
--@TBCONFIG SLIDER: Size, 10
--@TBCONFIG SLIDER: Density, 50
--@TBCONFIG SLIDER: Opacity, 50

local points = 1000 * sliderVal2
local seed = 1000 * sliderVal1

math.randomseed(seed)
paint_open(seed)

-- Since a brush isn't selected the current brush will be used.
paint_brush_size(sliderVal3 * 50)
paint_brush_density(sliderVal4 * 100)
paint_brush_opacity(sliderVal5 * 100)

for i = 0, points do
  local x1 = math.random(0, width)
  local y1 = math.random(0, height)
  local x2 = math.random(0, width)
  local y2 = math.random(0, height)
  local cx1 = math.random(0, width)
  local cy1 = math.random(0, height)
  local cx2 = math.random(0, width)
  local cy2 = math.random(0, height)

  paint_spline(x1, y1, x2, y2, cx1, cy1, cx2, cy2)
end

paint_close()

