# A pair of simple, relaxing Christmas tree patterns

**URL:** <https://forum.electromage.com/t/a-pair-of-simple-relaxing-christmas-tree-patterns/2691>\
**Category:** Uncategorized\
**Created:** [December 13, 2022, 2:11am UTC](https://forum.electromage.com/t/a-pair-of-simple-relaxing-christmas-tree-patterns/2691 "2022-12-13T02:11:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zranger1](https://forum.electromage.com/user_avatar/forum.electromage.com/zranger1/32/301_2.png) [@zranger1](https://forum.electromage.com/u/zranger1)\
**Post date:** [December 13, 2022, 2:11am UTC](https://forum.electromage.com/t/a-pair-of-simple-relaxing-christmas-tree-patterns/2691/1 "2022-12-13T02:11:02Z")

</div>

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](https://www.amazon.com/BrizLabs-Changing-Options-Waterproof-Flexible/dp/B07ZSWCY61/ref=sr_1_5?keywords=brizlabs+fairy+lights&qid=1670897154&sr=8-5), 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)**
>
> ```auto
> /*
> 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)
> }
> 
> ```

> **[Tree pattern - Color Clouds](https://www.youtube.com/shorts/RSZTfbhGFwI?feature=share)**
>
> Colorful, relaxing Pixelblaze pattern for my 2022 Christmas tree. Source code at:https://github.com/zranger1/PixelblazePatterns/blob/master/1D/color-clouds.js

> **Candy Cane Swirl (click to expand source)**
>
> ```auto
> // 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)
> }
> 
> ```

> **[Tree Pattern - Candy Cane Swirl](https://www.youtube.com/shorts/WC2B0TP7rOU?feature=share)**
>
> Simple, fun Pixelblaze pattern for my 2022 Christmas tree. Source code at:https://github.com/zranger1/PixelblazePatterns/blob/master/1D/candy-cane-swirl.js
