More subtle sparkle animation

- Reduce sparkle size
- Make sparkles fade out earlier
- Adjust animation duration

Test: visual
Fixes: 185826327
Change-Id: I477300f861dad4ec489b7a4d36b0ed7d75bf72e8
This commit is contained in:
Lucas Dupin
2021-04-19 15:40:55 -07:00
parent 469e1b4942
commit 668bb09e1a
2 changed files with 4 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ import java.util.function.Consumer;
public final class RippleAnimationSession {
private static final String TAG = "RippleAnimationSession";
private static final int ENTER_ANIM_DURATION = 450;
private static final int EXIT_ANIM_DURATION = 300;
private static final int EXIT_ANIM_DURATION = 225;
private static final long NOISE_ANIMATION_DURATION = 7000;
private static final long MAX_NOISE_PHASE = NOISE_ANIMATION_DURATION / 120;
private static final TimeInterpolator LINEAR_INTERPOLATOR = new LinearInterpolator();

View File

@@ -102,8 +102,8 @@ final class RippleShader extends RuntimeShader {
private static final String SHADER_MAIN = "vec4 main(vec2 p) {\n"
+ " float fadeIn = subProgress(0., 0.1, in_progress);\n"
+ " float scaleIn = subProgress(0., 0.45, in_progress);\n"
+ " float fadeOutNoise = subProgress(0.5, 1., in_progress);\n"
+ " float fadeOutRipple = subProgress(0.5, 0.75, in_progress);\n"
+ " float fadeOutNoise = subProgress(0.5, 0.95, in_progress);\n"
+ " float fadeOutRipple = subProgress(0.5, 1., in_progress);\n"
+ " vec2 center = mix(in_touch, in_origin, scaleIn);\n"
+ " float ring = softRing(p, center, in_maxRadius, scaleIn, 0.45);\n"
+ " float alpha = min(fadeIn, 1. - fadeOutNoise);\n"
@@ -210,7 +210,7 @@ final class RippleShader extends RuntimeShader {
}
public void setResolution(float w, float h, int density) {
final float densityScale = density * DisplayMetrics.DENSITY_DEFAULT_SCALE * 1.25f;
final float densityScale = density * DisplayMetrics.DENSITY_DEFAULT_SCALE;
setUniform("in_resolutionScale", new float[] {1f / w, 1f / h});
setUniform("in_noiseScale", new float[] {densityScale / w, densityScale / h});
}