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