434 {
435
438
439
441 uint16_t noise_z = now * noise_speed / 10;
442 uint16_t noise_x = now * noise_speed / 80;
443 uint16_t noise_y = now * noise_speed / 160;
444
447
448
450 if(noise_speed < 50) {
451 dataSmoothing = 200 - (noise_speed * 4);
452 }
453
454
457
458
459 float angle = (float(
x) / float(width)) * 2.0f *
FL_PI;
460
461
462
463 float cylinder_radius = noise_scale;
464
465
466 float noise_x_cyl =
fl::cos(angle) * cylinder_radius;
467 float noise_y_cyl =
fl::sin(angle) * cylinder_radius;
468 float noise_z_height = float(
y) * noise_scale;
469
470
471 int xoffset = int(noise_x_cyl) + noise_x;
472 int yoffset = int(noise_y_cyl) + noise_y;
473 int zoffset = int(noise_z_height) + noise_z;
474
475
477
478
479 data = qsub8(data, 16);
480 data = qadd8(data, scale8(data, 39));
481
482
483 if(dataSmoothing) {
485 uint8_t olddata = (oldColor.r + oldColor.g + oldColor.b) / 3;
486 uint8_t newdata = scale8(olddata, dataSmoothing) + scale8(data, 256 - dataSmoothing);
487 data = newdata;
488 }
489
490
493
494
497 ihue = (now / 100) % 256;
498 index += ihue;
499 }
500
501
502
503
504
505
506
507
508
510
511
515
517 }
518 }
519}
fl::UIDropdown saturationFunction("Saturation Function", easeOptions)
fl::UIDropdown luminanceFunction("Luminance Function", easeOptions)
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
fl::UISlider noiseSpeed("Noise Speed", 4, 1, 100, 1)
fl::EaseType getEaseType(fl::string value)
fl::CRGBPalette16 noisePalette
fl::UISlider noiseScale("Noise Scale", 100, 10, 200, 5)
fl::shared_ptr< fl::Grid< fl::CRGB > > frameBufferPtr
fl::u8 inoise8(fl::u16 x, fl::u16 y, fl::u16 z)
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
enable_if< is_fixed_point< T >::value, T >::type cos(T angle) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type sin(T angle) FL_NOEXCEPT
CRGB colorBoost(EaseType saturation_function=EaseType::EASE_NONE, EaseType luminance_function=EaseType::EASE_NONE) const FL_NOEXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)