Skip to content

Instantly share code, notes, and snippets.

@ExtReMLapin
Created March 26, 2016 01:48
Show Gist options
  • Save ExtReMLapin/371aa5fba69a36ee3579 to your computer and use it in GitHub Desktop.
Save ExtReMLapin/371aa5fba69a36ee3579 to your computer and use it in GitHub Desktop.
local loader = require 'love-loader'
local finishedLoading = false
local screenWidth, screenHeight = love.graphics.getWidth(), love.graphics.getHeight()
instant_fps = 60
local TEST_ERROR = false
local MAX_FPS = 200
local http;
local time = os.time()
function include(file)
return require(string.gsub(file, ".lua", ""))
end
function load_modules()
local files = love.filesystem.getDirectoryItems("modules")
for k,v in ipairs(files) do
include("modules/" .. v)
end
http = require("socket.http")
end
function love.load()
end
function love.update(dt)
end
function love.timer.realFPS()
return instant_fps
end
local math = math
local love = love
local pixel_size = 2
function hypt(a,b)
return math.sqrt(a^2+b^2)
end
function Plasma(x,y,w,h,t)
local tx = math.sin(t*1.3)*100
local ty = math.cos(t*0.8)*120
local px = x/300
local py = y/100
local pass1 = 90 + 89 * ( math.sin( hypt( w/2-x+ty, h/2-y+tx )/64 + t) )
local pass2 = 90 + 89 * math.sin(px*math.cos(py+tx/100)+t)*math.sin(py*math.cos(px+ty/100)+t)
return pass1+pass2
end
function love.draw()
local w, h = love.graphics.getDimensions( )
local t = love.timer.getTime() * 0.5
--pixel_size = math.max(t%50, 5)
for x = 0, w, pixel_size do
for y = 0, h, pixel_size do
--surface.SetDrawColor(HSVToColor(Plasma(x,y,w,h,t)%360,1,1))
local val = Plasma(x,y,w,h,t)%360
love.graphics.setColor(val,val,val,255)
love.graphics.rectangle("fill",x, y, pixel_size+1,pixel_size+1 )
end
end
end
function love.resize(w, h)
ScrW = w
ScrH = h
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment