Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt +10 −0 Original line number Original line Diff line number Diff line Loading @@ -385,6 +385,7 @@ private fun elementAlpha( transformation = { it.alpha }, transformation = { it.alpha }, idleValue = 1f, idleValue = 1f, currentValue = { 1f }, currentValue = { 1f }, isSpecified = { true }, ::lerp, ::lerp, ) ) .fastCoerceIn(0f, 1f) .fastCoerceIn(0f, 1f) Loading Loading @@ -422,6 +423,7 @@ private fun ApproachMeasureScope.measure( transformation = { it.size }, transformation = { it.size }, idleValue = lookaheadSize, idleValue = lookaheadSize, currentValue = { measurable.measure(constraints).also { maybePlaceable = it }.size() }, currentValue = { measurable.measure(constraints).also { maybePlaceable = it }.size() }, isSpecified = { it != Element.SizeUnspecified }, ::lerp, ::lerp, ) ) Loading @@ -447,6 +449,7 @@ private fun getDrawScale( transformation = { it.drawScale }, transformation = { it.drawScale }, idleValue = Scale.Default, idleValue = Scale.Default, currentValue = { Scale.Default }, currentValue = { Scale.Default }, isSpecified = { true }, ::lerp, ::lerp, ) ) } } Loading Loading @@ -487,6 +490,7 @@ private fun ApproachMeasureScope.place( transformation = { it.offset }, transformation = { it.offset }, idleValue = targetOffsetInScene, idleValue = targetOffsetInScene, currentValue = { currentOffset }, currentValue = { currentOffset }, isSpecified = { it != Offset.Unspecified }, ::lerp, ::lerp, ) ) Loading Loading @@ -533,6 +537,7 @@ private inline fun <T> computeValue( transformation: (ElementTransformations) -> PropertyTransformation<T>?, transformation: (ElementTransformations) -> PropertyTransformation<T>?, idleValue: T, idleValue: T, currentValue: () -> T, currentValue: () -> T, isSpecified: (T) -> Boolean, lerp: (T, T, Float) -> T, lerp: (T, T, Float) -> T, ): T { ): T { val transition = val transition = Loading Loading @@ -598,6 +603,11 @@ private inline fun <T> computeValue( val start = sceneValue(fromState!!) val start = sceneValue(fromState!!) val end = sceneValue(toState!!) val end = sceneValue(toState!!) // TODO(b/316901148): Remove checks to isSpecified() once the lookahead pass runs for all // nodes before the intermediate layout pass. if (!isSpecified(start)) return end if (!isSpecified(end)) return start // Make sure we don't read progress if values are the same and we don't need to interpolate, // Make sure we don't read progress if values are the same and we don't need to interpolate, // so we don't invalidate the phase where this is read. // so we don't invalidate the phase where this is read. return if (start == end) start else lerp(start, end, transition.progress) return if (start == end) start else lerp(start, end, transition.progress) Loading Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt +10 −0 Original line number Original line Diff line number Diff line Loading @@ -385,6 +385,7 @@ private fun elementAlpha( transformation = { it.alpha }, transformation = { it.alpha }, idleValue = 1f, idleValue = 1f, currentValue = { 1f }, currentValue = { 1f }, isSpecified = { true }, ::lerp, ::lerp, ) ) .fastCoerceIn(0f, 1f) .fastCoerceIn(0f, 1f) Loading Loading @@ -422,6 +423,7 @@ private fun ApproachMeasureScope.measure( transformation = { it.size }, transformation = { it.size }, idleValue = lookaheadSize, idleValue = lookaheadSize, currentValue = { measurable.measure(constraints).also { maybePlaceable = it }.size() }, currentValue = { measurable.measure(constraints).also { maybePlaceable = it }.size() }, isSpecified = { it != Element.SizeUnspecified }, ::lerp, ::lerp, ) ) Loading @@ -447,6 +449,7 @@ private fun getDrawScale( transformation = { it.drawScale }, transformation = { it.drawScale }, idleValue = Scale.Default, idleValue = Scale.Default, currentValue = { Scale.Default }, currentValue = { Scale.Default }, isSpecified = { true }, ::lerp, ::lerp, ) ) } } Loading Loading @@ -487,6 +490,7 @@ private fun ApproachMeasureScope.place( transformation = { it.offset }, transformation = { it.offset }, idleValue = targetOffsetInScene, idleValue = targetOffsetInScene, currentValue = { currentOffset }, currentValue = { currentOffset }, isSpecified = { it != Offset.Unspecified }, ::lerp, ::lerp, ) ) Loading Loading @@ -533,6 +537,7 @@ private inline fun <T> computeValue( transformation: (ElementTransformations) -> PropertyTransformation<T>?, transformation: (ElementTransformations) -> PropertyTransformation<T>?, idleValue: T, idleValue: T, currentValue: () -> T, currentValue: () -> T, isSpecified: (T) -> Boolean, lerp: (T, T, Float) -> T, lerp: (T, T, Float) -> T, ): T { ): T { val transition = val transition = Loading Loading @@ -598,6 +603,11 @@ private inline fun <T> computeValue( val start = sceneValue(fromState!!) val start = sceneValue(fromState!!) val end = sceneValue(toState!!) val end = sceneValue(toState!!) // TODO(b/316901148): Remove checks to isSpecified() once the lookahead pass runs for all // nodes before the intermediate layout pass. if (!isSpecified(start)) return end if (!isSpecified(end)) return start // Make sure we don't read progress if values are the same and we don't need to interpolate, // Make sure we don't read progress if values are the same and we don't need to interpolate, // so we don't invalidate the phase where this is read. // so we don't invalidate the phase where this is read. return if (start == end) start else lerp(start, end, transition.progress) return if (start == end) start else lerp(start, end, transition.progress) Loading