#include "effect_sines.h" SinesEffectSinus::SinesEffectSinus(Window* w) { _window = w; _frequency = random8(40)+8; _amplitude = random(5)+2; _x = random8(_window->width); _step = 0; _color = CHSV(random8(), 255, 255); } void SinesEffectSinus::loop(uint16_t ms) { _value += _frequency; if ((_value == 0 || _value==128) && random8(16)==0) { int8_t sign = _value == 0 ? -1 : +1; if (_x > 200) sign = -1; else if (_x >= _window->width) sign = 1; _amplitude = random(3)+2; _frequency = random8(40)+8; _color = CHSV(random8(), 255, 255); _x = _x - sign*_amplitude; } uint8_t x = _x + ((sin8(_value) - 128) * _amplitude / 128); _window->setPixel(x, 0, &_color); } SinesEffect::SinesEffect() { for (int i=0; ishift_down_and_blur(); for (int i=0; iloop(ms); } }