A pair of simple, relaxing Christmas tree patterns

Here are a couple of new patterns I did for my tree this year. They’re designed to be simple, relaxing and somewhat traditional looking. No map required - they just expect your tree to be lit in some sort of helical spiral.

(The tree has 800 of these fairy lights, which are (mostly) WS2812 compatible. They’re run by a Pixelblaze on 4 channels of an output expander board, with a 20A power supply, all mounted in a handy fruitcake tin!)

Color Clouds (click to expand source)
/*
 Color clouds - for helical spiral mapped trees (and other strips too!)
 
 Swirling clouds of fairly traditional tree light
 colors.  No mapping function required.
 
 ZRanger1 12/2022
*/ 

export var speed = 0.7;
export var waveLength = 1.31;
export var contrast = 0.07;

export function sliderSpeed(v) {
  if (v == 0) {
    speed = 0;
  } else
    speed = max(0.04,1.5*(1-v));
}

export function sliderContrast(v) {
  depth = v*v
}

export function sliderClouds(v) {
  waveLength = 2*v*v;
}

export function beforeRender(delta) {
  k1 = waveLength * 11; 
  k2 = waveLength * 15; 
  k3 = waveLength * 7;  
  k4 = waveLength * 5;    
  
  t1 = time(speed *.16);
  t2 = time(speed *.1);
  t3 = time(speed *.14);
  t4 = time(speed *.11);
}

export function render(index) {
  var x,v;
  r = g = b = 0;
  x = index/pixelCount;
  r = wave((k1 * x) - t1);
  g = wave((k2 * x) + t2);
  b = wave((k3 * x) + t3);
  v = depth * (-1+2*wave((k4 * x) - t4));
  r = (r + v)/2
  g = (g + v)/2
  b = (b + v)/2

  
  rgb(r,g,b)
}
Candy Cane Swirl (click to expand source)
//  Red/White swirling strips for Christmas tree
//  with approximately conical spiral layout 
//  (and LED strips too, of course).
//
// No map required.
// 12/2022 ZRanger1

export var nStripes = 6
export var speed = 0.03
export var direction = 1;

export function sliderSpeed(v) {
  speed = 0.001+v*v
}

export function sliderStripes(v) {
  nStripes = 6*v;
}

export function beforeRender(delta) {
  t1 = direction * time(speed)
}

export function sliderDirection(v) {
  direction = (v < 0.5) ? -1 : 1;
}

export function render(index) {
  s = smoothstep(0,1,wave(t1+nStripes*index/pixelCount))
  hsv(0, s, 1)
}
4 Likes