Author Topic: pretty wiggling wave thing  (Read 1046 times)



makes a pretty colorful moving wave

it's not interactive or anything, i was just bored

dl: https://dl.dropbox.com/u/8005323/lua/love2d/pretty%20wave%20thing.zip

source (because it's not that big anyway):
Code: [Select]
g = love.graphics

w,h = g.getWidth(), g.getHeight()
time = 0
inc = 4

g.setPoint(50,'rough')

function love.update(dt)
local mx,my = love.mouse.getPosition()
time = time + dt
-- g.setBackgroundColor(HSV((time*30)%255,255,180))
end

function love.draw()

for x=0, w, inc do
local y = h/2 + math.sin(x/40 + time*3)*math.sin(time*2)*100
g.setColor(HSV(((x + time*50)/3)%255,255,200))
g.point(x,y)

local y = h/2 + math.sin(x/40 - time*3)*math.sin(time*3)*100
g.setColor(HSV(((x + time*50 + 1)/3)%255,255,200))
g.point(x,y)

local y = h/2 + math.sin(x/40 + time*3)*math.sin((time+1)*2)*200
g.setColor(HSV(((x + time*50 - 2)/3)%255,255,200))
g.point(x,y)

local y = h/2 + math.sin(x/40 - time*3)*math.sin(time/2)*200
g.setColor(HSV(((x + time*50 + 3)/3)%255,255,200))
g.point(x,y)
end

g.print(love.timer.getFPS(),0,0)
end

function HSV(h, s, v)
    if s <= 0 then return v,v,v end
    h, s, v = h/256*6, s/255, v/255
    local c = v*s
    local x = (1-math.abs((h%2)-1))*c
    local m,r,g,b = (v-c), 0,0,0
    if h < 1     then r,g,b = c,x,0
    elseif h < 2 then r,g,b = x,c,0
    elseif h < 3 then r,g,b = 0,c,x
    elseif h < 4 then r,g,b = 0,x,c
    elseif h < 5 then r,g,b = x,0,c
    else              r,g,b = c,0,x
    end return (r+m)*255,(g+m)*255,(b+m)*255
end



1. Take this program and build it into a Live Wallpaper for Android
2. Upload onto Google Play
3. Make hundreds of dollars for selling this friggin neat colorful stuff


it's things like this which make me wish I was good at maths


Neat stuff, looks well cool. Try adding together/averaging different sine waves into one for some really neat transforming waveforms.

it's things like this which make me wish I was good at maths
It's not so much being good at math as it is having a good understanding of the language you're working in and then loving with formulas until you get the desired effect, whether intentional or not. Of course you need to understand the math, you just don't need to be good with it.

care if I implement this in a in-Blockland display thing
DO IT.

Neat stuff, looks well cool. Try adding together/averaging different sine waves into one for some really neat transforming waveforms.
i try to change it but then it looks like stuff

that tells me it's fine the way it is, haha

1. Take this program and build it into a Live Wallpaper for Android
2. Upload onto Google Play
3. Make hundreds of dollars for selling this friggin neat colorful stuff
if only i had an android for testing

:S