Last active
April 7, 2020 22:22
-
-
Save tesselode/ca1df468e404ec4d5ac786b6d6cb3bc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function sign(x) | |
return x < 0 and -1 or 1 | |
end | |
local function signedPower(x, n) | |
return sign(x) * (math.abs(x) ^ n) | |
end | |
local regularFont = love.graphics.newFont('font/CourierPrime-Bold.ttf', 48) | |
local time = love.math.random() * 100 | |
local light = false | |
function love.update(dt) | |
time = time + dt | |
end | |
function love.keypressed(key) | |
if key == 'escape' then love.event.quit() end | |
if key == 'space' then light = not light end | |
end | |
local function drawText(ox, oy, t, movementAmount) | |
movementAmount = movementAmount or 1 | |
local font = love.graphics.getFont() | |
local height = font:getHeight() | |
local x = ox + love.graphics.getWidth()/6 | |
+ movementAmount * 2 * math.sin(t * 25) | |
+ movementAmount * 2 * math.cos(t * 19) | |
+ movementAmount * signedPower(math.tan(-t/.9), .8) | |
local y = oy + love.graphics.getHeight()/2 | |
+ movementAmount * 2 * math.cos(t * 30) | |
+ movementAmount * 2 * math.sin(t * 17) | |
+ movementAmount * signedPower(math.tan(t/4), .9) | |
+ movementAmount * signedPower(math.tan(-t/1.5), .8) | |
love.graphics.print('entropy witch', x, y, 0, 1, 1, 0, height/2) | |
end | |
function love.draw() | |
love.graphics.push 'all' | |
if light then | |
love.graphics.clear(.9, .9, .9) | |
else | |
love.graphics.clear(0, 0, 0) | |
end | |
love.graphics.setFont(regularFont) | |
love.graphics.setColor(26/255, 232/255, 174/255) | |
love.graphics.setBlendMode 'screen' | |
drawText(0, 0, time + 4/30) | |
drawText(0, 0, time + 3/30) | |
drawText(0, 0, time + 2/30) | |
drawText(0, 0, time + 1/30) | |
love.graphics.setBlendMode 'add' | |
love.graphics.setColor(232/255, 26/255, 83/255) | |
drawText(0, 0, time) | |
love.graphics.pop() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment