Log In  

Cart #22711 | 2016-06-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
34

Accidentally found a fun wavy transition effect while screwing around with math.

I added nice comments to the source. Try pulling it down and tweaking the values to see if you can make it even cuter-looking.

--timer
t=0

function _update()
 --increase timer
 t+=0.05
end

function _draw()
 cls()

 --this crazy bit loops through
 --limited background colors,
 --and changes it when the
 --screen is covered with white
 local c = 12 + ((t-2.55)/4)%4
 rectfill(0,0,128,128,c)

 for i=0,8 do -- column loop
  for j=0,8 do -- row loop
    --x positions are snapped
    --to 16px columns
    local x = i*16

    --this number sweeps back
    --and forth from -1 to 1
    local osc1 = sin(t+i*0.1)

    --this number also sweeps
    --back and forth, but at
    --a different rate
    local osc2 = sin(t/4+j*0.03)

    --y positions are influenced
    --by one of the sweepy
    --numbers
    local y = j*16 + osc1*10

    --the circles' radii are
    --influenced by the other
    --sweepy number
   circfill(x, y, osc2*15, 7)
  end
 end
end
P#22710 2016-06-11 18:58 ( Edited 2016-06-13 16:51)

really enjoying your posts emu! :3
so many cute things!

P#22837 2016-06-13 12:51 ( Edited 2016-06-13 16:51)
2

I know this post is old, but WOW

P#90861 2021-04-20 22:04

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-19 11:37:38 | 0.010s | Q:18