Version av: one bugfix, support for LÖVE 11.5
Lua Carousel » Devlog
All of yesterday's changes included a new bug: touches sometimes moved the scrollbar when they shouldn't. You can read all about the gory details at https://git.sr.ht/~akkartik/carousel.love/commit/42cc608d06821fcefad5b0d25c5583a... I hope bugfix changes will have fewer bugs over time :/
LÖVE also came out with a new release 11.5 today. This version has been tested with it and all seems well.
Your program for the day is a new feature for yesterday's tree fractal that adds some interactivity:
Iters = 7 Zoom = 10 X0 = Safe_width*3/4 Y0 = Safe_height-10 N = Safe_height/2/Iters/Zoom Left = -0.3 Right = 0.7 function car.draw() x,y = X0,Y0 Angle = -pi/2 Stack = {} color(1,0,1, 0.4) s = '0' for _ = 1,Iters do s = lsys(s) end --print(s) draw_lsys(s) draw_sliders() end function draw_lsys(s) for i=1,#s do local c = s:sub(i,i) if c == '0' or c == '1' then forward() elseif c == '[' then push() elseif c == ']' then pop() end end end function forward() local x2 = x + N*cos(Angle) local y2 = y + N*sin(Angle) line(x,y, x2, y2) --print('|', x,y, x2,y2) x, y = x2, y2 end function push() table.insert(Stack, {x, y, Angle}) Angle = Angle+Left --print('[', x,y, Angle) end function pop() x,y, Angle = unpack(Stack[#Stack]) table.remove(Stack) Angle = Angle+Right --print(']', x,y, Angle) end function lsys(s) local result = {} for i=1,#s do local c = s:sub(i,i) if c == '1' then table.insert(result, '11') elseif c == '0' then table.insert(result, '1[0]0') else table.insert(result, c) end end return table.concat(result) end function draw_sliders() Iters_slider = { x0 = 50, y0 = Safe_width/2, x1 = 150, w=20, h=20, lo = 1, hi = 12, value = Iters, } draw_slider(Iters_slider) end function car.mouse_press(x,y, b) if on_slider(Iters_slider, x,y) then Iters_slider_selected = true return end Iters_slider_selected = nil --X0,Y0 = x,y Left = -x/Safe_width Right = y/Safe_height end function car.mouse_release(x,y, b) Iters_slider_selected = nil end function car.update(dt) if not Show_code and Iters_slider_selected then Iters = slider_value(Iters_slider, App.mouse_x()) end end
Files
carousel-av.love 108 kB
Dec 04, 2023
carousel-av-safe.love 108 kB
Dec 04, 2023
Get Lua Carousel
Lua Carousel
Write programs on desktop and mobile
Status | In development |
Category | Tool |
Author | Kartik Agaram |
Tags | LÖVE |
More posts
- New version after 3 days16 days ago
- New version after 40 days19 days ago
- Turn your phone or tablet into a chess clock33 days ago
- Guest program: bouncing balls49 days ago
- New version after 3 months, and turtle graphics60 days ago
- Interactively zooming in to the Mandelbrot set on a touchscreen79 days ago
- A little timer app80 days ago
- New version after 4 monthsJun 28, 2024
- Visualizing the digits of πMay 04, 2024
- A little recursion problemApr 15, 2024
Leave a comment
Log in with itch.io to leave a comment.