PB functions for Desmos (a graphing calculator)

I’ve found Desmos really helpful for crafting waveforms. Here’s my template that includes all the Pixelblaze builtin functions:

Here are some functions I’ve been working on this holdiay season:

Twinkler

Easing

Fade through black (for less sudden transitions in Firestorm playlists)

// Fade in/out through black
// https://www.desmos.com/calculator/5zwjxh0tys
var fBDuration = 25 // Total pattern duration in seconds 
var fBFade = 2      // Fade duration
var initFBOffset = time(fBDuration / 65.536) // Value of timer at pattern initiation

function fBV() {
  var t = ( 1 + time(fBDuration / 65.536) - initFBOffset ) % 1
  var _v = min(1, fBDuration / 2 / fBFade * triangle(t))
  return _v * _v     // ease in, ease out
  // return _v       // linear
  // return sqrt(_v) // sudden in / sudden out
}

var fIO     // 0-1 Multiplier for fade-in-out
fIO = fBV() // Put this in beforeRender

// In render, scale your v like this
hsv(h, s, v * fIO)
3 Likes

This is so cool @jeff!

I’d love to add something like this in the editor, hover over any pure function and see a plot.

I was just looking at bezier curve implementations too, which are great for making transitions with different feels. Web / CSS makes pretty good use of these, and there’s some good tools for poking around with them and some common transitions.

1 Like

I love this – have been using numpy/matplotlib & occasionally Excel for the same purpose, but this is way handier.

+1 for parametric easing curves! Super cool idea! A Bezier tool with even a few control points would be fun too.