FastLED 3.9.15
Loading...
Searching...
No Matches
animartrix_detail.hpp
Go to the documentation of this file.
1#pragma once
2
3/*
4 ___ _ ___ ______ _____ _
5 / _ \ (_) / _ \ | ___ \_ _| (_)
6/ /_\ \_ __ _ _ __ ___ / /_\ \| |_/ / | |_ __ ___ __
7| _ | '_ \| | '_ ` _ \| _ || / | | '__| \ \/ /
8| | | | | | | | | | | | | | | || |\ \ | | | | |> <
9\_| |_/_| |_|_|_| |_| |_\_| |_/\_| \_| \_/_| |_/_/\_\
10
11by Stefan Petrick 2023.
12
13High quality LED animations for your next project.
14
15This is a Shader and 5D Coordinate Mapper made for realtime
16rendering of generative animations & artistic dynamic visuals.
17
18This is also a modular animation synthesizer with waveform
19generators, oscillators, filters, modulators, noise generators,
20compressors... and much more.
21
22VO.42 beta version
23
24This code is licenced under a Creative Commons Attribution
25License CC BY-NC 3.0
26
27*/
28
29#include "fl/vector.h"
30#include <math.h> // ok include
31#include <stdint.h>
32
33#ifndef ANIMARTRIX_INTERNAL
34#error "This file is not meant to be included directly. Include animartrix.hpp instead."
35#endif
36
37// Copyright Stefen Petrick 2023.
38// Adapted to C++ by Netmindz 2023.
39// Adapted to FastLED by Zach Vorhies 2024.
40// Licensed under the Creative Commons Attribution License CC BY-NC 3.0
41// https://creativecommons.org/licenses/by-nc/3.0/
42// This header is distributed with FastLED but has a different license that limits commercial use.
43// If you include this high quality LED animation library in your project, you must agree to the licensing terms.
44// It is not included by FastLED by default, you must include it manually.
45// Setting FASTLED_ANIMARTRIX_LICENSING_AGREEMENT=1 will indicate that you agree to the licensing terms of the ANIMartRIX library for non commercial use only.
46//
47// Like the rest of FastLED, this header is free for non-commercial use and licensed under the Creative Commons Attribution License CC BY-NC 3.0.
48// If you are just making art, then by all means do what you want with this library and you can stop reading now.
49// If you are using this header for commercial purposes, then you need to contact Stefan Petrick for a commercial use license.
50
51
52
53
54#include "fl/force_inline.h"
55#include "crgb.h"
56#include "fl/namespace.h"
57
58// Setting this to 1 means you agree to the licensing terms of the ANIMartRIX library for non commercial use only.
59#if defined(FASTLED_ANIMARTRIX_LICENSING_AGREEMENT) || (FASTLED_ANIMARTRIX_LICENSING_AGREEMENT != 0)
60#warning "Warning: Non-standard license. This fx header is separate from the FastLED driver and carries different licensing terms. On the plus side, IT'S FUCKING AMAZING. ANIMartRIX: free for non-commercial use and licensed under the Creative Commons Attribution License CC BY-NC-SA 4.0. If you'd like to purchase a commercial use license please contact Stefan Petrick. Github: github.com/StefanPetrick/animartrix Reddit: reddit.com/user/StefanPetrick/ Modified by github.com/netmindz for class portability. Ported into FastLED by Zach Vorhies."
61#endif //
62
63
64#ifndef PI
65#define PI 3.1415926535897932384626433832795
66#endif
67
68#ifdef ANIMARTRIX_PRINT_USES_SERIAL
69#define ANIMARTRIX_PRINT_USES_SERIAL(S) Serial.print(S)
70#else
71#define ANIMARTRIX_PRINT(S) (void)(S)
72#endif
73
74#define num_oscillators 10
75
78
80
81 // TODO float center_x = (num_x / 2) - 0.5; // center of the matrix
82 // TODO float center_y = (num_y / 2) - 0.5;
83 float center_x = (999 / 2) - 0.5; // center of the matrix
84 float center_y = (999 / 2) - 0.5;
85 float dist, angle;
86 float scale_x = 0.1; // smaller values = zoom in
87 float scale_y = 0.1;
88 float scale_z = 0.1;
90 float z;
91 float low_limit = 0; // getting contrast by highering the black point
92 float high_limit = 1;
93};
94
95
97
98 float master_speed; // global transition speed
99 float
100 offset[num_oscillators]; // oscillators can be shifted by a time offset
101 float ratio[num_oscillators]; // speed ratios for the individual oscillators
102};
103
104
106
107 float linear[num_oscillators]; // returns 0 to FLT_MAX
108 float radial[num_oscillators]; // returns 0 to 2*PI
109 float directional[num_oscillators]; // returns -1 to 1
110 float noise_angle[num_oscillators]; // returns 0 to 2*PI
111};
112
113
114
115
116struct rgb {
117 float red, green, blue;
118};
119
120
121
122static const uint8_t PERLIN_NOISE[] = {
123 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7,
124 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190,
125 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117,
126 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136,
127 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158,
128 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46,
129 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209,
130 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86,
131 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5,
132 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16,
133 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44,
134 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253,
135 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97,
136 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51,
137 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184,
138 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93,
139 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156,
140 180};
141
142FASTLED_FORCE_INLINE uint8_t P(uint8_t x) {
143 const uint8_t idx = x & 255;
144 const uint8_t* ptr = PERLIN_NOISE + idx;
145 return *ptr;
146}
147
149
150 public:
151 int num_x; // how many LEDs are in one row?
152 int num_y; // how many rows?
153
154 float speed_factor = 1; // 0.1 to 10
155
156 float radial_filter_radius = 23.0; // on 32x32, use 11 for 16x16
157
159
160 render_parameters animation; // all animation parameters in one place
161 oscillators timings; // all speed settings in one place
162 modulators move; // all oscillator based movers and shifters at one place
164
166 polar_theta; // look-up table for polar angles
168 distance; // look-up table for polar distances
169
170 unsigned long a, b, c; // for time measurements
171
173
175
176 ANIMartRIX(int w, int h) { this->init(w, h); }
177
178 virtual ~ANIMartRIX() {}
179
180 virtual uint16_t xyMap(uint16_t x, uint16_t y) = 0;
181
182 uint32_t currentTime = 0;
183 void setTime(uint32_t t) { currentTime = t; }
184 uint32_t getTime() { return currentTime ? currentTime : millis(); }
185
186
187 void init(int w, int h) {
190 move = modulators();
191 pixel = rgb();
192
193 this->num_x = w;
194 this->num_y = h;
195 if (w <= 16) {
196 this->radial_filter_radius = 11;
197 } else {
198 this->radial_filter_radius = 23; // on 32x32, use 11 for 16x16
199 }
201 (num_x / 2) - 0.5,
202 (num_y / 2) - 0.5); // precalculate all polar coordinates
203 // polar origin is set to matrix centre
204 // set default speed ratio for the oscillators, not all effects set their own, so start from know state
205 timings.master_speed = 0.01;
206 }
207
213 void setSpeedFactor(float speed) { this->speed_factor = speed; }
214
215 // Dynamic darkening methods:
216
217 float subtract(float &a, float &b) { return a - b; }
218
219 float multiply(float &a, float &b) { return a * b / 255.f; }
220
221 // makes low brightness darker
222 // sets the black point high = more contrast
223 // animation.low_limit should be 0 for best results
224 float colorburn(float &a, float &b) {
225
226 return (1 - ((1 - a / 255.f) / (b / 255.f))) * 255.f;
227 }
228
229 // Dynamic brightening methods
230
231 float add(float &a, float &b) { return a + b; }
232
233 // makes bright even brighter
234 // reduces contrast
235 float screen(float &a, float &b) {
236
237 return (1 - (1 - a / 255.f) * (1 - b / 255.f)) * 255.f;
238 }
239
240 float colordodge(float &a, float &b) { return (a / (255.f - b)) * 255.f; }
241 /*
242 Ken Perlins improved noise - http://mrl.nyu.edu/~perlin/noise/
243 C-port: http://www.fundza.com/c4serious/noise/perlin/perlin.html
244 by Malcolm Kesson; arduino port by Peter Chiochetti, Sep 2007 :
245 - make permutation constant byte, obsoletes init(), lookup % 256
246 */
247
248 float fade(float t) { return t * t * t * (t * (t * 6 - 15) + 10); }
249 float lerp(float t, float a, float b) { return a + t * (b - a); }
250 float grad(int hash, float x, float y, float z) {
251 int h = hash & 15; /* CONVERT LO 4 BITS OF HASH CODE */
252 float u = h < 8 ? x : y, /* INTO 12 GRADIENT DIRECTIONS. */
253 v = h < 4 ? y
254 : h == 12 || h == 14 ? x
255 : z;
256 return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
257 }
258
259
260 float pnoise(float x, float y, float z) {
261
262 int X = (int)floorf(x) & 255, /* FIND UNIT CUBE THAT */
263 Y = (int)floorf(y) & 255, /* CONTAINS POINT. */
264 Z = (int)floorf(z) & 255;
265 x -= floorf(x); /* FIND RELATIVE X,Y,Z */
266 y -= floorf(y); /* OF POINT IN CUBE. */
267 z -= floorf(z);
268 float u = fade(x), /* COMPUTE FADE CURVES */
269 v = fade(y), /* FOR EACH OF X,Y,Z. */
270 w = fade(z);
271 int A = P(X) + Y, AA = P(A) + Z,
272 AB = P(A + 1) + Z, /* HASH COORDINATES OF */
273 B = P(X + 1) + Y, BA = P(B) + Z,
274 BB = P(B + 1) + Z; /* THE 8 CUBE CORNERS, */
275
276 return lerp(w,
277 lerp(v,
278 lerp(u, grad(P(AA), x, y, z), /* AND ADD */
279 grad(P(BA), x - 1, y, z)), /* BLENDED */
280 lerp(u, grad(P(AB), x, y - 1, z), /* RESULTS */
281 grad(P(BB), x - 1, y - 1, z))), /* FROM 8 */
282 lerp(v,
283 lerp(u, grad(P(AA + 1), x, y, z - 1), /* CORNERS */
284 grad(P(BA + 1), x - 1, y, z - 1)), /* OF CUBE */
285 lerp(u, grad(P(AB + 1), x, y - 1, z - 1),
286 grad(P(BB + 1), x - 1, y - 1, z - 1))));
287 }
288
290
291 double runtime = getTime() * timings.master_speed *
292 speed_factor; // global anaimation speed
293
294 for (int i = 0; i < num_oscillators; i++) {
295
296 move.linear[i] =
297 (runtime + timings.offset[i]) *
298 timings.ratio[i]; // continously rising offsets, returns 0 to
299 // max_float
300
301 move.radial[i] = fmodf(move.linear[i],
302 2 * PI); // angle offsets for continous
303 // rotation, returns 0 to 2 * PI
304
305 move.directional[i] =
306 sinf(move.radial[i]); // directional offsets or factors, returns
307 // -1 to 1
308
309 move.noise_angle[i] =
310 PI *
311 (1 +
312 pnoise(move.linear[i], 0,
313 0)); // noise based angle offset, returns 0 to 2 * PI
314 }
315 }
316
317 void run_default_oscillators(float master_speed = 0.005) {
318 timings.master_speed = master_speed;
319
320 timings.ratio[0] = 1; // speed ratios for the oscillators, higher values
321 // = faster transitions
322 timings.ratio[1] = 2;
323 timings.ratio[2] = 3;
324 timings.ratio[3] = 4;
325 timings.ratio[4] = 5;
326 timings.ratio[5] = 6;
327 timings.ratio[6] = 7;
328 timings.ratio[7] = 8;
329 timings.ratio[8] = 9;
330 timings.ratio[9] = 10;
331
332 timings.offset[0] = 000;
333 timings.offset[1] = 100;
334 timings.offset[2] = 200;
335 timings.offset[3] = 300;
336 timings.offset[4] = 400;
337 timings.offset[5] = 500;
338 timings.offset[6] = 600;
339 timings.offset[7] = 700;
340 timings.offset[8] = 800;
341 timings.offset[9] = 900;
342
344 }
345
346 // Convert the 2 polar coordinates back to cartesian ones & also apply all
347 // 3d transitions. Calculate the noise value at this point based on the 5
348 // dimensional manipulation of the underlaying coordinates.
349
351
352 // convert polar coordinates back to cartesian ones
353
354 float newx = (animation.offset_x + animation.center_x -
355 (cosf(animation.angle) * animation.dist)) *
356 animation.scale_x;
357 float newy = (animation.offset_y + animation.center_y -
358 (sinf(animation.angle) * animation.dist)) *
359 animation.scale_y;
360 float newz = (animation.offset_z + animation.z) * animation.scale_z;
361
362 // render noisevalue at this new cartesian point
363
364 float raw_noise_field_value = pnoise(newx, newy, newz);
365
366 // A) enhance histogram (improve contrast) by setting the black and
367 // white point (low & high_limit) B) scale the result to a 0-255 range
368 // (assuming you want 8 bit color depth per rgb chanel) Here happens the
369 // contrast boosting & the brightness mapping
370
371 if (raw_noise_field_value < animation.low_limit)
372 raw_noise_field_value = animation.low_limit;
373 if (raw_noise_field_value > animation.high_limit)
374 raw_noise_field_value = animation.high_limit;
375
376 float scaled_noise_value =
377 map_float(raw_noise_field_value, animation.low_limit,
378 animation.high_limit, 0, 255);
379
380 return scaled_noise_value;
381 }
382
383 // given a static polar origin we can precalculate
384 // the polar coordinates
385
386 void render_polar_lookup_table(float cx, float cy) {
389
390 for (int xx = 0; xx < num_x; xx++) {
391 for (int yy = 0; yy < num_y; yy++) {
392
393 float dx = xx - cx;
394 float dy = yy - cy;
395
396 distance[xx][yy] = hypotf(dx, dy);
397 polar_theta[xx][yy] = atan2f(dy, dx);
398 }
399 }
400 }
401
402 // float mapping maintaining 32 bit precision
403 // we keep values with high resolution for potential later usage
404
405 float map_float(float x, float in_min, float in_max, float out_min,
406 float out_max) {
407
408 float result =
409 (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
410 if (result < out_min)
411 result = out_min;
412 if (result > out_max)
413 result = out_max;
414
415 return result;
416 }
417
418 /* unnecessary bloat
419
420 // check result after colormapping and store the newly rendered rgb data
421
422 void write_pixel_to_framebuffer(int x, int y, rgb &pixel) {
423
424 // assign the final color of this one pixel
425 CRGB finalcolor = CRGB(pixel.red, pixel.green, pixel.blue);
426
427 // write the rendered pixel into the framebutter
428 leds[xyMap(x, y)] = finalcolor;
429 }
430 */
431
432 // Avoid any possible color flicker by forcing the raw RGB values to be
433 // 0-255. This enables to play freely with random equations for the
434 // colormapping without causing flicker by accidentally missing the valid
435 // target range.
436
438
439 // rescue data if possible, return absolute value
440 // if (pixel.red < 0) pixel.red = fabsf(pixel.red);
441 // if (pixel.green < 0) pixel.green = fabsf(pixel.green);
442 // if (pixel.blue < 0) pixel.blue = fabsf(pixel.blue);
443
444 // Can never be negative colour
445 if (pixel.red < 0)
446 pixel.red = 0;
447 if (pixel.green < 0)
448 pixel.green = 0;
449 if (pixel.blue < 0)
450 pixel.blue = 0;
451
452 // discard everything above the valid 8 bit colordepth 0-255 range
453 if (pixel.red > 255)
454 pixel.red = 255;
455 if (pixel.green > 255)
456 pixel.green = 255;
457 if (pixel.blue > 255)
458 pixel.blue = 255;
459
460 return pixel;
461 }
462
463 // find the right led index according to you LED matrix wiring
464
465 void get_ready() { // wait until new buffer is ready, measure time
466 a = micros();
467 logOutput();
468 }
469
470 virtual void setPixelColorInternal(int x, int y, rgb pixel) = 0;
471
472 // virtual void setPixelColorInternal(int index, rgb pixel) = 0;
473
474 void logOutput() { b = micros(); }
475
476 void logFrame() { c = micros(); }
477
478 // Show the current framerate, rendered pixels per second,
479 // rendering time & time spend to push the data to the leds.
480 // in the serial monitor.
481
483
484 float calc = b - a; // waiting time
485 float push = c - b; // rendering time
486 float total = c - a; // time per frame
487 int fps = 1000000 / total; // frames per second
488 int kpps = (fps * num_x * num_y) / 1000; // kilopixel per second
489
490 ANIMARTRIX_PRINT(fps);
491 ANIMARTRIX_PRINT(" fps ");
492 ANIMARTRIX_PRINT(kpps);
493 ANIMARTRIX_PRINT(" kpps @");
495 ANIMARTRIX_PRINT(" LEDs ");
496 ANIMARTRIX_PRINT(round(total));
497 ANIMARTRIX_PRINT(" µs per frame waiting: ");
498 ANIMARTRIX_PRINT(round((calc * 100) / total));
499 ANIMARTRIX_PRINT("% rendering: ");
500 ANIMARTRIX_PRINT(round((push * 100) / total));
501 ANIMARTRIX_PRINT("% (");
502 ANIMARTRIX_PRINT(round(calc));
503 ANIMARTRIX_PRINT(" + ");
504 ANIMARTRIX_PRINT(round(push));
505 ANIMARTRIX_PRINT(" µs) Core-temp: ");
506 // TODO ANIMARTRIX_PRINT( tempmonGetTemp() );
507 //Serial.println(" °C");
508 ANIMARTRIX_PRINT(" °C\n");
509 }
510
511 // Effects
512
514
515 get_ready();
516
517 timings.master_speed = 0.01; // speed ratios for the oscillators
518 timings.ratio[0] = 0.1; // higher values = faster transitions
519 timings.ratio[1] = 0.03;
520 timings.ratio[2] = 0.03;
521 timings.ratio[3] = 0.03;
522
523 timings.offset[1] = 10;
524 timings.offset[2] = 20;
525 timings.offset[3] = 30;
526
528 timings); // get linear movers and oscillators going
529
530 for (int x = 0; x < num_x; x++) {
531 for (int y = 0; y < num_y; y++) {
532
533 // describe and render animation layers
534 animation.scale_x = 0.05;
535 animation.scale_y = 0.05;
536 animation.offset_x = 0;
537 animation.offset_y = 0;
538 animation.offset_z = 100;
539 animation.angle = polar_theta[x][y] + move.radial[0];
540 animation.dist = distance[x][y];
541 animation.z = move.linear[0];
542 animation.low_limit = -1;
544
545 animation.angle =
546 polar_theta[x][y] - move.radial[1] + show1 / 512.0;
547 animation.dist = distance[x][y] * show1 / 255.0;
548 animation.low_limit = 0;
549 animation.z = move.linear[1];
551
552 animation.angle =
553 polar_theta[x][y] - move.radial[2] + show1 / 512.0;
554 animation.dist = distance[x][y] * show1 / 220.0;
555 animation.z = move.linear[2];
557
558 animation.angle =
559 polar_theta[x][y] - move.radial[3] + show1 / 512.0;
560 animation.dist = distance[x][y] * show1 / 200.0;
561 animation.z = move.linear[3];
563
564 // colormapping
565 pixel.red = (show2 + show4) / 2;
566 pixel.green = show3 / 6;
567 pixel.blue = 0;
568
570
572 }
573 }
574 }
575
577
578 get_ready();
579
580 timings.master_speed = 0.01; // speed ratios for the oscillators
581 timings.ratio[0] = 0.1; // higher values = faster transitions
582 timings.ratio[1] = 0.13;
583 timings.ratio[2] = 0.16;
584
585 timings.offset[1] = 10;
586 timings.offset[2] = 20;
587 timings.offset[3] = 30;
588
590 timings); // get linear movers and oscillators going
591
592 for (int x = 0; x < num_x; x++) {
593 for (int y = 0; y < num_y; y++) {
594
595 // describe and render animation layers
596 animation.angle =
597 3 * polar_theta[x][y] + move.radial[0] - distance[x][y] / 3;
598 animation.dist = distance[x][y];
599 animation.scale_z = 0.1;
600 animation.scale_y = 0.1;
601 animation.scale_x = 0.1;
602 animation.offset_x = move.linear[0];
603 animation.offset_y = 0;
604 animation.offset_z = 0;
605 animation.z = 0;
607
608 animation.angle =
609 3 * polar_theta[x][y] + move.radial[1] - distance[x][y] / 3;
610 animation.dist = distance[x][y];
611 animation.offset_x = move.linear[1];
613
614 animation.angle =
615 3 * polar_theta[x][y] + move.radial[2] - distance[x][y] / 3;
616 animation.dist = distance[x][y];
617 animation.offset_x = move.linear[2];
619
620 // colormapping
621 float radius = radial_filter_radius;
622 float radial_filter = (radius - distance[x][y]) / radius;
623
624 pixel.red = 3 * show1 * radial_filter;
625 pixel.green = show2 * radial_filter / 2;
626 pixel.blue = show3 * radial_filter / 4;
627
629
631 }
632 }
633 }
634
635 void Rings() {
636
637 get_ready();
638
639 timings.master_speed = 0.01; // speed ratios for the oscillators
640 timings.ratio[0] = 1; // higher values = faster transitions
641 timings.ratio[1] = 1.1;
642 timings.ratio[2] = 1.2;
643
644 timings.offset[1] = 100;
645 timings.offset[2] = 200;
646 timings.offset[3] = 300;
647
649 timings); // get linear movers and oscillators going
650
651 for (int x = 0; x < num_x; x++) {
652 for (int y = 0; y < num_y; y++) {
653
654 // describe and render animation layers
655 animation.angle = 5;
656 animation.scale_x = 0.2;
657 animation.scale_y = 0.2;
658 animation.scale_z = 1;
659 animation.dist = distance[x][y];
660 animation.offset_y = -move.linear[0];
661 animation.offset_x = 0;
663
664 // describe and render animation layers
665 animation.angle = 10;
666
667 animation.dist = distance[x][y];
668 animation.offset_y = -move.linear[1];
670
671 // describe and render animation layers
672 animation.angle = 12;
673
674 animation.dist = distance[x][y];
675 animation.offset_y = -move.linear[2];
677
678 // colormapping
679 pixel.red = show1;
680 pixel.green = show2 / 4;
681 pixel.blue = show3 / 4;
682
684
686 }
687 }
688 }
689
690 void Waves() {
691
692 get_ready();
693
694 timings.master_speed = 0.01; // speed ratios for the oscillators
695 timings.ratio[0] = 2; // higher values = faster transitions
696 timings.ratio[1] = 2.1;
697 timings.ratio[2] = 1.2;
698
699 timings.offset[1] = 100;
700 timings.offset[2] = 200;
701 timings.offset[3] = 300;
702
704 timings); // get linear movers and oscillators going
705
706 for (int x = 0; x < num_x; x++) {
707 for (int y = 0; y < num_y; y++) {
708
709 // describe and render animation layers
710 animation.angle = polar_theta[x][y];
711 animation.scale_x = 0.1;
712 animation.scale_y = 0.1;
713 animation.scale_z = 0.1;
714 animation.dist = distance[x][y];
715 animation.offset_y = 0;
716 animation.offset_x = 0;
717 animation.z = 2 * distance[x][y] - move.linear[0];
719
720 animation.angle = polar_theta[x][y];
721 animation.dist = distance[x][y];
722 animation.z = 2 * distance[x][y] - move.linear[1];
724
725 // colormapping
726 pixel.red = show1;
727 pixel.green = 0;
728 pixel.blue = show2;
729
731
733 }
734 }
735 }
736
738
739 get_ready();
740
741 timings.master_speed = 0.01; // speed ratios for the oscillators
742 timings.ratio[0] = 1; // higher values = faster transitions
743 timings.ratio[1] = 1.1;
744 timings.ratio[2] = 1.2;
745
746 timings.offset[1] = 100;
747 timings.offset[2] = 200;
748 timings.offset[3] = 300;
749
751 timings); // get linear movers and oscillators going
752
753 for (int x = 0; x < num_x; x++) {
754 for (int y = 0; y < num_y; y++) {
755
756 // describe and render animation layers
757 animation.angle = polar_theta[x][y];
758 animation.scale_x = 0.07;
759 animation.scale_y = 0.07;
760 animation.scale_z = 0.1;
761 animation.dist = 5 * sqrtf(distance[x][y]);
762 animation.offset_y = move.linear[0];
763 animation.offset_x = 0;
764 animation.z = 0;
766
767 animation.angle = polar_theta[x][y];
768 animation.scale_x = 0.07;
769 animation.scale_y = 0.07;
770 animation.scale_z = 0.1;
771 animation.dist = 4 * sqrtf(distance[x][y]);
772 animation.offset_y = move.linear[0];
773 animation.offset_x = 0;
774 animation.z = 0;
776
777 // colormapping
778 pixel.red = show1;
779 pixel.green = show2;
780 pixel.blue = 0;
781
783
785 }
786 }
787 }
788
790
791 get_ready();
792
793 timings.master_speed = 0.01; // speed ratios for the oscillators
794 timings.ratio[0] = 0.2; // higher values = faster transitions
795 timings.ratio[1] = 0.13;
796 timings.ratio[2] = 0.012;
797
798 timings.offset[1] = 100;
799 timings.offset[2] = 200;
800 timings.offset[3] = 300;
801
803 timings); // get linear movers and oscillators going
804
805 for (int x = 0; x < num_x; x++) {
806 for (int y = 0; y < num_y; y++) {
807
808 // describe and render animation layers
809 animation.dist = powf(distance[x][y], 0.5);
810 animation.angle = polar_theta[x][y] + move.radial[0];
811 animation.scale_x = 0.07;
812 animation.scale_y = 0.07;
813 animation.scale_z = 0.1;
814 animation.offset_y = move.linear[0];
815 animation.offset_x = 0;
816 animation.offset_z = 0;
817 animation.z = 0;
819
820 animation.dist = powf(distance[x][y], 0.6);
821 animation.angle = polar_theta[x][y] + move.noise_angle[2];
822 animation.scale_x = 0.07;
823 animation.scale_y = 0.07;
824 animation.scale_z = 0.1;
825 animation.offset_y = move.linear[1];
826 animation.offset_x = 0;
827 animation.offset_z = 0;
828 animation.z = 0;
830
831 // colormapping
832 pixel.red = show1 + show2;
833 pixel.green = show2;
834 pixel.blue = 0;
835
837
839 }
840 }
841 }
842
843 void Caleido1() {
844
845 get_ready();
846
847 timings.master_speed = 0.003; // speed ratios for the oscillators
848 timings.ratio[0] = 0.02; // higher values = faster transitions
849 timings.ratio[1] = 0.03;
850 timings.ratio[2] = 0.04;
851 timings.ratio[3] = 0.05;
852 timings.ratio[4] = 0.6;
853 timings.offset[0] = 0;
854 timings.offset[1] = 100;
855 timings.offset[2] = 200;
856 timings.offset[3] = 300;
857 timings.offset[4] = 400;
858
860 timings); // get linear movers and oscillators going
861
862 for (int x = 0; x < num_x; x++) {
863 for (int y = 0; y < num_y; y++) {
864
865 // describe and render animation layers
866 animation.dist = distance[x][y] * (2 + move.directional[0]) / 3;
867 animation.angle = 3 * polar_theta[x][y] +
868 3 * move.noise_angle[0] + move.radial[4];
869 animation.scale_x = 0.1;
870 animation.scale_y = 0.1;
871 animation.scale_z = 0.1;
872 animation.offset_y = 2 * move.linear[0];
873 animation.offset_x = 0;
874 animation.offset_z = 0;
875 animation.z = move.linear[0];
877
878 animation.dist = distance[x][y] * (2 + move.directional[1]) / 3;
879 animation.angle = 4 * polar_theta[x][y] +
880 3 * move.noise_angle[1] + move.radial[4];
881 animation.offset_x = 2 * move.linear[1];
882 animation.z = move.linear[1];
884
885 animation.dist = distance[x][y] * (2 + move.directional[2]) / 3;
886 animation.angle = 5 * polar_theta[x][y] +
887 3 * move.noise_angle[2] + move.radial[4];
888 animation.offset_y = 2 * move.linear[2];
889 animation.z = move.linear[2];
891
892 animation.dist = distance[x][y] * (2 + move.directional[3]) / 3;
893 animation.angle = 4 * polar_theta[x][y] +
894 3 * move.noise_angle[3] + move.radial[4];
895 animation.offset_x = 2 * move.linear[3];
896 animation.z = move.linear[3];
898
899 // colormapping
900 pixel.red = show1;
901 pixel.green = show3 * distance[x][y] / 10;
902 pixel.blue = (show2 + show4) / 2;
903
905
907 }
908 }
909 }
910
911 void Caleido2() {
912
913 get_ready();
914
915 timings.master_speed = 0.002; // speed ratios for the oscillators
916 timings.ratio[0] = 0.02; // higher values = faster transitions
917 timings.ratio[1] = 0.03;
918 timings.ratio[2] = 0.04;
919 timings.ratio[3] = 0.05;
920 timings.ratio[4] = 0.6;
921 timings.offset[0] = 0;
922 timings.offset[1] = 100;
923 timings.offset[2] = 200;
924 timings.offset[3] = 300;
925 timings.offset[4] = 400;
926
928 timings); // get linear movers and oscillators going
929
930 for (int x = 0; x < num_x; x++) {
931 for (int y = 0; y < num_y; y++) {
932
933 // describe and render animation layers
934 animation.dist = distance[x][y] * (2 + move.directional[0]) / 3;
935 animation.angle = 2 * polar_theta[x][y] +
936 3 * move.noise_angle[0] + move.radial[4];
937 animation.scale_x = 0.1;
938 animation.scale_y = 0.1;
939 animation.scale_z = 0.1;
940 animation.offset_y = 2 * move.linear[0];
941 animation.offset_x = 0;
942 animation.offset_z = 0;
943 animation.z = move.linear[0];
945
946 animation.dist = distance[x][y] * (2 + move.directional[1]) / 3;
947 animation.angle = 2 * polar_theta[x][y] +
948 3 * move.noise_angle[1] + move.radial[4];
949 animation.offset_x = 2 * move.linear[1];
950 animation.z = move.linear[1];
952
953 animation.dist = distance[x][y] * (2 + move.directional[2]) / 3;
954 animation.angle = 2 * polar_theta[x][y] +
955 3 * move.noise_angle[2] + move.radial[4];
956 animation.offset_y = 2 * move.linear[2];
957 animation.z = move.linear[2];
959
960 animation.dist = distance[x][y] * (2 + move.directional[3]) / 3;
961 animation.angle = 2 * polar_theta[x][y] +
962 3 * move.noise_angle[3] + move.radial[4];
963 animation.offset_x = 2 * move.linear[3];
964 animation.z = move.linear[3];
966
967 // colormapping
968 pixel.red = show1;
969 pixel.green = show3 * distance[x][y] / 10;
970 pixel.blue = (show2 + show4) / 2;
971
973
975 }
976 }
977 }
978
979 void Caleido3() {
980
981 get_ready();
982
983 timings.master_speed = 0.004; // speed ratios for the oscillators
984 timings.ratio[0] = 0.02; // higher values = faster transitions
985 timings.ratio[1] = 0.03;
986 timings.ratio[2] = 0.04;
987 timings.ratio[3] = 0.05;
988 timings.ratio[4] = 0.6;
989 timings.offset[0] = 0;
990 timings.offset[1] = 100;
991 timings.offset[2] = 200;
992 timings.offset[3] = 300;
993 timings.offset[4] = 400;
994
996 timings); // get linear movers and oscillators going
997
998 for (int x = 0; x < num_x; x++) {
999 for (int y = 0; y < num_y; y++) {
1000
1001 // describe and render animation layers
1002 animation.dist = distance[x][y] * (2 + move.directional[0]) / 3;
1003 animation.angle = 2 * polar_theta[x][y] +
1004 3 * move.noise_angle[0] + move.radial[4];
1005 animation.scale_x = 0.1; // + (move.directional[0] + 2)/100;
1006 animation.scale_y = 0.1; // + (move.directional[1] + 2)/100;
1007 animation.scale_z = 0.1;
1008 animation.offset_y = 2 * move.linear[0];
1009 animation.offset_x = 2 * move.linear[1];
1010 animation.offset_z = 0;
1011 animation.z = move.linear[0];
1012 float show1 = render_value(animation);
1013
1014 animation.dist = distance[x][y] * (2 + move.directional[1]) / 3;
1015 animation.angle = 2 * polar_theta[x][y] +
1016 3 * move.noise_angle[1] + move.radial[4];
1017 animation.offset_x = 2 * move.linear[1];
1018 animation.offset_y = show1 / 20.0;
1019 animation.z = move.linear[1];
1020 float show2 = render_value(animation);
1021
1022 animation.dist = distance[x][y] * (2 + move.directional[2]) / 3;
1023 animation.angle = 2 * polar_theta[x][y] +
1024 3 * move.noise_angle[2] + move.radial[4];
1025 animation.offset_y = 2 * move.linear[2];
1026 animation.offset_x = show2 / 20.0;
1027 animation.z = move.linear[2];
1028 float show3 = render_value(animation);
1029
1030 animation.dist = distance[x][y] * (2 + move.directional[3]) / 3;
1031 animation.angle = 2 * polar_theta[x][y] +
1032 3 * move.noise_angle[3] + move.radial[4];
1033 animation.offset_x = 2 * move.linear[3];
1034 animation.offset_y = show3 / 20.0;
1035 animation.z = move.linear[3];
1036 float show4 = render_value(animation);
1037
1038 // colormapping
1039 float radius = radial_filter_radius; // radial mask
1040
1041 pixel.red = show1 * (y + 1) / num_y;
1042 pixel.green = show3 * distance[x][y] / 10;
1043 pixel.blue = (show2 + show4) / 2;
1044 if (distance[x][y] > radius) {
1045 pixel.red = 0;
1046 pixel.green = 0;
1047 pixel.blue = 0;
1048 }
1049
1051
1053 }
1054 }
1055 }
1056
1057 void Lava1() {
1058
1059 get_ready();
1060
1061 timings.master_speed = 0.0015; // speed ratios for the oscillators
1062 timings.ratio[0] = 4; // higher values = faster transitions
1063 timings.ratio[1] = 1;
1064 timings.ratio[2] = 1;
1065 timings.ratio[3] = 0.05;
1066 timings.ratio[4] = 0.6;
1067 timings.offset[0] = 0;
1068 timings.offset[1] = 100;
1069 timings.offset[2] = 200;
1070 timings.offset[3] = 300;
1071 timings.offset[4] = 400;
1072
1074 timings); // get linear movers and oscillators going
1075
1076 for (int x = 0; x < num_x; x++) {
1077 for (int y = 0; y < num_y; y++) {
1078
1079 // describe and render animation layers
1080 animation.dist = distance[x][y] * 0.8;
1081 animation.angle = polar_theta[x][y];
1082 animation.scale_x = 0.15; // + (move.directional[0] + 2)/100;
1083 animation.scale_y = 0.12; // + (move.directional[1] + 2)/100;
1084 animation.scale_z = 0.01;
1085 animation.offset_y = -move.linear[0];
1086 animation.offset_x = 0;
1087 animation.offset_z = 0;
1088 animation.z = 30;
1089 float show1 = render_value(animation);
1090
1091 animation.offset_y = -move.linear[1];
1092 animation.scale_x = 0.15; // + (move.directional[0] + 2)/100;
1093 animation.scale_y = 0.12; // + (move.directional[1] + 2)/100;
1094 animation.offset_x = show1 / 100;
1095 animation.offset_y += show1 / 100;
1096
1097 float show2 = render_value(animation);
1098
1099 animation.offset_y = -move.linear[2];
1100 animation.scale_x = 0.15; // + (move.directional[0] + 2)/100;
1101 animation.scale_y = 0.12; // + (move.directional[1] + 2)/100;
1102 animation.offset_x = show2 / 100;
1103 animation.offset_y += show2 / 100;
1104
1105 float show3 = render_value(animation);
1106
1107 // colormapping
1108 float linear = (y) / (num_y - 1.f); // radial mask
1109
1110 pixel.red = linear * show2;
1111 pixel.green = 0.1 * linear * (show2 - show3);
1112 pixel.blue = 0;
1113
1115
1117 }
1118 }
1119 }
1120
1121 void Scaledemo1() {
1122
1123 get_ready();
1124
1125 timings.master_speed = 0.000001; // speed ratios for the oscillators
1126 timings.ratio[0] = 0.4; // higher values = faster transitions
1127 timings.ratio[1] = 0.32;
1128 timings.ratio[2] = 0.10;
1129 timings.ratio[3] = 0.05;
1130 timings.ratio[4] = 0.6;
1131 timings.offset[0] = 0;
1132 timings.offset[1] = 100;
1133 timings.offset[2] = 200;
1134 timings.offset[3] = 300;
1135 timings.offset[4] = 400;
1136
1138 timings); // get linear movers and oscillators going
1139
1140 for (int x = 0; x < num_x; x++) {
1141 for (int y = 0; y < num_y; y++) {
1142
1143 // describe and render animation layers
1144 animation.dist = 0.3 * distance[x][y] * 0.8;
1145 animation.angle = 3 * polar_theta[x][y] + move.radial[2];
1146 animation.scale_x = 0.1 + (move.noise_angle[0]) / 10;
1147 animation.scale_y =
1148 0.1 + (move.noise_angle[1]) /
1149 10; // + (move.directional[1] + 2)/100;
1150 animation.scale_z = 0.01;
1151 animation.offset_y = 0;
1152 animation.offset_x = 0;
1153 animation.offset_z = 100 * move.linear[0];
1154 animation.z = 30;
1155 float show1 = render_value(animation);
1156
1157 animation.angle = 3;
1158 float show2 = render_value(animation);
1159
1160 float dist = 1; //(10-distance[x][y])/ 10;
1161 pixel.red = show1 * dist;
1162 pixel.green = (show1 - show2) * dist * 0.3;
1163 pixel.blue = (show2 - show1) * dist;
1164
1165 if (distance[x][y] > 16) {
1166 pixel.red = 0;
1167 pixel.green = 0;
1168 pixel.blue = 0;
1169 }
1170
1172
1174 }
1175 }
1176 }
1177
1178 void Yves() {
1179
1180 get_ready();
1181
1182 a = micros(); // for time measurement in report_performance()
1183
1184 timings.master_speed = 0.001; // speed ratios for the oscillators
1185 timings.ratio[0] = 3; // higher values = faster transitions
1186 timings.ratio[1] = 2;
1187 timings.ratio[2] = 1;
1188 timings.ratio[3] = 0.13;
1189 timings.ratio[4] = 0.15;
1190 timings.ratio[5] = 0.03;
1191 timings.ratio[6] = 0.025;
1192 timings.offset[0] = 0;
1193 timings.offset[1] = 100;
1194 timings.offset[2] = 200;
1195 timings.offset[3] = 300;
1196 timings.offset[4] = 400;
1197 timings.offset[5] = 500;
1198 timings.offset[6] = 600;
1199
1201 timings); // get linear movers and oscillators going
1202
1203 for (int x = 0; x < num_x; x++) {
1204 for (int y = 0; y < num_y; y++) {
1205
1206 animation.dist = distance[x][y];
1207 animation.angle =
1208 polar_theta[x][y] + 2 * PI + move.noise_angle[5];
1209 animation.scale_x = 0.08;
1210 animation.scale_y = 0.08;
1211 animation.scale_z = 0.08;
1212 animation.offset_y = -move.linear[0];
1213 animation.offset_x = 0;
1214 animation.offset_z = 0;
1215 animation.z = 0;
1216 float show1 = render_value(animation);
1217
1218 animation.dist = distance[x][y];
1219 animation.angle =
1220 polar_theta[x][y] + 2 * PI + move.noise_angle[6];
1221 ;
1222 animation.scale_x = 0.08;
1223 animation.scale_y = 0.08;
1224 animation.scale_z = 0.08;
1225 animation.offset_y = -move.linear[1];
1226 animation.offset_x = 0;
1227 animation.offset_z = 0;
1228 animation.z = 0;
1229 float show2 = render_value(animation);
1230
1231 animation.angle = polar_theta[x][y] + show1 / 100 +
1232 move.noise_angle[3] + move.noise_angle[4];
1233 animation.dist = distance[x][y] + show2 / 50;
1234 animation.offset_y = -move.linear[2];
1235
1236 animation.offset_y += show1 / 100;
1237 animation.offset_x += show2 / 100;
1238
1239 float show3 = render_value(animation);
1240
1241 animation.offset_y = 0;
1242 animation.offset_x = 0;
1243
1244 float show4 = render_value(animation);
1245
1246 pixel.red = show3;
1247 pixel.green = show3 * show4 / 255;
1248 pixel.blue = 0;
1249
1252 }
1253 }
1254 }
1255
1256 void Spiralus() {
1257
1258 get_ready();
1259
1260 timings.master_speed = 0.0011; // speed ratios for the oscillators
1261 timings.ratio[0] = 1.5; // higher values = faster transitions
1262 timings.ratio[1] = 2.3;
1263 timings.ratio[2] = 3;
1264 timings.ratio[3] = 0.05;
1265 timings.ratio[4] = 0.2;
1266 timings.ratio[5] = 0.03;
1267 timings.ratio[6] = 0.025;
1268 timings.ratio[7] = 0.021;
1269 timings.ratio[8] = 0.027;
1270 timings.offset[0] = 0;
1271 timings.offset[1] = 100;
1272 timings.offset[2] = 200;
1273 timings.offset[3] = 300;
1274 timings.offset[4] = 400;
1275 timings.offset[5] = 500;
1276 timings.offset[6] = 600;
1277
1279 timings); // get linear movers and oscillators going
1280
1281 for (int x = 0; x < num_x; x++) {
1282 for (int y = 0; y < num_y; y++) {
1283
1284 animation.dist = distance[x][y];
1285 animation.angle = 2 * polar_theta[x][y] + move.noise_angle[5] +
1286 move.directional[3] * move.noise_angle[6] *
1287 animation.dist / 10;
1288 animation.scale_x = 0.08;
1289 animation.scale_y = 0.08;
1290 animation.scale_z = 0.02;
1291 animation.offset_y = -move.linear[0];
1292 animation.offset_x = 0;
1293 animation.offset_z = 0;
1294 animation.z = move.linear[1];
1295 float show1 = render_value(animation);
1296
1297 animation.angle = 2 * polar_theta[x][y] + move.noise_angle[7] +
1298 move.directional[5] * move.noise_angle[8] *
1299 animation.dist / 10;
1300 animation.offset_y = -move.linear[1];
1301 animation.z = move.linear[2];
1302
1303 float show2 = render_value(animation);
1304
1305 animation.angle = 2 * polar_theta[x][y] + move.noise_angle[6] +
1306 move.directional[6] * move.noise_angle[7] *
1307 animation.dist / 10;
1308 animation.offset_y = move.linear[2];
1309 animation.z = move.linear[0];
1310 float show3 = render_value(animation);
1311
1312 float f = 1;
1313
1314 pixel.red = f * (show1 + show2);
1315 pixel.green = f * (show1 - show2);
1316 pixel.blue = f * (show3 - show1);
1317
1320 }
1321 }
1322 }
1323
1324 void Spiralus2() {
1325
1326 get_ready();
1327
1328 timings.master_speed = 0.0015; // speed ratios for the oscillators
1329 timings.ratio[0] = 1.5; // higher values = faster transitions
1330 timings.ratio[1] = 2.3;
1331 timings.ratio[2] = 3;
1332 timings.ratio[3] = 0.05;
1333 timings.ratio[4] = 0.2;
1334 timings.ratio[5] = 0.05;
1335 timings.ratio[6] = 0.055;
1336 timings.ratio[7] = 0.06;
1337 timings.ratio[8] = 0.027;
1338 timings.offset[0] = 0;
1339 timings.offset[1] = 100;
1340 timings.offset[2] = 200;
1341 timings.offset[3] = 300;
1342 timings.offset[4] = 400;
1343 timings.offset[5] = 500;
1344 timings.offset[6] = 600;
1345
1347 timings); // get linear movers and oscillators going
1348
1349 for (int x = 0; x < num_x; x++) {
1350 for (int y = 0; y < num_y; y++) {
1351
1352 animation.dist = distance[x][y];
1353 animation.angle = 5 * polar_theta[x][y] + move.noise_angle[5] +
1354 move.directional[3] * move.noise_angle[6] *
1355 animation.dist / 10;
1356 animation.scale_x = 0.08;
1357 animation.scale_y = 0.08;
1358 animation.scale_z = 0.02;
1359 animation.offset_y = -move.linear[0];
1360 animation.offset_x = 0;
1361 animation.offset_z = 0;
1362 animation.z = move.linear[1];
1363 float show1 = render_value(animation);
1364
1365 animation.angle = 6 * polar_theta[x][y] + move.noise_angle[7] +
1366 move.directional[5] * move.noise_angle[8] *
1367 animation.dist / 10;
1368 animation.offset_y = -move.linear[1];
1369 animation.z = move.linear[2];
1370
1371 float show2 = render_value(animation);
1372
1373 animation.angle = 6 * polar_theta[x][y] + move.noise_angle[6] +
1374 move.directional[6] * move.noise_angle[7] *
1375 animation.dist / 10;
1376 animation.offset_y = move.linear[2];
1377 animation.z = move.linear[0];
1378 animation.dist = distance[x][y] * 0.8;
1379 float show3 = render_value(animation);
1380
1381 float f = 1; //(24-distance[x][y])/24;
1382
1383 pixel.red = f * (show1 + show2);
1384 pixel.green = f * (show1 - show2);
1385 pixel.blue = f * (show3 - show1);
1386
1389 }
1390 }
1391 }
1392
1393 void Hot_Blob() { // nice one
1394
1395 get_ready();
1397
1398 for (int x = 0; x < num_x; x++) {
1399 for (int y = 0; y < num_y; y++) {
1400
1401 animation.dist = distance[x][y];
1402 animation.angle = polar_theta[x][y];
1403
1404 animation.scale_x = 0.07 + move.directional[0] * 0.002;
1405 animation.scale_y = 0.07;
1406
1407 animation.offset_y = -move.linear[0];
1408 animation.offset_x = 0;
1409 animation.offset_z = 0;
1410
1411 animation.z = 0;
1412 animation.low_limit = -1;
1413 float show1 = render_value(animation);
1414
1415 animation.offset_y = -move.linear[1];
1416 float show3 = render_value(animation);
1417
1418 animation.offset_x = show3 / 20;
1419 animation.offset_y = -move.linear[0] / 2 + show1 / 70;
1420 animation.low_limit = 0;
1421 float show2 = render_value(animation);
1422
1423 animation.offset_x = show3 / 20;
1424 animation.offset_y = -move.linear[0] / 2 + show1 / 70;
1425 animation.z = 100;
1426 float show4 = render_value(animation);
1427
1428 float radius = radial_filter_radius; // radius of a radial
1429 // brightness filter
1430 float radial = (radius - animation.dist) / animation.dist;
1431
1432 float linear = (y + 1) / (num_y - 1.f);
1433
1434 pixel.red = radial * show2;
1435 pixel.green = linear * radial * 0.3 * (show2 - show4);
1436 pixel.blue = 0;
1437
1440 }
1441 }
1442 }
1443
1444 void Zoom() { // nice one
1445
1446 get_ready();
1447
1449 timings.master_speed = 0.003;
1451
1452 for (int x = 0; x < num_x; x++) {
1453 for (int y = 0; y < num_y; y++) {
1454
1455 animation.dist = (distance[x][y] * distance[x][y]) / 2;
1456 animation.angle = polar_theta[x][y];
1457
1458 animation.scale_x = 0.005;
1459 animation.scale_y = 0.005;
1460
1461 animation.offset_y = -10 * move.linear[0];
1462 animation.offset_x = 0;
1463 animation.offset_z = 0;
1464
1465 animation.z = 0;
1466 animation.low_limit = 0;
1467 float show1 = render_value(animation);
1468
1469 float linear = 1; //(y+1)/(num_y-1.f);
1470
1471 pixel.red = show1 * linear;
1472 pixel.green = 0;
1473 pixel.blue = 0;
1474
1477 }
1478 }
1479 }
1480
1481 void Slow_Fade() { // nice one
1482
1483 get_ready();
1484
1486 timings.master_speed = 0.00005;
1488
1489 for (int x = 0; x < num_x; x++) {
1490 for (int y = 0; y < num_y; y++) {
1491
1492 animation.dist =
1493 sqrtf(distance[x][y]) * 0.7 * (move.directional[0] + 1.5);
1494 animation.angle =
1495 polar_theta[x][y] - move.radial[0] + distance[x][y] / 5;
1496
1497 animation.scale_x = 0.11;
1498 animation.scale_y = 0.11;
1499
1500 animation.offset_y = -50 * move.linear[0];
1501 animation.offset_x = 0;
1502 animation.offset_z = 0;
1503
1504 animation.z = move.linear[0];
1505 animation.low_limit = -0.1;
1506 animation.high_limit = 1;
1507 float show1 = render_value(animation);
1508
1509 animation.dist = animation.dist * 1.1;
1510 animation.angle += move.noise_angle[0] / 10;
1511 float show2 = render_value(animation);
1512
1513 animation.dist = animation.dist * 1.1;
1514 animation.angle += move.noise_angle[1] / 10;
1515
1516 float show3 = render_value(animation);
1517
1518 float radius = radial_filter_radius; // radius of a radial
1519 // brightness filter
1520 float radial = (radius - distance[x][y]) / distance[x][y];
1521
1522 pixel.red = radial * show1;
1523 pixel.green = radial * (show1 - show2) / 6;
1524 pixel.blue = radial * (show1 - show3) / 5;
1525
1528 }
1529 }
1530 }
1531
1532 void Polar_Waves() { // nice one
1533
1534 get_ready();
1535
1536 timings.master_speed = 0.5; // master speed
1537
1538 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1539 // values = faster transitions
1540 timings.ratio[1] = 0.0027;
1541 timings.ratio[2] = 0.0031;
1542
1544
1545 for (int x = 0; x < num_x; x++) {
1546 for (int y = 0; y < num_y; y++) {
1547
1548 animation.dist = (distance[x][y]);
1549 animation.angle =
1550 polar_theta[x][y] - animation.dist * 0.1 + move.radial[0];
1551 animation.z = (animation.dist * 1.5) - 10 * move.linear[0];
1552 animation.scale_x = 0.15;
1553 animation.scale_y = 0.15;
1554 animation.offset_x = move.linear[0];
1555
1556 float show1 = render_value(animation);
1557 animation.angle =
1558 polar_theta[x][y] - animation.dist * 0.1 + move.radial[1];
1559 animation.z = (animation.dist * 1.5) - 10 * move.linear[1];
1560 animation.offset_x = move.linear[1];
1561
1562 float show2 = render_value(animation);
1563 animation.angle =
1564 polar_theta[x][y] - animation.dist * 0.1 + move.radial[2];
1565 animation.z = (animation.dist * 1.5) - 10 * move.linear[2];
1566 animation.offset_x = move.linear[2];
1567
1568 float show3 = render_value(animation);
1569
1570 float radius = radial_filter_radius; // radius of a radial
1571 // brightness filter
1572 float radial = (radius - distance[x][y]) / distance[x][y];
1573
1574 pixel.red = radial * show1;
1575 pixel.green = radial * show2;
1576 pixel.blue = radial * show3;
1577
1580 }
1581 }
1582 }
1583
1584 void RGB_Blobs() { // nice one
1585
1586 get_ready();
1587
1588 timings.master_speed = 0.2; // master speed
1589
1590 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1591 // values = faster transitions
1592 timings.ratio[1] = 0.0027;
1593 timings.ratio[2] = 0.0031;
1594 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1595 // values = faster transitions
1596 timings.ratio[4] = 0.0036;
1597 timings.ratio[5] = 0.0039;
1598
1600
1601 for (int x = 0; x < num_x; x++) {
1602 for (int y = 0; y < num_y; y++) {
1603
1604 animation.dist = distance[x][y];
1605 animation.angle = polar_theta[x][y] + move.radial[0] +
1606 move.noise_angle[0] + move.noise_angle[3];
1607 animation.z = (sqrtf(animation.dist)); // - 10 * move.linear[0];
1608 animation.scale_x = 0.1;
1609 animation.scale_y = 0.1;
1610 animation.offset_z = 10;
1611 animation.offset_x = 10 * move.linear[0];
1612 float show1 = render_value(animation);
1613
1614 animation.angle = polar_theta[x][y] + move.radial[1] +
1615 move.noise_angle[1] + move.noise_angle[4];
1616 animation.offset_x = 11 * move.linear[1];
1617 animation.offset_z = 100;
1618 float show2 = render_value(animation);
1619
1620 animation.angle = polar_theta[x][y] + move.radial[2] +
1621 move.noise_angle[2] + move.noise_angle[5];
1622 animation.offset_x = 12 * move.linear[2];
1623 animation.offset_z = 300;
1624 float show3 = render_value(animation);
1625
1626 float radius = radial_filter_radius; // radius of a radial
1627 // brightness filter
1628 float radial = (radius - distance[x][y]) / distance[x][y];
1629
1630 pixel.red = radial * show1;
1631 pixel.green = radial * show2;
1632 pixel.blue = radial * show3;
1633
1636 }
1637 }
1638 }
1639
1640 void RGB_Blobs2() { // nice one
1641
1642 get_ready();
1643
1644 timings.master_speed = 0.12; // master speed
1645
1646 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1647 // values = faster transitions
1648 timings.ratio[1] = 0.0027;
1649 timings.ratio[2] = 0.0031;
1650 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1651 // values = faster transitions
1652 timings.ratio[4] = 0.0036;
1653 timings.ratio[5] = 0.0039;
1654
1656
1657 for (int x = 0; x < num_x; x++) {
1658 for (int y = 0; y < num_y; y++) {
1659
1660 animation.dist = distance[x][y];
1661 animation.angle = polar_theta[x][y] + move.radial[0] +
1662 move.noise_angle[0] + move.noise_angle[3] +
1663 move.noise_angle[1];
1664 animation.z = (sqrtf(animation.dist)); // - 10 * move.linear[0];
1665 animation.scale_x = 0.1;
1666 animation.scale_y = 0.1;
1667 animation.offset_z = 10;
1668 animation.offset_x = 10 * move.linear[0];
1669 float show1 = render_value(animation);
1670
1671 animation.angle = polar_theta[x][y] + move.radial[1] +
1672 move.noise_angle[1] + move.noise_angle[4] +
1673 move.noise_angle[2];
1674 animation.offset_x = 11 * move.linear[1];
1675 animation.offset_z = 100;
1676 float show2 = render_value(animation);
1677
1678 animation.angle = polar_theta[x][y] + move.radial[2] +
1679 move.noise_angle[2] + move.noise_angle[5] +
1680 move.noise_angle[3];
1681 animation.offset_x = 12 * move.linear[2];
1682 animation.offset_z = 300;
1683 float show3 = render_value(animation);
1684
1685 float radius = radial_filter_radius; // radius of a radial
1686 // brightness filter
1687 float radial = (radius - distance[x][y]) / distance[x][y];
1688
1689 pixel.red = radial * (show1 - show3);
1690 pixel.green = radial * (show2 - show1);
1691 pixel.blue = radial * (show3 - show2);
1692
1695 }
1696 }
1697 }
1698
1699 void RGB_Blobs3() { // nice one
1700
1701 get_ready();
1702
1703 timings.master_speed = 0.12; // master speed
1704
1705 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1706 // values = faster transitions
1707 timings.ratio[1] = 0.0027;
1708 timings.ratio[2] = 0.0031;
1709 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1710 // values = faster transitions
1711 timings.ratio[4] = 0.0036;
1712 timings.ratio[5] = 0.0039;
1713
1715
1716 for (int x = 0; x < num_x; x++) {
1717 for (int y = 0; y < num_y; y++) {
1718
1719 animation.dist = distance[x][y] + move.noise_angle[4];
1720 animation.angle = polar_theta[x][y] + move.radial[0] +
1721 move.noise_angle[0] + move.noise_angle[3] +
1722 move.noise_angle[1];
1723 animation.z = (sqrtf(animation.dist)); // - 10 * move.linear[0];
1724 animation.scale_x = 0.1;
1725 animation.scale_y = 0.1;
1726 animation.offset_z = 10;
1727 animation.offset_x = 10 * move.linear[0];
1728 float show1 = render_value(animation);
1729
1730 animation.angle = polar_theta[x][y] + move.radial[1] +
1731 move.noise_angle[1] + move.noise_angle[4] +
1732 move.noise_angle[2];
1733 animation.offset_x = 11 * move.linear[1];
1734 animation.offset_z = 100;
1735 float show2 = render_value(animation);
1736
1737 animation.angle = polar_theta[x][y] + move.radial[2] +
1738 move.noise_angle[2] + move.noise_angle[5] +
1739 move.noise_angle[3];
1740 animation.offset_x = 12 * move.linear[2];
1741 animation.offset_z = 300;
1742 float show3 = render_value(animation);
1743
1744 float radius = radial_filter_radius; // radius of a radial
1745 // brightness filter
1746 float radial = (radius - distance[x][y]) / distance[x][y];
1747
1748 pixel.red = radial * (show1 + show3) * 0.5 * animation.dist / 5;
1749 pixel.green = radial * (show2 + show1) * 0.5 * y / 15;
1750 pixel.blue = radial * (show3 + show2) * 0.5 * x / 15;
1751
1754 }
1755 }
1756 }
1757
1758 void RGB_Blobs4() { // nice one
1759
1760 get_ready();
1761
1762 timings.master_speed = 0.02; // master speed
1763
1764 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1765 // values = faster transitions
1766 timings.ratio[1] = 0.0027;
1767 timings.ratio[2] = 0.0031;
1768 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1769 // values = faster transitions
1770 timings.ratio[4] = 0.0036;
1771 timings.ratio[5] = 0.0039;
1772
1774
1775 for (int x = 0; x < num_x; x++) {
1776 for (int y = 0; y < num_y; y++) {
1777
1778 animation.dist = distance[x][y] + move.noise_angle[4];
1779 animation.angle = polar_theta[x][y] + move.radial[0] +
1780 move.noise_angle[0] + move.noise_angle[3] +
1781 move.noise_angle[1];
1782 animation.z = 3 + sqrtf(animation.dist);
1783 animation.scale_x = 0.1;
1784 animation.scale_y = 0.1;
1785 animation.offset_z = 10;
1786 animation.offset_x = 50 * move.linear[0];
1787 float show1 = render_value(animation);
1788
1789 animation.angle = polar_theta[x][y] + move.radial[1] +
1790 move.noise_angle[1] + move.noise_angle[4] +
1791 move.noise_angle[2];
1792 animation.offset_x = 50 * move.linear[1];
1793 animation.offset_z = 100;
1794 float show2 = render_value(animation);
1795
1796 animation.angle = polar_theta[x][y] + move.radial[2] +
1797 move.noise_angle[2] + move.noise_angle[5] +
1798 move.noise_angle[3];
1799 animation.offset_x = 50 * move.linear[2];
1800 animation.offset_z = 300;
1801 float show3 = render_value(animation);
1802
1803 float radius = 23; // radius of a radial brightness filter
1804 float radial = (radius - distance[x][y]) / distance[x][y];
1805
1806 pixel.red = radial * (show1 + show3) * 0.5 * animation.dist / 5;
1807 pixel.green = radial * (show2 + show1) * 0.5 * y / 15;
1808 pixel.blue = radial * (show3 + show2) * 0.5 * x / 15;
1809
1812 }
1813 }
1814 }
1815
1816 void RGB_Blobs5() { // nice one
1817
1818 get_ready();
1819
1820 timings.master_speed = 0.02; // master speed
1821
1822 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1823 // values = faster transitions
1824 timings.ratio[1] = 0.0027;
1825 timings.ratio[2] = 0.0031;
1826 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1827 // values = faster transitions
1828 timings.ratio[4] = 0.0036;
1829 timings.ratio[5] = 0.0039;
1830
1832
1833 for (int x = 0; x < num_x; x++) {
1834 for (int y = 0; y < num_y; y++) {
1835
1836 animation.dist = distance[x][y] + move.noise_angle[4];
1837 animation.angle = polar_theta[x][y] + move.radial[0] +
1838 move.noise_angle[0] + move.noise_angle[3] +
1839 move.noise_angle[1];
1840 animation.z = 3 + sqrtf(animation.dist);
1841 animation.scale_x = 0.05;
1842 animation.scale_y = 0.05;
1843 animation.offset_z = 10;
1844 animation.offset_x = 50 * move.linear[0];
1845 float show1 = render_value(animation);
1846
1847 animation.angle = polar_theta[x][y] + move.radial[1] +
1848 move.noise_angle[1] + move.noise_angle[4] +
1849 move.noise_angle[2];
1850 animation.offset_x = 50 * move.linear[1];
1851 animation.offset_z = 100;
1852 float show2 = render_value(animation);
1853
1854 animation.angle = polar_theta[x][y] + move.radial[2] +
1855 move.noise_angle[2] + move.noise_angle[5] +
1856 move.noise_angle[3];
1857 animation.offset_x = 50 * move.linear[2];
1858 animation.offset_z = 300;
1859 float show3 = render_value(animation);
1860
1861 float radius = 23; // radius of a radial brightness filter
1862 float radial = (radius - distance[x][y]) / distance[x][y];
1863
1864 pixel.red = radial * (show1 + show3) * 0.5 * animation.dist / 5;
1865 pixel.green = radial * (show2 + show1) * 0.5 * y / 15;
1866 pixel.blue = radial * (show3 + show2) * 0.5 * x / 15;
1867
1869
1871 }
1872 }
1873 }
1874
1875 void Big_Caleido() { // nice one
1876
1877 get_ready();
1878
1879 timings.master_speed = 0.02; // master speed
1880
1881 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1882 // values = faster transitions
1883 timings.ratio[1] = 0.0027;
1884 timings.ratio[2] = 0.0031;
1885 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1886 // values = faster transitions
1887 timings.ratio[4] = 0.0036;
1888 timings.ratio[5] = 0.0039;
1889
1891
1892 for (int x = 0; x < num_x; x++) {
1893 for (int y = 0; y < num_y; y++) {
1894
1895 animation.dist = distance[x][y];
1896 animation.angle = 5 * polar_theta[x][y] +
1897 5 * move.noise_angle[0] +
1898 animation.dist * 0.1;
1899 animation.z = 5;
1900 animation.scale_x = 0.05;
1901 animation.scale_y = 0.05;
1902 animation.offset_z = 50 * move.linear[0];
1903 animation.offset_x = 50 * move.noise_angle[0];
1904 animation.offset_y = 50 * move.noise_angle[1];
1905 float show1 = render_value(animation);
1906
1907 animation.angle = 6 * polar_theta[x][y] +
1908 5 * move.noise_angle[1] +
1909 animation.dist * 0.15;
1910 animation.z = 5;
1911 animation.scale_x = 0.05;
1912 animation.scale_y = 0.05;
1913 animation.offset_z = 50 * move.linear[1];
1914 animation.offset_x = 50 * move.noise_angle[1];
1915 animation.offset_y = 50 * move.noise_angle[2];
1916 float show2 = render_value(animation);
1917
1918 animation.angle = 5;
1919 animation.z = 5;
1920 animation.scale_x = 0.10;
1921 animation.scale_y = 0.10;
1922 animation.offset_z = 10 * move.linear[2];
1923 animation.offset_x = 10 * move.noise_angle[2];
1924 animation.offset_y = 10 * move.noise_angle[3];
1925 float show3 = render_value(animation);
1926
1927 animation.angle = 15;
1928 animation.z = 15;
1929 animation.scale_x = 0.10;
1930 animation.scale_y = 0.10;
1931 animation.offset_z = 10 * move.linear[3];
1932 animation.offset_x = 10 * move.noise_angle[3];
1933 animation.offset_y = 10 * move.noise_angle[4];
1934 float show4 = render_value(animation);
1935
1936 animation.angle = 2;
1937 animation.z = 15;
1938 animation.scale_x = 0.15;
1939 animation.scale_y = 0.15;
1940 animation.offset_z = 10 * move.linear[4];
1941 animation.offset_x = 10 * move.noise_angle[4];
1942 animation.offset_y = 10 * move.noise_angle[5];
1943 float show5 = render_value(animation);
1944
1945 pixel.red = show1 - show4;
1946 pixel.green = show2 - show5;
1947 pixel.blue = show3 - show2 + show1;
1948
1950
1952 }
1953 }
1954 // show_frame();
1955 }
1956
1957 void SM1() { // nice one
1958
1959 get_ready();
1960
1961 timings.master_speed = 0.02; // master speed
1962
1963 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
1964 // values = faster transitions
1965 timings.ratio[1] = 0.0027;
1966 timings.ratio[2] = 0.0031;
1967 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
1968 // values = faster transitions
1969 timings.ratio[4] = 0.0036;
1970 timings.ratio[5] = 0.0039;
1971
1973
1974 for (int x = 0; x < num_x / 2; x++) {
1975 for (int y = 0; y < num_y / 2; y++) {
1976
1977 animation.dist = distance[x][y];
1978 animation.angle = polar_theta[x][y] + 5 * move.noise_angle[0];
1979 animation.z = 5;
1980 animation.scale_x = 0.1;
1981 animation.scale_y = 0.1;
1982 animation.offset_z = 50 * move.linear[0];
1983 animation.offset_x = 150 * move.directional[0];
1984 animation.offset_y = 150 * move.directional[1];
1985 float show1 = render_value(animation);
1986
1987 animation.dist = distance[x][y];
1988 animation.angle = polar_theta[x][y] + 4 * move.noise_angle[1];
1989 animation.z = 15;
1990 animation.scale_x = 0.15;
1991 animation.scale_y = 0.15;
1992 animation.offset_z = 50 * move.linear[1];
1993 animation.offset_x = 150 * move.directional[1];
1994 animation.offset_y = 150 * move.directional[2];
1995 float show2 = render_value(animation);
1996
1997 animation.dist = distance[x][y];
1998 animation.angle = polar_theta[x][y] + 5 * move.noise_angle[2];
1999 animation.z = 25;
2000 animation.scale_x = 0.1;
2001 animation.scale_y = 0.1;
2002 animation.offset_z = 50 * move.linear[2];
2003 animation.offset_x = 150 * move.directional[2];
2004 animation.offset_y = 150 * move.directional[3];
2005 float show3 = render_value(animation);
2006
2007 animation.dist = distance[x][y];
2008 animation.angle = polar_theta[x][y] + 5 * move.noise_angle[3];
2009 animation.z = 35;
2010 animation.scale_x = 0.15;
2011 animation.scale_y = 0.15;
2012 animation.offset_z = 50 * move.linear[3];
2013 animation.offset_x = 150 * move.directional[3];
2014 animation.offset_y = 150 * move.directional[4];
2015 float show4 = render_value(animation);
2016
2017 animation.dist = distance[x][y];
2018 animation.angle = polar_theta[x][y] + 5 * move.noise_angle[4];
2019 animation.z = 45;
2020 animation.scale_x = 0.2;
2021 animation.scale_y = 0.2;
2022 animation.offset_z = 50 * move.linear[4];
2023 animation.offset_x = 150 * move.directional[4];
2024 animation.offset_y = 150 * move.directional[5];
2025 float show5 = render_value(animation);
2026
2027 pixel.red = show1 + show2;
2028 pixel.green = show3 + show4;
2029 pixel.blue = show5;
2030
2032 // leds[xyMap(x, y)] = CRGB(pixel.red, pixel.green, pixel.blue);
2034
2035 setPixelColorInternal((num_x - 1) - x, y, pixel);
2036 setPixelColorInternal((num_x - 1) - x, (num_y - 1) - y, pixel);
2037 setPixelColorInternal(x, (num_y - 1) - y, pixel);
2038 }
2039 }
2040 // show_frame();
2041 }
2042
2043 void SM2() {
2044
2045 get_ready();
2046
2047 timings.master_speed = 0.03; // master speed
2048
2049 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2050 // values = faster transitions
2051 timings.ratio[1] = 0.027;
2052 timings.ratio[2] = 0.031;
2053 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
2054 // values = faster transitions
2055 timings.ratio[4] = 0.0036;
2056 timings.ratio[5] = 0.0039;
2057
2059
2060 for (int x = 0; x < num_x; x++) {
2061 for (int y = 0; y < num_y; y++) {
2062
2063 animation.dist = distance[x][y] * (move.directional[0]);
2064 animation.angle = polar_theta[x][y] + move.radial[0];
2065 animation.z = 5;
2066 animation.scale_x = 0.09;
2067 animation.scale_y = 0.09;
2068 animation.offset_z = 5 * move.linear[0];
2069 animation.offset_x = 0;
2070 animation.offset_y = 0;
2071 float show1 = render_value(animation);
2072
2073 animation.dist = distance[x][y] * move.directional[1];
2074 animation.angle = polar_theta[x][y] + move.radial[1];
2075 animation.z = 50;
2076 animation.scale_x = 0.07;
2077 animation.scale_y = 0.07;
2078 animation.offset_z = 5 * move.linear[1];
2079 animation.offset_x = 0;
2080 animation.offset_y = 0;
2081 float show2 = render_value(animation);
2082
2083 animation.dist = distance[x][y] * move.directional[2];
2084 animation.angle = polar_theta[x][y] + move.radial[2];
2085 animation.z = 500;
2086 animation.scale_x = 0.05;
2087 animation.scale_y = 0.05;
2088 animation.offset_z = 5 * move.linear[2];
2089 animation.offset_x = 0;
2090 animation.offset_y = 0;
2091 float show3 = render_value(animation);
2092
2093 pixel.red = show1;
2094 pixel.green = show2;
2095 pixel.blue = show3;
2096
2098
2100 }
2101 }
2102 // show_frame();
2103 }
2104
2105 void SM3() {
2106
2107 get_ready();
2108
2109 timings.master_speed = 0.02; // master speed
2110
2111 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2112 // values = faster transitions
2113 timings.ratio[1] = 0.027;
2114 timings.ratio[2] = 0.031;
2115 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
2116 // values = faster transitions
2117 timings.ratio[4] = 0.0036;
2118 timings.ratio[5] = 0.0039;
2119
2121
2122 for (int x = 0; x < num_x; x++) {
2123 for (int y = 0; y < num_y; y++) {
2124
2125 animation.dist = distance[x][y];
2126 animation.angle = polar_theta[x][y];
2127 animation.z = 5;
2128 animation.scale_x = 0.09;
2129 animation.scale_y = 0.09;
2130 animation.offset_z = 0;
2131 animation.offset_x = 0;
2132 animation.offset_y = -20 * move.linear[0];
2133 ;
2134 animation.low_limit = -1;
2135 animation.high_limit = 1;
2137
2138 animation.dist = distance[x][y];
2139 animation.angle = polar_theta[x][y];
2140 animation.z = 500;
2141 animation.scale_x = 0.09;
2142 animation.scale_y = 0.09;
2143 animation.offset_z = 0;
2144 animation.offset_x = 0;
2145 animation.offset_y = -20 * move.linear[0];
2146 ;
2147 animation.low_limit = -1;
2148 animation.high_limit = 1;
2150
2151 animation.dist = distance[x][y];
2152 animation.angle = polar_theta[x][y];
2153 animation.z = 50;
2154 animation.scale_x = 0.09;
2155 animation.scale_y = 0.09;
2156 animation.offset_z = 0;
2157 animation.offset_x = 500 + show1 / 20;
2158 animation.offset_y = -4 * move.linear[0] + show2 / 20;
2159 animation.low_limit = 0;
2160 animation.high_limit = 1;
2162
2163 animation.dist = distance[x][y];
2164 animation.angle = polar_theta[x][y];
2165 animation.z = 50;
2166 animation.scale_x = 0.09;
2167 animation.scale_y = 0.09;
2168 animation.offset_z = 0;
2169 animation.offset_x = 500 + show1 / 18;
2170 animation.offset_y = -4 * move.linear[0] + show2 / 18;
2171 animation.low_limit = 0;
2172 animation.high_limit = 1;
2174
2175 animation.dist = distance[x][y];
2176 animation.angle = polar_theta[x][y];
2177 animation.z = 50;
2178 animation.scale_x = 0.09;
2179 animation.scale_y = 0.09;
2180 animation.offset_z = 0;
2181 animation.offset_x = 500 + show1 / 19;
2182 animation.offset_y = -4 * move.linear[0] + show2 / 19;
2183 animation.low_limit = 0.3;
2184 animation.high_limit = 1;
2186
2187 pixel.red = show4;
2188 pixel.green = show3;
2189 pixel.blue = show5;
2190
2192
2194 }
2195 }
2196 }
2197
2198 void SM4() {
2199
2200 get_ready();
2201
2202 timings.master_speed = 0.02; // master speed
2203
2204 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2205 // values = faster transitions
2206 timings.ratio[1] = 0.027;
2207 timings.ratio[2] = 0.031;
2208 timings.ratio[3] = 0.0033; // speed ratios for the oscillators, higher
2209 // values = faster transitions
2210 timings.ratio[4] = 0.0036;
2211 timings.ratio[5] = 0.0039;
2212
2214
2215 for (int x = 0; x < num_x; x++) {
2216 for (int y = 0; y < num_y; y++) {
2217
2218 animation.dist = distance[x][y];
2219 animation.angle = polar_theta[x][y];
2220 animation.z = 5;
2221 animation.scale_x = 0.09;
2222 animation.scale_y = 0.09;
2223 animation.offset_z = 0;
2224 animation.offset_x = 0;
2225 animation.offset_y = -20 * move.linear[0];
2226 ;
2227 animation.low_limit = 0;
2228 animation.high_limit = 1;
2230
2231 animation.dist = distance[x][y];
2232 animation.angle = polar_theta[x][y];
2233 animation.z = 500;
2234 animation.scale_x = 0.09;
2235 animation.scale_y = 0.09;
2236 animation.offset_z = 0;
2237 animation.offset_x = 0;
2238 animation.offset_y = -40 * move.linear[0];
2239 ;
2240 animation.low_limit = 0;
2241 animation.high_limit = 1;
2243
2244 pixel.red = add(show2, show1);
2245 pixel.green = 0;
2246 pixel.blue = colordodge(show2, show1);
2247
2249
2251 }
2252 }
2253 }
2254
2255 void SM5() {
2256
2257 get_ready();
2258
2259 timings.master_speed = 0.03; // master speed
2260
2261 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2262 // values = faster transitions
2263 timings.ratio[1] = 0.027;
2264 timings.ratio[2] = 0.031;
2265 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2266 // values = faster transitions
2267 timings.ratio[4] = 0.0056;
2268 timings.ratio[5] = 0.0059;
2269
2271
2272 for (int x = 0; x < num_x; x++) {
2273 for (int y = 0; y < num_y; y++) {
2274
2275 animation.dist = distance[x][y] * (move.directional[0]);
2276 animation.angle = polar_theta[x][y] + move.radial[0];
2277 animation.z = 5;
2278 animation.scale_x = 0.09;
2279 animation.scale_y = 0.09;
2280 animation.offset_z = 5 * move.linear[0];
2281 animation.offset_x = 0;
2282 animation.offset_y = 0;
2283 float show1 = render_value(animation);
2284
2285 animation.dist = distance[x][y] * move.directional[1];
2286 animation.angle = polar_theta[x][y] + move.radial[1];
2287 animation.z = 50;
2288 animation.scale_x = 0.07;
2289 animation.scale_y = 0.07;
2290 animation.offset_z = 5 * move.linear[1];
2291 animation.offset_x = 0;
2292 animation.offset_y = 0;
2293 float show2 = render_value(animation);
2294
2295 animation.dist = distance[x][y] * move.directional[2];
2296 animation.angle = polar_theta[x][y] + move.radial[2];
2297 animation.z = 500;
2298 animation.scale_x = 0.05;
2299 animation.scale_y = 0.05;
2300 animation.offset_z = 5 * move.linear[2];
2301 animation.offset_x = 0;
2302 animation.offset_y = 0;
2303 float show3 = render_value(animation);
2304
2305 animation.dist = distance[x][y] * (move.directional[3]);
2306 animation.angle = polar_theta[x][y] + move.radial[3];
2307 animation.z = 5;
2308 animation.scale_x = 0.09;
2309 animation.scale_y = 0.09;
2310 animation.offset_z = 5 * move.linear[3];
2311 animation.offset_x = 0;
2312 animation.offset_y = 0;
2313 float show4 = render_value(animation);
2314
2315 animation.dist = distance[x][y] * move.directional[4];
2316 animation.angle = polar_theta[x][y] + move.radial[4];
2317 animation.z = 50;
2318 animation.scale_x = 0.07;
2319 animation.scale_y = 0.07;
2320 animation.offset_z = 5 * move.linear[4];
2321 animation.offset_x = 0;
2322 animation.offset_y = 0;
2323 float show5 = render_value(animation);
2324
2325 animation.dist = distance[x][y] * move.directional[5];
2326 animation.angle = polar_theta[x][y] + move.radial[5];
2327 animation.z = 500;
2328 animation.scale_x = 0.05;
2329 animation.scale_y = 0.05;
2330 animation.offset_z = 5 * move.linear[5];
2331 animation.offset_x = 0;
2332 animation.offset_y = 0;
2333 float show6 = render_value(animation);
2334
2335 float radius = radial_filter_radius; // radius of a radial
2336 // brightness filter
2337 float radial = (radius - distance[x][y]) / distance[x][y];
2338
2339 pixel.red = radial * add(show1, show4);
2340 pixel.green = radial * colordodge(show2, show5);
2341 pixel.blue = radial * screen(show3, show6);
2342
2344
2346 }
2347 }
2348 }
2349
2350 void SM6() {
2351
2352 get_ready();
2353
2354 timings.master_speed = 0.03; // master speed
2355
2356 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2357 // values = faster transitions
2358 timings.ratio[1] = 0.027;
2359 timings.ratio[2] = 0.031;
2360 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2361 // values = faster transitions
2362 timings.ratio[4] = 0.0056;
2363 timings.ratio[5] = 0.0059;
2364
2366
2367 for (int x = 0; x < num_x; x++) {
2368 for (int y = 0; y < num_y; y++) {
2369
2370 float s = 0.7; // zoom factor
2371
2372 animation.dist = distance[x][y] * (move.directional[0]) * s;
2373 animation.angle = polar_theta[x][y] + move.radial[0];
2374 animation.z = 5;
2375 animation.scale_x = 0.09;
2376 animation.scale_y = 0.09;
2377 animation.offset_z = 5 * move.linear[0];
2378 animation.offset_x = 0;
2379 animation.offset_y = 0;
2380 float show1 = render_value(animation);
2381
2382 animation.dist = distance[x][y] * move.directional[1] * s;
2383 animation.angle = polar_theta[x][y] + move.radial[1];
2384 animation.z = 50;
2385 animation.scale_x = 0.07;
2386 animation.scale_y = 0.07;
2387 animation.offset_z = 5 * move.linear[1];
2388 animation.offset_x = 0;
2389 animation.offset_y = 0;
2390 float show2 = render_value(animation);
2391
2392 animation.dist = distance[x][y] * move.directional[2] * s;
2393 animation.angle = polar_theta[x][y] + move.radial[2];
2394 animation.z = 500;
2395 animation.scale_x = 0.05;
2396 animation.scale_y = 0.05;
2397 animation.offset_z = 5 * move.linear[2];
2398 animation.offset_x = 0;
2399 animation.offset_y = 0;
2400 float show3 = render_value(animation);
2401
2402 animation.dist = distance[x][y] * (move.directional[3]) * s;
2403 animation.angle = polar_theta[x][y] + move.radial[3];
2404 animation.z = 5;
2405 animation.scale_x = 0.09;
2406 animation.scale_y = 0.09;
2407 animation.offset_z = 5 * move.linear[3];
2408 animation.offset_x = 0;
2409 animation.offset_y = 0;
2410 float show4 = render_value(animation);
2411
2412 animation.dist = distance[x][y] * move.directional[4] * s;
2413 animation.angle = polar_theta[x][y] + move.radial[4];
2414 animation.z = 50;
2415 animation.scale_x = 0.07;
2416 animation.scale_y = 0.07;
2417 animation.offset_z = 5 * move.linear[4];
2418 animation.offset_x = 0;
2419 animation.offset_y = 0;
2420 float show5 = render_value(animation);
2421
2422 animation.dist = distance[x][y] * move.directional[5] * s;
2423 animation.angle = polar_theta[x][y] + move.radial[5];
2424 animation.z = 500;
2425 animation.scale_x = 0.05;
2426 animation.scale_y = 0.05;
2427 animation.offset_z = 5 * move.linear[5];
2428 animation.offset_x = 0;
2429 animation.offset_y = 0;
2430 float show6 = render_value(animation);
2431
2432 float radius = radial_filter_radius; // radius of a radial
2433 // brightness filter
2434 float radial = (radius - distance[x][y]) / distance[x][y];
2435
2436 show7 = screen(show1, show4);
2438 show9 = screen(show3, show6);
2439
2440 pixel.red = radial * (show7 + show8);
2441 pixel.green = 0;
2442 pixel.blue = radial * show9;
2443
2445
2447 }
2448 }
2449 }
2450
2451 void SM8() {
2452
2453 get_ready();
2454
2455 timings.master_speed = 0.005; // master speed
2456
2457 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2458 // values = faster transitions
2459 timings.ratio[1] = 0.027;
2460 timings.ratio[2] = 0.031;
2461 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2462 // values = faster transitions
2463 timings.ratio[4] = 0.0056;
2464 timings.ratio[5] = 0.01; // original Reddit post had no radial movement!
2465
2467
2468 for (int x = 0; x < num_x; x++) {
2469 for (int y = 0; y < num_y; y++) {
2470
2471 // float s = 0.7; // zoom factor
2472
2473 animation.dist = distance[x][y];
2474 animation.angle = 2;
2475 animation.z = 5;
2476 animation.scale_x = 0.15;
2477 animation.scale_y = 0.15;
2478 animation.offset_z = 0;
2479 animation.offset_y = 50 * move.linear[0];
2480 animation.offset_x = 0;
2481 animation.low_limit = 0;
2482 float show1 = render_value(animation);
2483
2484 animation.dist = distance[x][y];
2485 animation.angle = 2;
2486 animation.z = 150;
2487 animation.offset_x = -50 * move.linear[0];
2488 float show2 = render_value(animation);
2489
2490 animation.dist = distance[x][y];
2491 animation.angle = 1;
2492 animation.z = 550;
2493 animation.scale_x = 0.15;
2494 animation.scale_y = 0.15;
2495 animation.offset_x = 0;
2496 animation.offset_y = -50 * move.linear[1];
2497 float show4 = render_value(animation);
2498
2499 animation.dist = distance[x][y];
2500 animation.angle = 1;
2501 animation.z = 1250;
2502 animation.scale_x = 0.15;
2503 animation.scale_y = 0.15;
2504 animation.offset_x = 0;
2505 animation.offset_y = 50 * move.linear[1];
2506 float show5 = render_value(animation);
2507
2508 // float radius = radial_filter_radius; // radius of a radial
2509 // brightness filter float radial =
2510 // (radius-distance[x][y])/distance[x][y];
2511
2512 show3 = add(show1, show2);
2513 show6 = screen(show4, show5);
2514 // show9 = screen(show3, show6);
2515
2516 pixel.red = show3;
2517 pixel.green = 0;
2518 pixel.blue = show6;
2519
2521
2523 }
2524 }
2525 }
2526
2527 void SM9() {
2528
2529 get_ready();
2530
2531 timings.master_speed = 0.005; // master speed
2532
2533 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2534 // values = faster transitions
2535 timings.ratio[1] = 0.027;
2536 timings.ratio[2] = 0.031;
2537 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2538 // values = faster transitions
2539 timings.ratio[4] = 0.0056;
2540 timings.ratio[5] = 0.0059;
2541
2543
2544 for (int x = 0; x < num_x; x++) {
2545 for (int y = 0; y < num_y; y++) {
2546
2547 animation.dist = distance[x][y];
2548 animation.angle = polar_theta[x][y];
2549 animation.z = 5;
2550 animation.scale_x = 0.09;
2551 animation.scale_y = 0.09;
2552 animation.offset_y = -30 * move.linear[0];
2553 animation.offset_z = 0;
2554 animation.offset_x = 0;
2555 animation.low_limit = -1;
2557
2558 animation.dist = distance[x][y];
2559 animation.angle = polar_theta[x][y];
2560 animation.z = 50;
2561 animation.scale_x = 0.09;
2562 animation.scale_y = 0.09;
2563 animation.offset_y = -30 * move.linear[1];
2564 animation.offset_z = 0;
2565 animation.offset_x = 0;
2566 animation.low_limit = -1;
2568
2569 animation.dist = distance[x][y]; // + show1/64;
2570 animation.angle = polar_theta[x][y] + 2 + (show1 / 255) * PI;
2571 animation.z = 5;
2572 animation.scale_x = 0.09;
2573 animation.scale_y = 0.09;
2574 animation.offset_y = -10 * move.linear[0];
2575 animation.offset_z = 0;
2576 animation.offset_x = 0;
2577 animation.low_limit = 0;
2579
2580 animation.dist = distance[x][y];
2581 animation.angle = polar_theta[x][y] + 2 + (show2 / 255) * PI;
2582 ;
2583 animation.z = 5;
2584 animation.scale_x = 0.09;
2585 animation.scale_y = 0.09;
2586 animation.offset_y = -20 * move.linear[0];
2587 animation.offset_z = 0;
2588 animation.offset_x = 0;
2589 animation.low_limit = 0;
2591
2592 show5 = screen(show4, show3);
2594
2595 float linear1 = y / 32.f;
2596 float linear2 = (32 - y) / 32.f;
2597
2598 pixel.red = show5 * linear1;
2599 pixel.green = 0;
2600 pixel.blue = show6 * linear2;
2601
2603
2605 }
2606 }
2607 }
2608
2609 void SM10() {
2610
2611 get_ready();
2612
2613 timings.master_speed = 0.006; // 0.006
2614
2615 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2616 // values = faster transitions
2617 timings.ratio[1] = 0.027;
2618 timings.ratio[2] = 0.031;
2619 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2620 // values = faster transitions
2621 timings.ratio[4] = 0.0056;
2622 timings.ratio[5] = 0.0059;
2623
2625
2626 for (int x = 0; x < num_x; x++) {
2627 for (int y = 0; y < num_y; y++) {
2628
2629 float scale = 0.6;
2630
2631 animation.dist = distance[x][y];
2632 animation.angle = polar_theta[x][y];
2633 animation.z = 5;
2634 animation.scale_x = 0.09 * scale;
2635 animation.scale_y = 0.09 * scale;
2636 animation.offset_y = -30 * move.linear[0];
2637 animation.offset_z = 0;
2638 animation.offset_x = 0;
2639 animation.low_limit = -1;
2641
2642 animation.dist = distance[x][y];
2643 animation.angle = polar_theta[x][y];
2644 animation.z = 50;
2645 animation.scale_x = 0.09 * scale;
2646 animation.scale_y = 0.09 * scale;
2647 animation.offset_y = -30 * move.linear[1];
2648 animation.offset_z = 0;
2649 animation.offset_x = 0;
2650 animation.low_limit = -1;
2652
2653 animation.dist = distance[x][y]; // + show1/64;
2654 animation.angle = polar_theta[x][y] + 2 + (show1 / 255) * PI;
2655 animation.z = 5;
2656 animation.scale_x = 0.09 * scale;
2657 animation.scale_y = 0.09 * scale;
2658 animation.offset_y = -10 * move.linear[0];
2659 animation.offset_z = 0;
2660 animation.offset_x = 0;
2661 animation.low_limit = 0;
2663
2664 animation.dist = distance[x][y];
2665 animation.angle = polar_theta[x][y] + 2 + (show2 / 255) * PI;
2666 ;
2667 animation.z = 5;
2668 animation.scale_x = 0.09 * scale;
2669 animation.scale_y = 0.09 * scale;
2670 animation.offset_y = -20 * move.linear[0];
2671 animation.offset_z = 0;
2672 animation.offset_x = 0;
2673 animation.low_limit = 0;
2675
2676 show5 = screen(show4, show3);
2678
2679 // float linear1 = y / 32.f;
2680 // float linear2 = (32-y) / 32.f;
2681
2682 pixel.red = (show5 + show6) / 2;
2683 pixel.green = (show5 - 50) + (show6 / 16);
2684 pixel.blue = 0; // show6;
2685
2687
2689 }
2690 }
2691 }
2692
2694
2695 get_ready();
2696
2697 timings.master_speed = 0.009; // master speed
2698
2699 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2700 // values = faster transitions
2701 timings.ratio[1] = 0.027;
2702 timings.ratio[2] = 0.031;
2703 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2704 // values = faster transitions
2705 timings.ratio[4] = 0.0056;
2706 timings.ratio[5] = 0.0059;
2707
2709
2710 // float size = 1.5;
2711
2712 for (int x = 0; x < num_x; x++) {
2713 for (int y = 0; y < num_y; y++) {
2714
2715 animation.dist = distance[x][y];
2716 animation.angle = 5 * polar_theta[x][y] + 10 * move.radial[0] +
2717 animation.dist / 2;
2718 animation.z = 5;
2719 animation.scale_x = 0.07;
2720 animation.scale_y = 0.07;
2721 animation.offset_z = 0;
2722 animation.offset_x = -30 * move.linear[0];
2723 animation.offset_y = 0;
2724 animation.low_limit = 0;
2726
2727 animation.dist = distance[x][y];
2728 animation.angle = -5 * polar_theta[x][y] + 12 * move.radial[1] +
2729 animation.dist / 2;
2730 animation.z = 500;
2731 animation.scale_x = 0.07;
2732 animation.scale_y = 0.07;
2733 animation.offset_z = 0;
2734 animation.offset_x = -30 * move.linear[1];
2735 animation.offset_y = 0;
2736 animation.low_limit = 0;
2738
2739 animation.dist = distance[x][y];
2740 animation.angle = -5 * polar_theta[x][y] + 12 * move.radial[2] +
2741 animation.dist / 2;
2742 animation.z = 500;
2743 animation.scale_x = 0.05;
2744 animation.scale_y = 0.05;
2745 animation.offset_z = 0;
2746 animation.offset_x = -40 * move.linear[2];
2747 animation.offset_y = 0;
2748 animation.low_limit = 0;
2750
2751 animation.dist = distance[x][y];
2752 animation.angle = 5 * polar_theta[x][y] + 12 * move.radial[3] +
2753 animation.dist / 2;
2754 animation.z = 500;
2755 animation.scale_x = 0.09;
2756 animation.scale_y = 0.09;
2757 animation.offset_z = 0;
2758 animation.offset_x = -35 * move.linear[3];
2759 animation.offset_y = 0;
2760 animation.low_limit = 0;
2762
2763 show5 = screen(show4, show3);
2765
2766 // float linear1 = y / 32.f;
2767 // float linear2 = (32-y) / 32.f;
2768
2769 float radius = radial_filter_radius; // radius of a radial
2770 // brightness filter
2771 float radial = (radius - distance[x][y]) / distance[x][y];
2772
2773 pixel.red = radial * (show1 + show2);
2774 pixel.green = 0.3 * radial * show6; //(radial*(show1))*0.3f;
2775 pixel.blue = radial * show5;
2776
2778
2780 }
2781 }
2782 }
2783
2785
2786 get_ready();
2787
2788 timings.master_speed = 0.009; // master speed
2789
2790 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2791 // values = faster transitions
2792 timings.ratio[1] = 0.027;
2793 timings.ratio[2] = 0.031;
2794 timings.ratio[3] = 0.0053; // speed ratios for the oscillators, higher
2795 // values = faster transitions
2796 timings.ratio[4] = 0.0056;
2797 timings.ratio[5] = 0.0059;
2798
2800
2801 float size = 0.5;
2802
2803 for (int x = 0; x < num_x; x++) {
2804 for (int y = 0; y < num_y; y++) {
2805
2806 animation.dist = distance[x][y];
2807 animation.angle = 5 * polar_theta[x][y] + 10 * move.radial[0] +
2808 animation.dist / 2;
2809 animation.z = 5;
2810 animation.scale_x = 0.07 * size;
2811 animation.scale_y = 0.07 * size;
2812 animation.offset_z = 0;
2813 animation.offset_x = -30 * move.linear[0];
2814 animation.offset_y = 0;
2815 animation.low_limit = 0;
2817
2818 animation.dist = distance[x][y];
2819 animation.angle = -5 * polar_theta[x][y] + 12 * move.radial[1] +
2820 animation.dist / 2;
2821 animation.z = 500;
2822 animation.scale_x = 0.07 * size;
2823 animation.scale_y = 0.07 * size;
2824 animation.offset_z = 0;
2825 animation.offset_x = -30 * move.linear[1];
2826 animation.offset_y = 0;
2827 animation.low_limit = 0;
2829
2830 animation.dist = distance[x][y];
2831 animation.angle = -5 * polar_theta[x][y] + 12 * move.radial[2] +
2832 animation.dist / 2;
2833 animation.z = 500;
2834 animation.scale_x = 0.05 * size;
2835 animation.scale_y = 0.05 * size;
2836 animation.offset_z = 0;
2837 animation.offset_x = -40 * move.linear[2];
2838 animation.offset_y = 0;
2839 animation.low_limit = 0;
2841
2842 animation.dist = distance[x][y];
2843 animation.angle = 5 * polar_theta[x][y] + 12 * move.radial[3] +
2844 animation.dist / 2;
2845 animation.z = 500;
2846 animation.scale_x = 0.09 * size;
2847 animation.scale_y = 0.09 * size;
2848 animation.offset_z = 0;
2849 animation.offset_x = -35 * move.linear[3];
2850 animation.offset_y = 0;
2851 animation.low_limit = 0;
2853
2854 show5 = screen(show4, show3);
2856
2857 // float linear1 = y / 32.f;
2858 // float linear2 = (32-y) / 32.f;
2859
2860 float radius = radial_filter_radius; // radius of a radial
2861 // brightness filter
2862 float radial = (radius - distance[x][y]) / distance[x][y];
2863
2864 pixel.red = radial * (show1 + show2);
2865 pixel.green = 0.3 * radial * show6; //(radial*(show1))*0.3f;
2866 pixel.blue = radial * show5;
2867
2869
2871 }
2872 }
2873 }
2874
2876
2877 get_ready();
2878
2879 timings.master_speed = 0.001; // master speed
2880
2881 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2882 // values = faster transitions
2883 timings.ratio[1] = 0.027;
2884 timings.ratio[2] = 0.031;
2885 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
2886 // values = faster transitions
2887 timings.ratio[4] = 0.037;
2888 timings.ratio[5] = 0.038;
2889 timings.ratio[5] = 0.041;
2890
2892
2893 float size = 0.4 + move.directional[0] * 0.1;
2894
2895 float q = 2;
2896
2897 for (int x = 0; x < num_x; x++) {
2898 for (int y = 0; y < num_y; y++) {
2899
2900 animation.dist = distance[x][y];
2901 animation.angle =
2902 5 * polar_theta[x][y] + 10 * move.radial[0] +
2903 animation.dist / (((move.directional[0] + 3) * 2)) +
2904 move.noise_angle[0] * q;
2905 animation.z = 5;
2906 animation.scale_x = 0.08 * size * (move.directional[0] + 1.5);
2907 animation.scale_y = 0.07 * size;
2908 animation.offset_z = -10 * move.linear[0];
2909 animation.offset_x = -30 * move.linear[0];
2910 animation.offset_y = 0;
2911 animation.low_limit = 0;
2913
2914 animation.dist = distance[x][y];
2915 animation.angle =
2916 -5 * polar_theta[x][y] + 10 * move.radial[1] +
2917 animation.dist / (((move.directional[1] + 3) * 2)) +
2918 move.noise_angle[1] * q;
2919 animation.z = 500;
2920 animation.scale_x = 0.07 * size * (move.directional[1] + 1.1);
2921 animation.scale_y = 0.07 * size * (move.directional[2] + 1.3);
2922 ;
2923 animation.offset_z = -12 * move.linear[1];
2924 ;
2925 animation.offset_x = -(num_x - 1) * move.linear[1];
2926 animation.offset_y = 0;
2927 animation.low_limit = 0;
2929
2930 animation.dist = distance[x][y];
2931 animation.angle =
2932 -5 * polar_theta[x][y] + 12 * move.radial[2] +
2933 animation.dist / (((move.directional[3] + 3) * 2)) +
2934 move.noise_angle[2] * q;
2935 animation.z = 500;
2936 animation.scale_x = 0.05 * size * (move.directional[3] + 1.5);
2937 ;
2938 animation.scale_y = 0.05 * size * (move.directional[4] + 1.5);
2939 ;
2940 animation.offset_z = -12 * move.linear[3];
2941 animation.offset_x = -40 * move.linear[3];
2942 animation.offset_y = 0;
2943 animation.low_limit = 0;
2945
2946 animation.dist = distance[x][y];
2947 animation.angle =
2948 5 * polar_theta[x][y] + 12 * move.radial[3] +
2949 animation.dist / (((move.directional[5] + 3) * 2)) +
2950 move.noise_angle[3] * q;
2951 animation.z = 500;
2952 animation.scale_x = 0.09 * size * (move.directional[5] + 1.5);
2953 ;
2954 ;
2955 animation.scale_y = 0.09 * size * (move.directional[6] + 1.5);
2956 ;
2957 ;
2958 animation.offset_z = 0;
2959 animation.offset_x = -35 * move.linear[3];
2960 animation.offset_y = 0;
2961 animation.low_limit = 0;
2963
2966
2968
2969 float linear1 = y / 32.f;
2970 // float linear2 = (32-y) / 32.f;
2971
2972 float radius = radial_filter_radius; // radius of a radial
2973 // brightness filter
2974 float radial = (radius - distance[x][y]) / distance[x][y];
2975
2976 show7 = multiply(show1, show2) * linear1 * 2;
2978
2979 // pixel.red = radial*(show1+show2);
2980 pixel.green = 0.2 * show8; //(radial*(show1))*0.3f;
2981 pixel.blue = show5 * radial;
2982 pixel.red = (1 * show1 + 1 * show2) - show7 / 2;
2983
2985
2987 }
2988 }
2989 }
2990
2992
2993 get_ready();
2994
2995 timings.master_speed = 0.01; // master speed 0.01 in the video
2996
2997 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
2998 // values = faster transitions
2999 timings.ratio[1] = 0.027;
3000 timings.ratio[2] = 0.031;
3001 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3002 // values = faster transitions
3003 timings.ratio[4] = 0.037;
3004 timings.ratio[5] = 0.038;
3005 timings.ratio[6] = 0.041;
3006
3008
3009 float size = 0.6;
3010
3011 float q = 1;
3012
3013 for (int x = 0; x < num_x; x++) {
3014 for (int y = 0; y < num_y; y++) {
3015
3016 float s = 1 + move.directional[6] * 0.3;
3017
3018 animation.dist = distance[x][y] * s;
3019 animation.angle =
3020 5 * polar_theta[x][y] + 1 * move.radial[0] -
3021 animation.dist / (3 + move.directional[0] * 0.5);
3022 animation.z = 5;
3023 animation.scale_x = 0.08 * size + (move.directional[0] * 0.01);
3024 animation.scale_y = 0.07 * size + (move.directional[1] * 0.01);
3025 animation.offset_z = -10 * move.linear[0];
3026 animation.offset_x = 0; //-30 * move.linear[0];
3027 animation.offset_y = 0;
3028 animation.low_limit = 0;
3030
3031 animation.dist = distance[x][y] * s;
3032 animation.angle =
3033 5 * polar_theta[x][y] + 1 * move.radial[1] +
3034 animation.dist / (3 + move.directional[1] * 0.5);
3035 animation.z = 50;
3036 animation.scale_x = 0.08 * size + (move.directional[1] * 0.01);
3037 animation.scale_y = 0.07 * size + (move.directional[2] * 0.01);
3038 animation.offset_z = -10 * move.linear[1];
3039 animation.offset_x = 0; //-30 * move.linear[0];
3040 animation.offset_y = 0;
3041 animation.low_limit = 0;
3043
3044 animation.dist = distance[x][y];
3045 animation.angle = 1;
3046 animation.z = 500;
3047 animation.scale_x = 0.2 * size;
3048 animation.scale_y = 0.2 * size;
3049 animation.offset_z = 0; //-12 * move.linear[3];
3050 animation.offset_y = +7 * move.linear[3] + move.noise_angle[3];
3051 animation.offset_x = 0;
3052 animation.low_limit = 0;
3054
3055 animation.dist = distance[x][y];
3056 animation.angle =
3057 5 * polar_theta[x][y] + 12 * move.radial[3] +
3058 animation.dist / (((move.directional[5] + 3) * 2)) +
3059 move.noise_angle[3] * q;
3060 animation.z = 500;
3061 animation.scale_x = 0.09 * size * (move.directional[5] + 1.5);
3062 ;
3063 ;
3064 animation.scale_y = 0.09 * size * (move.directional[6] + 1.5);
3065 ;
3066 ;
3067 animation.offset_z = 0;
3068 animation.offset_x = -35 * move.linear[3];
3069 animation.offset_y = 0;
3070 animation.low_limit = 0;
3072
3073 // show5 = screen(show4, show3)-show2;
3074 // show6 = colordodge(show4, show1);
3075
3076 // show7 = multiply(show1, show2);
3077 /*
3078 float linear1 = y / 32.f;
3079 float linear2 = (32-y) / 32.f;
3080 */
3081
3082 float radius = radial_filter_radius; // radius of a radial
3083 // brightness filter
3084 float radial = (radius - distance[x][y]) / distance[x][y];
3085 /*
3086 show7 = multiply(show1, show2) * linear1*2;
3087 show8 = subtract(show7, show5);
3088 */
3089
3090 show5 = ((show1 + show2)) - show3;
3091 if (show5 > 255)
3092 show5 = 255;
3093 if (show5 < 0)
3094 show5 = 0;
3095
3097
3098 pixel.red = show5 * radial;
3099 pixel.blue = (64 - show5 - show3) * radial;
3100 pixel.green = 0.5 * (show6);
3101 // pixel.blue = show5 * radial;
3102 // pixel.red = (1*show1 + 1*show2) - show7/2;
3103
3105
3107 }
3108 }
3109 }
3110
3112
3113 get_ready();
3114
3115 timings.master_speed = 0.01; // master speed
3116
3117 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
3118 // values = faster transitions
3119 timings.ratio[1] = 0.027;
3120 timings.ratio[2] = 0.031;
3121 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3122 // values = faster transitions
3123 timings.ratio[4] = 0.037;
3124 timings.ratio[5] = 0.0038;
3125 timings.ratio[6] = 0.041;
3126
3128
3129 float size = 0.6;
3130
3131 // float q = 1;
3132
3133 for (int x = 0; x < num_x; x++) {
3134 for (int y = 0; y < num_y; y++) {
3135
3136 float s = 1 + move.directional[6] * 0.8;
3137
3138 animation.dist = distance[x][y] * s;
3139 animation.angle = 10 * move.radial[6] +
3140 50 * move.directional[5] * polar_theta[x][y] -
3141 animation.dist / 3;
3142 animation.z = 5;
3143 animation.scale_x = 0.08 * size;
3144 animation.scale_y = 0.07 * size;
3145 animation.offset_z = -10 * move.linear[0];
3146 animation.offset_x = 0;
3147 animation.offset_y = 0;
3148 animation.low_limit = -0.5;
3150
3151 float radius = radial_filter_radius; // radius of a radial
3152 // brightness filter
3153 float radial = (radius - distance[x][y]) / distance[x][y];
3154
3155 pixel.red = show1 * radial;
3156 pixel.green = 0;
3157 pixel.blue = 0;
3158
3160
3162 }
3163 }
3164 }
3165
3167
3168 get_ready();
3169
3170 timings.master_speed = 0.01; // master speed
3171
3172 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
3173 // values = faster transitions
3174 timings.ratio[1] = 0.027;
3175 timings.ratio[2] = 0.031;
3176 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3177 // values = faster transitions
3178 timings.ratio[4] = 0.037;
3179 timings.ratio[5] = 0.0038;
3180 timings.ratio[6] = 0.041;
3181
3183
3184 for (int x = 0; x < num_x; x++) {
3185 for (int y = 0; y < num_y; y++) {
3186
3187 animation.dist = distance[x][y];
3188 animation.angle = 16 * polar_theta[x][y] + 16 * move.radial[0];
3189 animation.z = 5;
3190 animation.scale_x = 0.06;
3191 animation.scale_y = 0.06;
3192 animation.offset_z = -10 * move.linear[0];
3193 animation.offset_y = 10 * move.noise_angle[0];
3194 animation.offset_x = 10 * move.noise_angle[4];
3195 animation.low_limit = 0;
3197
3198 animation.dist = distance[x][y];
3199 animation.angle = 16 * polar_theta[x][y] + 16 * move.radial[1];
3200 animation.z = 500;
3201 animation.scale_x = 0.06;
3202 animation.scale_y = 0.06;
3203 animation.offset_z = -10 * move.linear[1];
3204 animation.offset_y = 10 * move.noise_angle[1];
3205 animation.offset_x = 10 * move.noise_angle[3];
3206 animation.low_limit = 0;
3208
3209 // float radius = radial_filter_radius; // radius of a radial
3210 // brightness filter float radial =
3211 // (radius-distance[x][y])/distance[x][y];
3212
3213 pixel.red = show1;
3214 pixel.green = 0;
3215 pixel.blue = show2;
3216
3218
3220 }
3221 }
3222 }
3223
3224 void Water() {
3225
3226 get_ready();
3227
3228 timings.master_speed = 0.037; // master speed
3229
3230 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
3231 // values = faster transitions
3232 timings.ratio[1] = 0.027;
3233 timings.ratio[2] = 0.031;
3234 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3235 // values = faster transitions
3236 timings.ratio[4] = 0.037;
3237 timings.ratio[5] = 0.1;
3238 timings.ratio[6] = 0.41;
3239
3241
3242 for (int x = 0; x < num_x; x++) {
3243 for (int y = 0; y < num_y; y++) {
3244
3245 animation.dist =
3246 distance[x][y] +
3247 4 * sinf(move.directional[5] * PI + (float)x / 2) +
3248 4 * cosf(move.directional[6] * PI + float(y) / 2);
3249 animation.angle = 1 * polar_theta[x][y];
3250 animation.z = 5;
3251 animation.scale_x = 0.06;
3252 animation.scale_y = 0.06;
3253 animation.offset_z = -10 * move.linear[0];
3254 animation.offset_y = 10;
3255 animation.offset_x = 10;
3256 animation.low_limit = 0;
3258
3259 animation.dist = (10 + move.directional[0]) *
3260 sinf(-move.radial[5] + move.radial[0] +
3261 (distance[x][y] / (3)));
3262 animation.angle = 1 * polar_theta[x][y];
3263 animation.z = 5;
3264 animation.scale_x = 0.1;
3265 animation.scale_y = 0.1;
3266 animation.offset_z = -10;
3267 animation.offset_y = 20 * move.linear[0];
3268 animation.offset_x = 10;
3269 animation.low_limit = 0;
3271
3272 animation.dist = (10 + move.directional[1]) *
3273 sinf(-move.radial[5] + move.radial[1] +
3274 (distance[x][y] / (3)));
3275 animation.angle = 1 * polar_theta[x][y];
3276 animation.z = 500;
3277 animation.scale_x = 0.1;
3278 animation.scale_y = 0.1;
3279 animation.offset_z = -10;
3280 animation.offset_y = 20 * move.linear[1];
3281 animation.offset_x = 10;
3282 animation.low_limit = 0;
3284
3285 animation.dist = (10 + move.directional[2]) *
3286 sinf(-move.radial[5] + move.radial[2] +
3287 (distance[x][y] / (3)));
3288 animation.angle = 1 * polar_theta[x][y];
3289 animation.z = 500;
3290 animation.scale_x = 0.1;
3291 animation.scale_y = 0.1;
3292 animation.offset_z = -10;
3293 animation.offset_y = 20 * move.linear[2];
3294 animation.offset_x = 10;
3295 animation.low_limit = 0;
3297
3298 // float radius = radial_filter_radius; // radius of a radial
3299 // brightness filter float radial =
3300 // (radius-distance[x][y])/distance[x][y];
3301
3302 // pixel.red = show2;
3303
3304 pixel.blue = (0.7 * show2 + 0.6 * show3 + 0.5 * show4);
3305 pixel.red = pixel.blue - 40;
3306 pixel.green = 0;
3307 // pixel.red = radial*show3;
3308 // pixel.green = 0.9*radial*show4;
3309
3311
3313 }
3314 }
3315 }
3316
3318
3319 get_ready();
3320
3321 timings.master_speed = 0.003; // master speed
3322
3323 timings.ratio[0] = 0.025; // speed ratios for the oscillators, higher
3324 // values = faster transitions
3325 timings.ratio[1] = 0.027;
3326 timings.ratio[2] = 0.029;
3327 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3328 // values = faster transitions
3329 timings.ratio[4] = 0.037;
3330 timings.ratio[5] = 0.15; // wave speed
3331 timings.ratio[6] = 0.41;
3332
3334
3335 for (int x = 0; x < num_x; x++) {
3336 for (int y = 0; y < num_y; y++) {
3337
3338 float s = 4;
3339 float f = 10 + 2 * move.directional[0];
3340
3341 animation.dist = (f + move.directional[0]) *
3342 sinf(-move.radial[5] + move.radial[0] +
3343 (distance[x][y] / (s)));
3344 animation.angle = 1 * polar_theta[x][y];
3345 animation.z = 5;
3346 animation.scale_x = 0.1;
3347 animation.scale_y = 0.1;
3348 animation.offset_z = -10;
3349 animation.offset_y = 20 * move.linear[0];
3350 animation.offset_x = 10;
3351 animation.low_limit = 0;
3353
3354 animation.dist = (f + move.directional[1]) *
3355 sinf(-move.radial[5] + move.radial[1] +
3356 (distance[x][y] / (s)));
3357 animation.angle = 1 * polar_theta[x][y];
3358 animation.z = 500;
3359 animation.scale_x = 0.1;
3360 animation.scale_y = 0.1;
3361 animation.offset_z = -10;
3362 animation.offset_y = 20 * move.linear[1];
3363 animation.offset_x = 10;
3364 animation.low_limit = 0;
3366
3367 animation.dist = (f + move.directional[2]) *
3368 sinf(-move.radial[5] + move.radial[2] +
3369 (distance[x][y] / (s)));
3370 animation.angle = 1 * polar_theta[x][y];
3371 animation.z = 5000;
3372 animation.scale_x = 0.1;
3373 animation.scale_y = 0.1;
3374 animation.offset_z = -10;
3375 animation.offset_y = 20 * move.linear[2];
3376 animation.offset_x = 10;
3377 animation.low_limit = 0;
3379
3380 animation.dist = (f + move.directional[3]) *
3381 sinf(-move.radial[5] + move.radial[3] +
3382 (distance[x][y] / (s)));
3383 animation.angle = 1 * polar_theta[x][y];
3384 animation.z = 2000;
3385 animation.scale_x = 0.1;
3386 animation.scale_y = 0.1;
3387 animation.offset_z = -10;
3388 animation.offset_y = 20 * move.linear[3];
3389 animation.offset_x = 10;
3390 animation.low_limit = 0;
3392
3393 show6 = screen(show4, show5);
3394 show7 = screen(show2, show3);
3395
3396 float radius = 40; // radius of a radial brightness filter
3397 float radial = (radius - distance[x][y]) / radius;
3398
3399 // pixel.red = show6;
3400 // pixel.blue = show7;
3401
3402 pixel.red = pixel.blue - 40;
3403 pixel.green = 0;
3404 pixel.blue = (0.3 * show6 + 0.7 * show7) * radial;
3405
3407
3409 }
3410 }
3411 }
3412
3414
3415 get_ready();
3416
3417 timings.master_speed = 0.03; // master speed
3418
3419 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
3420 // values = faster transitions
3421 timings.ratio[1] = 0.0027;
3422 timings.ratio[2] = 0.029;
3423 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3424 // values = faster transitions
3425
3427
3428 for (int x = 0; x < num_x; x++) {
3429 for (int y = 0; y < num_y; y++) {
3430
3431 animation.dist = distance[x][y] + 20 * move.directional[0];
3432 animation.angle = move.noise_angle[0] + move.noise_angle[1] +
3433 polar_theta[x][y];
3434 animation.z = 5;
3435 animation.scale_x = 0.1;
3436 animation.scale_y = 0.1;
3437 animation.offset_z = -10;
3438 animation.offset_y = 20 * move.linear[2];
3439 animation.offset_x = 10;
3440 animation.low_limit = 0;
3442
3443 pixel.red = 0;
3444 pixel.green = 0;
3445 pixel.blue = show1;
3446
3448
3450 }
3451 }
3452 }
3453
3455
3456 get_ready();
3457
3458 timings.master_speed = 0.02; // master speed
3459
3460 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
3461 // values = faster transitions
3462 timings.ratio[1] = 0.0027;
3463 timings.ratio[2] = 0.029;
3464 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3465 // values = faster transitions
3466
3468
3469 for (int x = 0; x < num_x; x++) {
3470 for (int y = 0; y < num_y; y++) {
3471
3472 animation.dist =
3473 distance[x][y] - (16 + move.directional[0] * 16);
3474 animation.angle = move.noise_angle[0] + move.noise_angle[1] +
3475 polar_theta[x][y];
3476 animation.z = 5;
3477 animation.scale_x = 0.1;
3478 animation.scale_y = 0.1;
3479 animation.offset_z = -10;
3480 animation.offset_y = 20 * move.linear[2];
3481 animation.offset_x = 10;
3482 animation.low_limit = 0;
3484
3485 pixel.red = show1;
3486 pixel.green = show1 - 80;
3487 pixel.blue = show1 - 150;
3488
3490
3492 }
3493 }
3494 }
3495
3497
3498 get_ready();
3499
3500 timings.master_speed = 0.01; // master speed
3501
3502 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
3503 // values = faster transitions
3504 timings.ratio[1] = 0.0027;
3505 timings.ratio[2] = 0.029;
3506 timings.ratio[3] = 0.033; // speed ratios for the oscillators, higher
3507 // values = faster transitions
3508
3510
3511 for (int x = 0; x < num_x; x++) {
3512 for (int y = 0; y < num_y; y++) {
3513
3514 animation.dist =
3515 distance[x][y] - (12 + move.directional[3] * 4);
3516 animation.angle = move.noise_angle[0] + move.noise_angle[1] +
3517 polar_theta[x][y];
3518 animation.z = 5;
3519 animation.scale_x = 0.1;
3520 animation.scale_y = 0.1;
3521 animation.offset_z = -10;
3522 animation.offset_y = 20 * move.linear[2];
3523 animation.offset_x = 10;
3524 animation.low_limit = 0;
3526
3527 pixel.red = show1;
3528 pixel.green = show1 - 80;
3529 pixel.blue = show1 - 150;
3530
3532
3534 }
3535 }
3536 }
3537
3538 void Zoom2() { // nice one
3539
3540 get_ready();
3541
3543 timings.master_speed = 0.003;
3545
3546 for (int x = 0; x < num_x; x++) {
3547 for (int y = 0; y < num_y; y++) {
3548
3549 animation.dist = (distance[x][y] * distance[x][y]) / 2;
3550 animation.angle = polar_theta[x][y];
3551
3552 animation.scale_x = 0.005;
3553 animation.scale_y = 0.005;
3554
3555 animation.offset_y = -10 * move.linear[0];
3556 animation.offset_x = 0;
3557 animation.offset_z = 0.1 * move.linear[0];
3558
3559 animation.z = 0;
3560 animation.low_limit = 0;
3561 float show1 = render_value(animation);
3562
3563 // float linear = 1;//(y+1)/(num_y-1.f);
3564
3565 pixel.red = show1;
3566 pixel.green = 0;
3567 pixel.blue = 40 - show1;
3568
3571 }
3572 }
3573 }
3574
3576
3577 get_ready();
3578
3579 timings.master_speed = 0.031; // master speed
3580
3581 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
3582 // values = faster transitions
3583 timings.ratio[1] = 0.0027;
3584 timings.ratio[2] = 0.029;
3585 timings.ratio[3] = 0.033;
3586 timings.ratio[4] = 0.036; // speed ratios for the oscillators, higher
3587 // values = faster transitions
3588
3590
3591 for (int x = 0; x < num_x; x++) {
3592 for (int y = 0; y < num_y; y++) {
3593
3594 float s = 0.8;
3595
3596 animation.dist = (distance[x][y] * distance[x][y]) * 0.7;
3597 animation.angle = polar_theta[x][y];
3598 animation.z = 5;
3599 animation.scale_x = 0.004 * s;
3600 animation.scale_y = 0.003 * s;
3601 animation.offset_z = 0.1 * move.linear[2];
3602 animation.offset_y = -20 * move.linear[2];
3603 animation.offset_x = 10;
3604 animation.low_limit = 0;
3606
3607 animation.dist = (distance[x][y] * distance[x][y]) * 0.8;
3608 animation.angle = polar_theta[x][y];
3609 animation.z = 50;
3610 animation.scale_x = 0.004 * s;
3611 animation.scale_y = 0.003 * s;
3612 animation.offset_z = 0.1 * move.linear[3];
3613 animation.offset_y = -20 * move.linear[3];
3614 animation.offset_x = 100;
3615 animation.low_limit = 0;
3617
3618 animation.dist = (distance[x][y] * distance[x][y]) * 0.9;
3619 animation.angle = polar_theta[x][y];
3620 animation.z = 5000;
3621 animation.scale_x = 0.004 * s;
3622 animation.scale_y = 0.003 * s;
3623 animation.offset_z = 0.1 * move.linear[4];
3624 animation.offset_y = -20 * move.linear[4];
3625 animation.offset_x = 1000;
3626 animation.low_limit = 0;
3628
3629 // overlapping color mapping
3630 /*
3631 float r = show1;
3632 float g = show2-show1;
3633 float b = show3-show1-show2;
3634 */
3635
3636 pixel.red = show1 - show2 - show3;
3637 pixel.blue = show2 - show1 - show3;
3638 pixel.green = show3 - show1 - show2;
3639 // pixel.green = b;
3640 // pixel.green = show1 - 80;
3641 // pixel.blue = show1 - 150;
3642
3644
3646 }
3647 }
3648 }
3649
3651
3652 get_ready();
3653
3654 timings.master_speed = 0.031; // master speed
3655
3656 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
3657 // values = faster transitions
3658 timings.ratio[1] = 0.0027;
3659 timings.ratio[2] = 0.029;
3660 timings.ratio[3] = 0.33;
3661 timings.ratio[4] = 0.036; // speed ratios for the oscillators, higher
3662 // values = faster transitions
3663
3665
3666 for (int x = 0; x < num_x; x++) {
3667 for (int y = 0; y < num_y; y++) {
3668
3669 float s = 1.5;
3670
3671 animation.dist = distance[x][y] +
3672 sinf(0.5 * distance[x][y] - move.radial[3]);
3673 animation.angle = polar_theta[x][y];
3674 animation.z = 5;
3675 animation.scale_x = 0.1 * s;
3676 animation.scale_y = 0.1 * s;
3677 animation.offset_z = 0.1 * move.linear[0];
3678 animation.offset_y = -20 * move.linear[0];
3679 animation.offset_x = 10;
3680 animation.low_limit = 0;
3682
3683 pixel.red = show1;
3684 pixel.green = 0;
3685 pixel.blue = 0;
3686
3688
3690 }
3691 }
3692 }
3693
3695
3696 get_ready();
3697
3698 timings.master_speed = 0.01; // master speed 0.031
3699
3700 float w = 0.7;
3701
3702 timings.ratio[0] = 0.0025; // speed ratios for the oscillators, higher
3703 // values = faster transitions
3704 timings.ratio[1] = 0.0027;
3705 timings.ratio[2] = 0.029;
3706 timings.ratio[3] = 0.33 * w;
3707 timings.ratio[4] = 0.36 * w; // speed ratios for the oscillators, higher
3708 // values = faster transitions
3709
3711
3712 for (int x = 0; x < num_x; x++) {
3713 for (int y = 0; y < num_y; y++) {
3714
3715 float s = 0.8;
3716
3717 animation.dist = distance[x][y] +
3718 sinf(0.25 * distance[x][y] - move.radial[3]);
3719 animation.angle = polar_theta[x][y];
3720 animation.z = 5;
3721 animation.scale_x = 0.1 * s;
3722 animation.scale_y = 0.1 * s;
3723 animation.offset_z = 0.1 * move.linear[0];
3724 animation.offset_y = -20 * move.linear[0];
3725 animation.offset_x = 10;
3726 animation.low_limit = 0;
3728
3729 animation.dist = distance[x][y] +
3730 sinf(0.24 * distance[x][y] - move.radial[4]);
3731 animation.angle = polar_theta[x][y];
3732 animation.z = 10;
3733 animation.scale_x = 0.1 * s;
3734 animation.scale_y = 0.1 * s;
3735 animation.offset_z = 0.1 * move.linear[1];
3736 animation.offset_y = -20 * move.linear[1];
3737 animation.offset_x = 10;
3738 animation.low_limit = 0;
3740
3741 /*
3742 pixel.red = show1;
3743 pixel.green = show1 * 0.3;
3744 pixel.blue = show2-show1;
3745 */
3746
3747 pixel.red = (show1 + show2);
3748 pixel.green = ((show1 + show2) * 0.6) - 30;
3749 pixel.blue = 0;
3750
3752
3754 }
3755 }
3756 }
3757
3759
3760 get_ready();
3761
3762 timings.master_speed = 0.005; // master speed 0.031
3763
3764 float w = 0.3;
3765
3766 timings.ratio[0] = 0.01; // speed ratios for the oscillators, higher
3767 // values = faster transitions
3768 timings.ratio[1] = 0.011;
3769 timings.ratio[2] = 0.029;
3770 timings.ratio[3] = 0.33 * w;
3771 timings.ratio[4] = 0.36 * w; // speed ratios for the oscillators, higher
3772 // values = faster transitions
3773
3775
3776 for (int x = 0; x < num_x; x++) {
3777 for (int y = 0; y < num_y; y++) {
3778
3779 float s = 0.7;
3780
3781 animation.dist =
3782 2 + distance[x][y] +
3783 2 * sinf(0.25 * distance[x][y] - move.radial[3]);
3784 animation.angle = polar_theta[x][y];
3785 animation.z = 5;
3786 animation.scale_x = 0.1 * s;
3787 animation.scale_y = 0.1 * s;
3788 animation.offset_z = 10 * move.linear[0];
3789 animation.offset_y = -20 * move.linear[0];
3790 animation.offset_x = 10;
3791 animation.low_limit = 0;
3793
3794 animation.dist =
3795 2 + distance[x][y] +
3796 2 * sinf(0.24 * distance[x][y] - move.radial[4]);
3797 animation.angle = polar_theta[x][y];
3798 animation.z = 10;
3799 animation.scale_x = 0.1 * s;
3800 animation.scale_y = 0.1 * s;
3801 animation.offset_z = 0.1 * move.linear[1];
3802 animation.offset_y = -20 * move.linear[1];
3803 animation.offset_x = 10;
3804 animation.low_limit = 0;
3806
3807 /*
3808 pixel.red = show1;
3809 pixel.green = show1 * 0.3;
3810 pixel.blue = show2-show1;
3811 */
3812
3813 pixel.red = (show1 + show2);
3814 pixel.green = ((show1 + show2) * 0.6) - 50;
3815 pixel.blue = 0;
3816
3818
3820 }
3821 }
3822 }
3823
3825
3826 get_ready();
3827
3828 timings.master_speed = 0.01; // master speed 0.031
3829
3830 float w = 0.3;
3831
3832 timings.ratio[0] = 0.01; // speed ratios for the oscillators, higher
3833 // values = faster transitions
3834 timings.ratio[1] = 0.011;
3835 timings.ratio[2] = 0.013;
3836 timings.ratio[3] = 0.33 * w;
3837 timings.ratio[4] = 0.36 * w; // speed ratios for the oscillators, higher
3838 // values = faster transitions
3839 timings.ratio[5] = 0.38 * w;
3840 timings.ratio[6] = 0.0003; // master rotation
3841
3842 timings.offset[0] = 0;
3843 timings.offset[1] = 100;
3844 timings.offset[2] = 200;
3845 timings.offset[3] = 300;
3846 timings.offset[4] = 400;
3847 timings.offset[5] = 500;
3848 timings.offset[6] = 600;
3849
3851
3852 for (int x = 0; x < num_x; x++) {
3853 for (int y = 0; y < num_y; y++) {
3854
3855 float s = 0.4; // scale
3856 float r = 1.5; // scroll speed
3857
3858 animation.dist =
3859 3 + distance[x][y] +
3860 3 * sinf(0.25 * distance[x][y] - move.radial[3]);
3861 animation.angle = polar_theta[x][y] + move.noise_angle[0] +
3862 move.noise_angle[6];
3863 animation.z = 5;
3864 animation.scale_x = 0.1 * s;
3865 animation.scale_y = 0.1 * s;
3866 animation.offset_z = 10 * move.linear[0];
3867 animation.offset_y = -5 * r * move.linear[0];
3868 animation.offset_x = 10;
3869 animation.low_limit = 0;
3871
3872 animation.dist =
3873 4 + distance[x][y] +
3874 4 * sinf(0.24 * distance[x][y] - move.radial[4]);
3875 animation.angle = polar_theta[x][y] + move.noise_angle[1] +
3876 move.noise_angle[6];
3877 animation.z = 5;
3878 animation.scale_x = 0.1 * s;
3879 animation.scale_y = 0.1 * s;
3880 animation.offset_z = 0.1 * move.linear[1];
3881 animation.offset_y = -5 * r * move.linear[1];
3882 animation.offset_x = 100;
3883 animation.low_limit = 0;
3885
3886 animation.dist =
3887 5 + distance[x][y] +
3888 5 * sinf(0.23 * distance[x][y] - move.radial[5]);
3889 animation.angle = polar_theta[x][y] + move.noise_angle[2] +
3890 move.noise_angle[6];
3891 animation.z = 5;
3892 animation.scale_x = 0.1 * s;
3893 animation.scale_y = 0.1 * s;
3894 animation.offset_z = 0.1 * move.linear[2];
3895 animation.offset_y = -5 * r * move.linear[2];
3896 animation.offset_x = 1000;
3897 animation.low_limit = 0;
3899
3901
3902 float rad = sinf(PI / 2 +
3903 distance[x][y] / 14); // better radial filter?!
3904
3905 /*
3906 pixel.red = show1;
3907 pixel.green = show1 * 0.3;
3908 pixel.blue = show2-show1;
3909 */
3910
3911 pixel.red = rad * ((show1 + show2) + show3);
3912 pixel.green = (((show2 + show3) * 0.8) - 90) * rad;
3913 pixel.blue = show4 * 0.2;
3914
3916
3918 }
3919 }
3920 }
3921
3923
3924 get_ready();
3925
3926 timings.master_speed = 0.03; // master speed 0.031
3927
3928 float w = 0.3;
3929
3930 timings.ratio[0] = 0.1; // speed ratios for the oscillators, higher
3931 // values = faster transitions
3932 timings.ratio[1] = 0.011;
3933 timings.ratio[2] = 0.013;
3934 timings.ratio[3] = 0.33 * w;
3935 timings.ratio[4] = 0.36 * w; // speed ratios for the oscillators, higher
3936 // values = faster transitions
3937 timings.ratio[5] = 0.38 * w;
3938 timings.ratio[6] = 0.0003;
3939
3941
3942 for (int x = 0; x < num_x; x++) {
3943 for (int y = 0; y < num_y; y++) {
3944
3945 animation.dist = distance[x][y];
3946 animation.angle = polar_theta[x][y] + move.radial[1];
3947 animation.z = 5;
3948 animation.scale_x = 0.001;
3949 animation.scale_y = 0.1;
3950 animation.scale_z = 0.1;
3951 animation.offset_y = -10 * move.linear[0];
3952 animation.offset_x = 20;
3953 animation.offset_z = 10;
3954 animation.low_limit = 0;
3956
3957 pixel.red = 10 * show1;
3958 pixel.green = 0;
3959 pixel.blue = 0;
3960
3962
3964 }
3965 }
3966 }
3967
3969
3970 get_ready();
3971
3972 timings.master_speed = 0.01; // master speed 0.031
3973
3974 float w = 1;
3975
3976 timings.ratio[0] = 0.01; // speed ratios for the oscillators, higher
3977 // values = faster transitions
3978 timings.ratio[1] = 0.011;
3979 timings.ratio[2] = 0.013;
3980 timings.ratio[3] = 0.33 * w;
3981 timings.ratio[4] = 0.36 * w; // speed ratios for the oscillators, higher
3982 // values = faster transitions
3983 timings.ratio[5] = 0.38 * w;
3984 timings.ratio[6] = 0.0003; // master rotation
3985
3986 timings.offset[0] = 0;
3987 timings.offset[1] = 100;
3988 timings.offset[2] = 200;
3989 timings.offset[3] = 300;
3990 timings.offset[4] = 400;
3991 timings.offset[5] = 500;
3992 timings.offset[6] = 600;
3993
3995
3996 for (int x = 0; x < num_x; x++) {
3997 for (int y = 0; y < num_y; y++) {
3998
3999 float s = 0.4; // scale
4000 float r = 1.5; // scroll speed
4001
4002 animation.dist =
4003 3 + distance[x][y] +
4004 3 * sinf(0.25 * distance[x][y] - move.radial[3]);
4005 animation.angle = polar_theta[x][y] + move.noise_angle[0] +
4006 move.noise_angle[6];
4007 animation.z = 5;
4008 animation.scale_x = 0.1 * s;
4009 animation.scale_y = 0.1 * s;
4010 animation.offset_z = 10 * move.linear[0];
4011 animation.offset_y = -5 * r * move.linear[0];
4012 animation.offset_x = 10;
4013 animation.low_limit = 0;
4015
4016 animation.dist =
4017 4 + distance[x][y] +
4018 4 * sinf(0.24 * distance[x][y] - move.radial[4]);
4019 animation.angle = polar_theta[x][y] + move.noise_angle[1] +
4020 move.noise_angle[6];
4021 animation.z = 5;
4022 animation.scale_x = 0.1 * s;
4023 animation.scale_y = 0.1 * s;
4024 animation.offset_z = 0.1 * move.linear[1];
4025 animation.offset_y = -5 * r * move.linear[1];
4026 animation.offset_x = 100;
4027 animation.low_limit = 0;
4029
4030 animation.dist =
4031 5 + distance[x][y] +
4032 5 * sinf(0.23 * distance[x][y] - move.radial[5]);
4033 animation.angle = polar_theta[x][y] + move.noise_angle[2] +
4034 move.noise_angle[6];
4035 animation.z = 5;
4036 animation.scale_x = 0.1 * s;
4037 animation.scale_y = 0.1 * s;
4038 animation.offset_z = 0.1 * move.linear[2];
4039 animation.offset_y = -5 * r * move.linear[2];
4040 animation.offset_x = 1000;
4041 animation.low_limit = 0;
4043
4045
4046 float rad = sinf(PI / 2 +
4047 distance[x][y] / 14); // better radial filter?!
4048
4049 /*
4050 pixel.red = show1;
4051 pixel.green = show1 * 0.3;
4052 pixel.blue = show2-show1;
4053 */
4054
4055 CHSV(rad * ((show1 + show2) + show3), 255, 255);
4056
4058
4059 uint8_t a = getTime() / 100;
4060 CRGB p = CRGB(CHSV(((a + show1 + show2) + show3), 255, 255));
4061 rgb pixel;
4062 pixel.red = p.red;
4063 pixel.green = p.green;
4064 pixel.blue = p.blue;
4066 }
4067 }
4068 }
4069};
4070
4071} // namespace animartrix_detail
uint32_t z[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
UISlider scale("Scale", 4,.1, 4,.1)
uint16_t speed
Definition Noise.ino:63
#define ANIMARTRIX_PRINT(S)
#define num_oscillators
float add(float &a, float &b)
void render_polar_lookup_table(float cx, float cy)
float map_float(float x, float in_min, float in_max, float out_min, float out_max)
virtual uint16_t xyMap(uint16_t x, uint16_t y)=0
float pnoise(float x, float y, float z)
fl::HeapVector< fl::HeapVector< float > > distance
float lerp(float t, float a, float b)
float render_value(render_parameters &animation)
void calculate_oscillators(oscillators &timings)
float subtract(float &a, float &b)
void setSpeedFactor(float speed)
Set the Speed Factor 0.1 to 10 - 1 for original speed.
float multiply(float &a, float &b)
void run_default_oscillators(float master_speed=0.005)
virtual void setPixelColorInternal(int x, int y, rgb pixel)=0
float colordodge(float &a, float &b)
float grad(int hash, float x, float y, float z)
float colorburn(float &a, float &b)
fl::HeapVector< fl::HeapVector< float > > polar_theta
float screen(float &a, float &b)
Defines the red, green, and blue (RGB) pixel struct.
#define FASTLED_FORCE_INLINE
Definition force_inline.h:7
#define PI
Definition math_macros.h:20
#define FASTLED_USING_NAMESPACE
Definition namespace.h:29
Implements the FastLED namespace macros.
static const uint8_t PERLIN_NOISE[]
float directional[num_oscillators]
float noise_angle[num_oscillators]
#define P(x)
Reads a single byte from the p array.
Definition noise.cpp:51
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
Definition noise.cpp:56
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54
#define round(x)
Definition util.h:10