Center the rainbow a bit better
This commit is contained in:
parent
5792c114e8
commit
a81c5fdf90
@ -89,7 +89,7 @@ void NyanCatAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s) {
|
|||||||
const float top_of_cat = float(height())/2 - float(kCatHeight)/2;
|
const float top_of_cat = float(height())/2 - float(kCatHeight)/2;
|
||||||
for (int band=0 ; band<kRainbowBands ; ++band) {
|
for (int band=0 ; band<kRainbowBands ; ++band) {
|
||||||
// Calculate the Y position of this band.
|
// Calculate the Y position of this band.
|
||||||
const float y = float(kCatHeight) / (kRainbowBands + 2) * (band + 0.5) + top_of_cat;
|
const float y = float(kCatHeight) / (kRainbowBands + 1) * (band + 0.5) + top_of_cat;
|
||||||
// pow constants computed so that
|
// pow constants computed so that
|
||||||
// | band_scale(0) | ~= .5 and | band_scale(5) | ~= 32
|
// | band_scale(0) | ~= .5 and | band_scale(5) | ~= 32
|
||||||
const float band_scale = -std::cos(M_PI*band/(kRainbowBands-1))*.5*std::pow(2.3, band);
|
const float band_scale = -std::cos(M_PI*band/(kRainbowBands-1))*.5*std::pow(2.3, band);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user