am 76a5c86d: Merge "Fix lockscreen wave animation artifacts" into klp-dev

* commit '76a5c86df7902870c87ff07ffd0628cb10f32c00':
  Fix lockscreen wave animation artifacts
This commit is contained in:
Chet Haase
2013-10-03 16:11:42 -07:00
committed by Android Git Automerger
2 changed files with 6 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ public class GlowPadView extends View {
}
// Tuneable parameters for animation
private static final int WAVE_ANIMATION_DURATION = 1350;
private static final int WAVE_ANIMATION_DURATION = 1000;
private static final int RETURN_TO_HOME_DELAY = 1200;
private static final int RETURN_TO_HOME_DURATION = 200;
private static final int HIDE_ANIMATION_DELAY = 200;

View File

@@ -45,8 +45,8 @@ public class PointCloud {
public class WaveManager {
private float radius = 50;
private float width = 200.0f; // TODO: Make configurable
private float alpha = 0.0f;
public void setRadius(float r) {
radius = r;
}
@@ -186,13 +186,12 @@ public class PointCloud {
// Compute contribution from Wave
float radius = hypot(point.x, point.y);
float distanceToWaveRing = (radius - waveManager.radius);
float waveAlpha = 0.0f;
if (distanceToWaveRing < waveManager.width * 0.5f && distanceToWaveRing < 0.0f) {
float cosf = FloatMath.cos(PI * 0.25f * distanceToWaveRing / waveManager.width);
waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 20.0f));
if (radius < waveManager.radius * 2) {
float distanceToWaveRing = (radius - waveManager.radius);
float cosf = FloatMath.cos(PI * 0.5f * distanceToWaveRing / waveManager.radius);
waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 6.0f));
}
return (int) (max(glowAlpha, waveAlpha) * 255);
}