Posted 14 September 2013 - 06:14 AM
This is a bit like Gopher's Fire! but instead it shows a constant stream of flowing water.
It's also slightly less complex than Gopher's, all it technically does is draw the sine graph with varying transformations, but after a lot of tweaking of settings I finally got something that I at least think looks representable.
(NOTE: the gif is about 4x slower than it actually runs at, perhaps even slower than that, and its a tiny bit glitchy, but it should give you an idea of how it flows.)
Here's the paste:
http://pastebin.com/SYeftZTM
Or if you prefer hastebin:
http://hastebin.com/buqeriwoja.lua
Just thought I'd share it, feel free to toggle the settings, here's a list of key variables and what they change:
"dskip = 0" - the amount the waves skip, to stop stationary movement at slower speeds
"dmax = 45" - the min and max of the waves height
"stcmax = 90" - the max width of the waves
"stcmin = 75" - the min width of the waves
"stcamt = 2" - the speed at which the waves increase/decrease
"offset = offset + 1" (in draw()) - change the " + 1 " to change the speed at which the waves move
also, in the actual equation-thingy
also note that I realize math.max() doesn't do anything, but that's to make it easier to test things.
It's also slightly less complex than Gopher's, all it technically does is draw the sine graph with varying transformations, but after a lot of tweaking of settings I finally got something that I at least think looks representable.
(NOTE: the gif is about 4x slower than it actually runs at, perhaps even slower than that, and its a tiny bit glitchy, but it should give you an idea of how it flows.)
Spoiler
Here's the paste:
http://pastebin.com/SYeftZTM
Or if you prefer hastebin:
http://hastebin.com/buqeriwoja.lua
Just thought I'd share it, feel free to toggle the settings, here's a list of key variables and what they change:
Spoiler
"damt = 8" - the speed at which the waves move up and down"dskip = 0" - the amount the waves skip, to stop stationary movement at slower speeds
"dmax = 45" - the min and max of the waves height
"stcmax = 90" - the max width of the waves
"stcmin = 75" - the min width of the waves
"stcamt = 2" - the speed at which the waves increase/decrease
"offset = offset + 1" (in draw()) - change the " + 1 " to change the speed at which the waves move
also, in the actual equation-thingy
(math.max((math.sin((x-getOffset())/stretch)*(dither))-0.5) + math.floor(height/2))
flip the sign in "x-getOffset()" to change the direction of the waves.also note that I realize math.max() doesn't do anything, but that's to make it easier to test things.