mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
parent
89afedf3d5
commit
3156488b68
@ -91,14 +91,20 @@ void LinearColorSmoothing::updateLeds()
|
||||
_writeToLedsEnable = true;
|
||||
float k = 1.0f - 1.0f * deltaTime / (_targetTime - _previousTime);
|
||||
|
||||
int reddif = 0, greendif = 0, bluedif = 0;
|
||||
|
||||
for (size_t i = 0; i < _previousValues.size(); ++i)
|
||||
{
|
||||
ColorRgb & prev = _previousValues[i];
|
||||
ColorRgb & target = _targetValues[i];
|
||||
|
||||
prev.red += k * (target.red - prev.red);
|
||||
prev.green += k * (target.green - prev.green);
|
||||
prev.blue += k * (target.blue - prev.blue);
|
||||
reddif = target.red - prev.red;
|
||||
greendif = target.green - prev.green;
|
||||
bluedif = target.blue - prev.blue;
|
||||
|
||||
prev.red += (reddif < 0 ? -1:1) * ceil(k * abs(reddif));
|
||||
prev.green += (greendif < 0 ? -1:1) * ceil(k * abs(greendif));
|
||||
prev.blue += (bluedif < 0 ? -1:1) * ceil(k * abs(bluedif));
|
||||
}
|
||||
_previousTime = now;
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
// STL includes
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QTimer>
|
||||
|
Loading…
Reference in New Issue
Block a user