fire animation: decrease flashiness & increase saturation
This commit is contained in:
parent
04fd4fc7c8
commit
3948210d2a
|
@ -12,9 +12,11 @@ use rand::Rng;
|
|||
|
||||
const COOLDOWN_FACTOR : f32 = 0.99995;
|
||||
const MAX_ENERGY_PROPAGATION : f32 = 0.4;
|
||||
const RM_ENERGY : f32 = 0.02;
|
||||
const EXPONENT : f32 = 0.97;
|
||||
const W_EXPONNET : f32 = 0.03;
|
||||
const RM_ENERGY_SUB : f32 = 0.011;
|
||||
const RM_ENERGY_MULT : f32 = 0.995;
|
||||
const EXPONENT : f32 = 1.50;
|
||||
const W_EXPONENT : f32 = 2.20;
|
||||
const W_SCALE : f32 = 0.3;
|
||||
const OVERDRIVE : f32 = 0.3;
|
||||
|
||||
// A single-color flame.
|
||||
|
@ -55,8 +57,9 @@ impl Flame
|
|||
|
||||
// globally remove energy
|
||||
for led in 0..config::NUM_LEDS_PER_STRIP {
|
||||
if self.energy[strip][led] > RM_ENERGY {
|
||||
self.energy[strip][led] -= RM_ENERGY;
|
||||
self.energy[strip][led] *= RM_ENERGY_MULT;
|
||||
if self.energy[strip][led] > RM_ENERGY_SUB {
|
||||
self.energy[strip][led] -= RM_ENERGY_SUB;
|
||||
} else {
|
||||
self.energy[strip][led] = 0.0;
|
||||
}
|
||||
|
@ -154,7 +157,7 @@ impl Animation for Fire
|
|||
self.r_flame.update((cur_energy.r / self.max_energy.r).powf(EXPONENT));
|
||||
self.g_flame.update((cur_energy.g / self.max_energy.g).powf(EXPONENT));
|
||||
self.b_flame.update((cur_energy.b / self.max_energy.b).powf(EXPONENT));
|
||||
self.w_flame.update((cur_energy.w / self.max_energy.w).powf(EXPONENT));
|
||||
self.w_flame.update((cur_energy.w / self.max_energy.w).powf(W_EXPONENT));
|
||||
|
||||
//self.r_flame.print();
|
||||
|
||||
|
@ -165,7 +168,7 @@ impl Animation for Fire
|
|||
r: self.r_flame.get_energy(strip, led),
|
||||
g: self.g_flame.get_energy(strip, led),
|
||||
b: self.b_flame.get_energy(strip, led),
|
||||
w: self.w_flame.get_energy(strip, led)
|
||||
w: self.w_flame.get_energy(strip, led) * W_SCALE
|
||||
};
|
||||
|
||||
self.colorlists[strip][led].limit();
|
||||
|
|
Loading…
Reference in a new issue