aboutsummaryrefslogtreecommitdiffstats
path: root/examples/place_on_line.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/place_on_line.lua')
-rw-r--r--examples/place_on_line.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/place_on_line.lua b/examples/place_on_line.lua
new file mode 100644
index 0000000..d58f713
--- /dev/null
+++ b/examples/place_on_line.lua
@@ -0,0 +1,17 @@
+-- return function (state)
+function place_in_rect(S)
+ input.selection(S.objs, '^led-')
+ input.line(S.dest)
+
+ local dest = S.dest()
+ local start = dest.frm
+ local step = (dest.to - dest.frm) / #S.objs()
+ start = start - step/2
+
+ for i, obj in ipairs(S.objs()) do
+ local pos = start + step * i
+ op.move(obj, pos)
+ end
+end
+
+return place_in_rect