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