• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.systemui.surfaceeffects.ripple
2 
3 import android.graphics.Color
4 
5 /**
6  * A struct that holds the ripple animation configurations.
7  *
8  * <p>This configuration is designed to play a SINGLE animation. Do not reuse or modify the
9  * configuration parameters to play different animations, unless the value has to change within the
10  * single animation (e.g. Change color or opacity during the animation). Note that this data class
11  * is pulled out to make the [RippleAnimation] constructor succinct.
12  */
13 data class RippleAnimationConfig(
14     val rippleShape: RippleShader.RippleShape = RippleShader.RippleShape.CIRCLE,
15     val duration: Long = 0L,
16     val centerX: Float = 0f,
17     val centerY: Float = 0f,
18     val maxWidth: Float = 0f,
19     val maxHeight: Float = 0f,
20     val pixelDensity: Float = 1f,
21     var color: Int = Color.WHITE,
22     val opacity: Int = RIPPLE_DEFAULT_ALPHA,
23     val sparkleStrength: Float = RIPPLE_SPARKLE_STRENGTH,
24     // Null means it uses default fade parameter values.
25     val baseRingFadeParams: RippleShader.FadeParams? = null,
26     val sparkleRingFadeParams: RippleShader.FadeParams? = null,
27     val centerFillFadeParams: RippleShader.FadeParams? = null,
28     val shouldDistort: Boolean = true
29 ) {
30     companion object {
31         const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f
32         const val RIPPLE_DEFAULT_COLOR: Int = 0xffffffff.toInt()
33         const val RIPPLE_DEFAULT_ALPHA: Int = 115 // full opacity is 255.
34     }
35 }
36