-
Notifications
You must be signed in to change notification settings - Fork 9
/
ANIMartRIX.ino
134 lines (93 loc) · 3.8 KB
/
ANIMartRIX.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
___ _ ___ ______ _____ _
/ _ \ (_) / _ \ | ___ \_ _| (_)
/ /_\ \_ __ _ _ __ ___ / /_\ \| |_/ / | |_ __ ___ __
| _ | '_ \| | '_ ` _ \| _ || / | | '__| \ \/ /
| | | | | | | | | | | | | | | || |\ \ | | | | |> <
\_| |_/_| |_|_|_| |_| |_\_| |_/\_| \_| \_/_| |_/_/\_\
by Stefan Petrick 2023.
High quality LED animations for your next project.
This is a Shader and 5D Coordinate Mapper made for realtime
rendering of generative animations & artistic dynamic visuals.
This is also a modular animation synthesizer with waveform
generators, oscillators, filters, modulators, noise generators,
compressors... and much more.
VO.42 beta version
This code is licenced under a Creative Commons Attribution
License CC BY-NC 3.0
*/
#include <FastLED.h>
#define num_x 16 // how many LEDs are in one row?
#define num_y 16 // how many rows?
#define NUM_LEDS ((num_x) * (num_y))
CRGB leds[num_x * num_y]; // framebuffer
float polar_theta[num_x][num_y]; // look-up table for polar angles
float distance[num_x][num_y]; // look-up table for polar distances
unsigned long a, b, c; // for time measurements
struct render_parameters {
float center_x = (num_x / 2) - 0.5; // center of the matrix
float center_y = (num_y / 2) - 0.5;
float dist, angle;
float scale_x = 0.1; // smaller values = zoom in
float scale_y = 0.1;
float scale_z = 0.1;
float offset_x, offset_y, offset_z;
float z;
float low_limit = 0; // getting contrast by highering the black point
float high_limit = 1;
};
render_parameters animation; // all animation parameters in one place
#define num_oscillators 10
struct oscillators {
float master_speed; // global transition speed
float offset[num_oscillators]; // oscillators can be shifted by a time offset
float ratio[num_oscillators]; // speed ratios for the individual oscillators
};
oscillators timings; // all speed settings in one place
struct modulators {
float linear[num_oscillators]; // returns 0 to FLT_MAX
float radial[num_oscillators]; // returns 0 to 2*PI
float directional[num_oscillators]; // returns -1 to 1
float noise_angle[num_oscillators]; // returns 0 to 2*PI
};
modulators move; // all oscillator based movers and shifters at one place
struct rgb {
float red, green, blue;
};
rgb pixel;
//******************************************************************************************************************
void setup() {
// FastLED.addLeds<NEOPIXEL, 13>(leds, NUM_LEDS);
FastLED.addLeds<APA102, 11, 13, BGR, DATA_RATE_MHZ(12)>(leds, NUM_LEDS);
//FastLED.setMaxPowerInVoltsAndMilliamps( 5, 2000); // optional current limiting [5V, 2000mA]
Serial.begin(115200); // check serial monitor for current fps count
render_polar_lookup_table((num_x / 2) - 0.5, (num_y / 2) - 0.5); // precalculate all polar coordinates
// polar origin is set to matrix centre
}
//*******************************************************************************************************************
void loop() {
//RGB_Blobs5();
//RGB_Blobs4();
//RGB_Blobs3();
//RGB_Blobs2();
//RGB_Blobs();
//Polar_Waves();
//Slow_Fade();
//Zoom2();
//Zoom();
//Hot_Blob();
//Spiralus2();
//Spiralus();
//Yves();
//Scaledemo1();
Lava1();
//Caleido3();
//Caleido2();
//Caleido1();
//Distance_Experiment();
//Center_Field();
//Waves();
//Chasing_Spirals();
//Rotating_Blob();
//Rings();
}