aboutsummaryrefslogtreecommitdiffstats
path: root/examples/place_in_rect.lua
blob: 365025739f4d0563ce419b9feda28bf036deefa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- return function (state)
function place_in_rect(S)
  input.selection(S.objs, '^led-')
  input.rect(S.dest)

  local start = S.min()
  local step = S.dest():size()
  step.y = 0

  for i, obj in ipairs(S.objs()) do
    local pos = start + step:scale(i)
    draw.cross(pos)
    -- op.move(obj, pos)
  end
end

return place_in_rect