noise(x, y, z)
Syntax
noise(x)
noise(x, y)
noise(x, y, z)Parameters
Return Value
Description
Examples
1D Noise
2D Animated noise map
Notes
Last updated
noise(x)
noise(x, y)
noise(x, y, z)Last updated
// Generate 1D noise
for i 10 (
value = noise(i * 0.1, 0, 0)
// Using ++ for string concatenation without spaces
log "Noise at " ++ i ++ ": " ++ value
)width = 50
height = 50
scale = 0.1
// Generate a 2D noise map
def generateNoiseMap(x2, y2) (
local output = []
for y height (
local row = []
for x width (
// Get noise value between -1 and 1
value = noise(x + x2 * scale, y + y2 * scale, 0)
// Convert to a value between 0 and 1
normalized = (value + 1) / 2
// Convert to a value from 0 to 7
// Round the value
// Make it a string and repeat it 3 times
hex = round(normalized * 7).toStr() * 3
// append a new icn to the grid array
void row.append("w 20 c #" ++ hex ++ " dot 0 0")
)
// append the row
void output.append(row)
)
return output
)
mainloop:
// render the icon grid
icongrid 10 10 width height generateNoiseMap(round(timer * 10), round(timer * 10))
// import the default window buttons
import "win-buttons"