A big update, many features! This release adds gradient palettes, noise, and some transition utility functions.
Gradient palettes.
Define an array with RGB color stops at specified locations and apply it with setPalette()
, and use paint()
to set the current pixel. For example:
var test = [
0, 0, 0, 0, //position start, rgb(0,0,0)
0.75, 1, 0, 0.5, //position 75%, rgb(1,0,0.5)
1, 0, 1, 1 // position end, rgb(0,1,1)
]
setPalette(test)
export function render2D(index, x, y) {
paint(x)
}
Looks like this:
This is very similar to what @JasonCoon had created and posted about here.
The palette array is live, so some interesting animations can be done by modifying the array.
You can also specify an optional brightness e.g. paint(color, brightness)
.
Perlin Noise
Perlin and fractal noise functions generate smoothly transitioning random noise between integer values.
Some examples:
perlin(x, y, z, 0)
:
(red showing negative)
perlinFbm(x, y, 0, 2, .5, 3)
:
perlinRidge(x, y, 0, 2, .5, 1.1, 3)
:
perlinTurbulence(x, y, 0, 2, .5, 3)
:This can be used for all sorts of textures, like this fire pattern:
Or @zranger1’s Coronal Mass Ejection:
Use setPerlinWrap
to control the repeating / wrapping behavior of the Perlin noise functions.
Additional APIs
- Added
mix
,smoothstep
,bezierQuadratic
,bezierCubic
functions for all your transition needs. - Added a pseudo random number generator
prng()
which can be seeded withprngSeed()
. - Now render is given an
x
. For now it’s justindex/pixelCount
, but will tie into pixel maps and coordinate transforms at some point. - Added
mapPixels
,pixelMapDimensions
,has2DMap
,has3DMap
APIs for waits to get more information about the pixel map.
Fixes and Other Things
- Increase pattern globals limit to 1024.
- Improved performance across many areas. You might see a few extra FPS!
- Fix for networks that give out 192.168.4* addresses.
- Disabled the OS task watchdog. The watchdog is designed poorly for some workloads, and could trip when things were working smoothly but just a little busy. It’s theoretically possible a bug somewhere could cause things to lock up, but this seems less likely / common than the reboots happening just during a busy workload.
- Custom MAC address support.
Files for offline install:
-
v3.30.pb32.stfu (1.4 MB)
-
v3.30.pico32.stfu (1.4 MB)