Created
July 10, 2018 04:27
-
-
Save flamendless/ba390f31e350433bb4d5f3255cc6e927 to your computer and use it in GitHub Desktop.
Save a noise to a texture! thanks Positive07
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 data = love.image.newImageData(w, h) | |
data:mapPixel(function(x,y,r,g,b,a) | |
local a = love.math.noise(x, y) | |
return a, a, a, 1 | |
end) | |
if isSaveIt then | |
data:encode("png", filename or "noise.png") | |
local image = love.graphics.newImage(data) | |
return image | |
else | |
return data | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment