Skip to content

Instantly share code, notes, and snippets.

@flamendless
Created July 10, 2018 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flamendless/ba390f31e350433bb4d5f3255cc6e927 to your computer and use it in GitHub Desktop.
Save flamendless/ba390f31e350433bb4d5f3255cc6e927 to your computer and use it in GitHub Desktop.
Save a noise to a texture! thanks Positive07
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