Easing an Integer to a specific value?
hey guys!
i working on helper functions class making, 1 of eases int specific value on time. however, cannot figure out how achieve current code. here function:
if can me, great. or should start function eases 1 value @ time, in fixed amount of time?
thank you!
i working on helper functions class making, 1 of eases int specific value on time. however, cannot figure out how achieve current code. here function:
code: [select]
void easeall(int red, int green, int blue, int time, int ledtouseprevvalue)
{
int prevredvalue = ledstates[ledtouseprevvalue][0];
int prevbluevalue = ledstates[ledtouseprevvalue][1];
int prevgreenvalue = ledstates[ledtouseprevvalue][2];
int reddiff = red - prevredvalue;
int bluediff = blue - prevbluevalue;
int greendiff = green - prevgreenvalue;
int redstep = reddiff / red;
int bluestep = bluediff / blue;
int greenstep = greendiff / green;
for(int = 0; <= time; i++)
{
for(int b = 0; b <= __numledsinarray; b++)
{
ledstates[b][0] =- redstep;
ledstates[b][1] =- bluestep;
ledstates[b][2] =- greenstep;
}
delay(1);
}
}if can me, great. or should start function eases 1 value @ time, in fixed amount of time?
thank you!
the following statement sets value of ledstates
- equal to -redstep.code: [select]
ledstates[b][0] =- redstep;
if want subtract value of redstep current value, use "[glow]-=[/glow]", not "[glow]=-[/glow]"
regards,
dave
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Easing an Integer to a specific value?
arduino
Comments
Post a Comment