diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-11-04 14:55:54 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-11-04 14:55:54 +0000 |
| commit | 972a4e8b29bbe47f4c04b18b432e2cbe257472c0 (patch) | |
| tree | d4ed5abcee60d4108becb4e643977014e29f8905 /examples/create_star.lua | |
| parent | test is_once and is_live (diff) | |
| download | watch-cad-972a4e8b29bbe47f4c04b18b432e2cbe257472c0.tar.gz watch-cad-972a4e8b29bbe47f4c04b18b432e2cbe257472c0.zip | |
add input.slider
Diffstat (limited to 'examples/create_star.lua')
| -rw-r--r-- | examples/create_star.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/create_star.lua b/examples/create_star.lua index 520cf07..078f5df 100644 --- a/examples/create_star.lua +++ b/examples/create_star.lua @@ -5,11 +5,13 @@ function draw_star(S) input.circle(S.outer, { center = S.inner().center }) local inner, outer = S.inner(), S.outer() - - local cnt = 20 + + input.slider(S.cnt, 2, 20) + + local cnt = math.floor(S.cnt()) * 2 local step = 2*math.pi/cnt local lag = inner.center + vec2(inner.radius, 0) - for i = 0, 20 do + for i = 0, cnt do local r = (i % 2 == 0) and inner.radius or outer.radius local pos = inner.center + vec2.from_cartesian(r, step * i) |
