fade transition working
This commit is contained in:
parent
b040559d17
commit
9b786910d8
6
TODO.txt
6
TODO.txt
@ -1,7 +1,5 @@
|
||||
toolbar preparation
|
||||
color cycle
|
||||
sequence
|
||||
fade transition
|
||||
simple slide transition
|
||||
add toolbar conf in settings
|
||||
additional color picker field
|
||||
@ -14,6 +12,10 @@ implement discrete range color setter
|
||||
implement discrete single color setter
|
||||
do not reboot after settings set -> add reboot button
|
||||
svg icons in html
|
||||
notifier function -> send get request
|
||||
nightlight function -> turns off after set time (+implement fading)
|
||||
(replace StrContains and num functions)
|
||||
settings getter/setter/html for fade transition
|
||||
|
||||
BUGS
|
||||
static ip disables mdns
|
||||
|
@ -627,13 +627,20 @@ void setLedsStandard()
|
||||
|
||||
void colorUpdated()
|
||||
{
|
||||
if (col[0] != col_old[0] && col[1] != col_old[1] && col[2] != col_old[2] && bri != bri_old)
|
||||
if (col[0] == col_old[0] && col[1] == col_old[1] && col[2] == col_old[2] && bri == bri_old)
|
||||
{
|
||||
return; //no change
|
||||
}
|
||||
notify();
|
||||
if (fadeTransition || seqTransition)
|
||||
{
|
||||
if (transitionActive)
|
||||
{
|
||||
col_old[0] = col_t[0];
|
||||
col_old[1] = col_t[1];
|
||||
col_old[2] = col_t[2];
|
||||
bri_old = bri_t;
|
||||
}
|
||||
transitionActive = true;
|
||||
transitionStartTime = millis();
|
||||
} else
|
||||
@ -644,9 +651,9 @@ void colorUpdated()
|
||||
|
||||
void handleTransitions()
|
||||
{
|
||||
if (transitionActive)
|
||||
if (transitionActive && transitionDelay > 0)
|
||||
{
|
||||
float tper = (millis() - transitionStartTime)/transitionDelay;
|
||||
float tper = (millis() - transitionStartTime)/(float)transitionDelay;
|
||||
if (tper >= 1.0)
|
||||
{
|
||||
transitionActive = false;
|
||||
@ -655,10 +662,10 @@ void handleTransitions()
|
||||
}
|
||||
if (fadeTransition)
|
||||
{
|
||||
col_t[0] = col_old[0]+((col[0] - col_old[0])/tper);
|
||||
col_t[1] = col_old[1]+((col[1] - col_old[1])/tper);
|
||||
col_t[2] = col_old[2]+((col[2] - col_old[2])/tper);
|
||||
bri_t = bri_old+((bri - bri_old)/tper);
|
||||
col_t[0] = col_old[0]+((col[0] - col_old[0])*tper);
|
||||
col_t[1] = col_old[1]+((col[1] - col_old[1])*tper);
|
||||
col_t[2] = col_old[2]+((col[2] - col_old[2])*tper);
|
||||
bri_t = bri_old+((bri - bri_old)*tper);
|
||||
}
|
||||
if (seqTransition)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user