Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load() -- do global variables get declared here?
- windowwidth = 1000
- windowheight = 1000
- sucess = love.window.setMode(windowwidth, windowheight)
- x = 30
- y = 50
- z = math.sin(math.pi/3)
- cx = 0
- cy = 0
- a = 20
- b = 1/4
- ps = 0
- end
- function love.update(dt)
- local m = math.pow(2, dt)
- if love.keyboard.isDown("up") then
- a = a*m
- end
- if love.keyboard.isDown("down") then
- a = a/m
- end
- if love.keyboard.isDown("right") then
- b = b*m
- end
- if love.keyboard.isDown("left") then
- b = b/m
- end
- if love.keyboard.isDown("a") then
- ps = ps - 1
- end
- if love.keyboard.isDown("s") then
- ps = ps + 1
- end
- end
- function love.draw() -- render to window
- -- y = asin(bx + c)
- love.graphics.setColor(200/255, 215/255, 0/255)
- delthe = math.pi/60 -- 3 degrees
- --a = 20
- x = 0
- p = 1
- odeg = math.pi/180
- for theta = -32*math.pi, 32*math.pi, odeg do
- love.graphics.line(x + ps, a*math.sin(b*(theta + ps))+windowwidth/2, x+odeg + ps, a*math.sin(b*theta+odeg + ps + 0.1)+windowwidth/2)
- -- phaseshift = 3 for an interesting pattern
- -- love.graphics.line(x, a*math.sin(theta/ps)+windowwidth/2, x+odeg, a*math.sin(theta/ps+odeg)+windowwidth/2)
- x = x + 0.1
- --ps = ps + 0.1
- end
- end
Add Comment
Please, Sign In to add comment