Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local points = {}
  2. local height = love.graphics.getHeight()
  3. local width = love.graphics.getWidth()
  4. local x = 0
  5. local y = 0
  6. local R = 110
  7. local r = 60
  8. local p = 100
  9. local iteration = 1/25
  10.  
  11. local function Fx(t)
  12.     x = x + iteration
  13.     return ((R-r)*math.cos(t)+p*math.cos((R-r)*t/r)) + width/2
  14. end
  15.  
  16. local function Fy(t)
  17.     y = y - iteration
  18.     return ((R-r)*math.sin(t)-p*math.sin((R-r)*t/r)) + height/2
  19. end
  20.  
  21. function love.draw()
  22.     table.insert(points,{Fx(x),Fy(y),math.sin(x)*(100/2)+255/2})
  23.     for i, v in pairs(points) do
  24.         love.graphics.point(v[1],v[2])
  25.         if points[i-1] ~= nil then
  26.             love.graphics.setColor(v[3],v[3],v[3])
  27.             love.graphics.line(v[1],v[2],points[i-1][1],points[i-1][2])
  28.         end
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement