Loading mechanics/benchmark/tests/src/com/android/mechanics/benchmark/MotionValueBenchmark.kt +2 −2 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ class MotionValueBenchmark { defaultSpring = SpringParameters(stiffness = 300f, dampingRatio = .9f), initialMapping = Mapping.Zero, ) { constantValue(breakpoint = 1f, value = 1f) fixedValue(breakpoint = 1f, value = 1f) } ) Loading Loading @@ -232,7 +232,7 @@ class MotionValueBenchmark { defaultSpring = SpringParameters(stiffness = 300f, dampingRatio = .9f), initialMapping = Mapping.Zero, ) { constantValue( fixedValue( breakpoint = 1f, value = 1f, guarantee = Guarantee.GestureDragDelta(1f), Loading mechanics/src/com/android/mechanics/behavior/VerticalExpandContainerSpec.kt +1 −1 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ class VerticalExpandContainerSpec( return with(density) { MotionSpec( directionalMotionSpec(opacitySpring, initialMapping = Mapping.Zero) { constantValue(breakpoint = visibleHeight.toPx(), value = 1f) fixedValue(breakpoint = visibleHeight.toPx(), value = 1f) } ) } Loading mechanics/src/com/android/mechanics/spec/builder/DirectionalBuilderImpl.kt +5 −5 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ internal open class DirectionalBuilderImpl( return CanBeLastSegmentImpl } override fun constantValue( override fun fixedValue( breakpoint: Float, value: Float, spring: SpringParameters, Loading @@ -204,11 +204,11 @@ internal open class DirectionalBuilderImpl( applySemantics(semantics) toBreakpointImpl(breakpoint, key) jumpToImpl(value, spring, guarantee) continueWithConstantValueImpl() continueWithFixedValueImpl() return CanBeLastSegmentImpl } override fun constantValueFromCurrent( override fun fixedValueFromCurrent( breakpoint: Float, delta: Float, spring: SpringParameters, Loading @@ -219,7 +219,7 @@ internal open class DirectionalBuilderImpl( applySemantics(semantics) toBreakpointImpl(breakpoint, key) jumpByImpl(delta, spring, guarantee) continueWithConstantValueImpl() continueWithFixedValueImpl() return CanBeLastSegmentImpl } Loading Loading @@ -258,7 +258,7 @@ internal open class DirectionalBuilderImpl( fractionalMapping = fraction } private fun continueWithConstantValueImpl() { private fun continueWithFixedValueImpl() { check(sourceValue.isFinite()) mappings.add(Mapping.Fixed(sourceValue)) Loading mechanics/src/com/android/mechanics/spec/builder/DirectionalBuilderScope.kt +5 −5 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ interface DirectionalBuilderScope { /** * Ends the current segment at the [breakpoint] position and defines the next segment to output * a constant value ([value]). * a fixed value ([value]). * * Note: This segment can be used as the last segment in the specification. * Loading @@ -169,7 +169,7 @@ interface DirectionalBuilderScope { * @param semantics Updated semantics values to be applied. Must be a subset of the * [SemanticKey]s used when first creating this builder. */ fun constantValue( fun fixedValue( breakpoint: Float, value: Float, spring: SpringParameters = defaultSpring, Loading @@ -187,7 +187,7 @@ interface DirectionalBuilderScope { * * @param breakpoint The breakpoint defining the end of the current segment and the start of the * next. * @param delta An optional offset to apply to the mapped value to determine the constant value. * @param delta An optional offset to apply to the mapped value to determine the fixed value. * Defaults to 0f. * @param spring The [SpringParameters] for the transition to this breakpoint. Defaults to * [defaultSpring]. Loading @@ -196,7 +196,7 @@ interface DirectionalBuilderScope { * @param semantics Updated semantics values to be applied. Must be a subset of the * [SemanticKey]s used when first creating this builder. */ fun constantValueFromCurrent( fun fixedValueFromCurrent( breakpoint: Float, delta: Float = 0f, spring: SpringParameters = defaultSpring, Loading Loading @@ -238,7 +238,7 @@ interface DirectionalBuilderScope { * * @param breakpoint The breakpoint defining the end of the current segment and the start of the * next. * @param delta An optional offset to apply to the mapped value to determine the constant value. * @param delta An optional offset to apply to the mapped value to determine the fixed value. * @param spring The [SpringParameters] for the transition to this breakpoint. * @param guarantee The animation guarantee for this transition. * @param key A unique [BreakpointKey] for this breakpoint. Loading mechanics/src/com/android/mechanics/spec/builder/DirectionalSpecBuilder.kt +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ fun MotionBuilderContext.effectsDirectionalMotionSpec( * target(breakpoint = 10f, from = 0f, to = 50f) * * // At breakpoint 20: Jump +5, and constant value 55. * constantValueFromCurrent(breakpoint = 20f, delta = 5f) * fixedValueFromCurrent(breakpoint = 20f, delta = 5f) * * // At breakpoint 30: Jump to 40. Linear mapping using: progress_since_breakpoint * fraction. * fractionalInput(breakpoint = 30f, from = 40f, fraction = 2f) Loading Loading
mechanics/benchmark/tests/src/com/android/mechanics/benchmark/MotionValueBenchmark.kt +2 −2 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ class MotionValueBenchmark { defaultSpring = SpringParameters(stiffness = 300f, dampingRatio = .9f), initialMapping = Mapping.Zero, ) { constantValue(breakpoint = 1f, value = 1f) fixedValue(breakpoint = 1f, value = 1f) } ) Loading Loading @@ -232,7 +232,7 @@ class MotionValueBenchmark { defaultSpring = SpringParameters(stiffness = 300f, dampingRatio = .9f), initialMapping = Mapping.Zero, ) { constantValue( fixedValue( breakpoint = 1f, value = 1f, guarantee = Guarantee.GestureDragDelta(1f), Loading
mechanics/src/com/android/mechanics/behavior/VerticalExpandContainerSpec.kt +1 −1 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ class VerticalExpandContainerSpec( return with(density) { MotionSpec( directionalMotionSpec(opacitySpring, initialMapping = Mapping.Zero) { constantValue(breakpoint = visibleHeight.toPx(), value = 1f) fixedValue(breakpoint = visibleHeight.toPx(), value = 1f) } ) } Loading
mechanics/src/com/android/mechanics/spec/builder/DirectionalBuilderImpl.kt +5 −5 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ internal open class DirectionalBuilderImpl( return CanBeLastSegmentImpl } override fun constantValue( override fun fixedValue( breakpoint: Float, value: Float, spring: SpringParameters, Loading @@ -204,11 +204,11 @@ internal open class DirectionalBuilderImpl( applySemantics(semantics) toBreakpointImpl(breakpoint, key) jumpToImpl(value, spring, guarantee) continueWithConstantValueImpl() continueWithFixedValueImpl() return CanBeLastSegmentImpl } override fun constantValueFromCurrent( override fun fixedValueFromCurrent( breakpoint: Float, delta: Float, spring: SpringParameters, Loading @@ -219,7 +219,7 @@ internal open class DirectionalBuilderImpl( applySemantics(semantics) toBreakpointImpl(breakpoint, key) jumpByImpl(delta, spring, guarantee) continueWithConstantValueImpl() continueWithFixedValueImpl() return CanBeLastSegmentImpl } Loading Loading @@ -258,7 +258,7 @@ internal open class DirectionalBuilderImpl( fractionalMapping = fraction } private fun continueWithConstantValueImpl() { private fun continueWithFixedValueImpl() { check(sourceValue.isFinite()) mappings.add(Mapping.Fixed(sourceValue)) Loading
mechanics/src/com/android/mechanics/spec/builder/DirectionalBuilderScope.kt +5 −5 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ interface DirectionalBuilderScope { /** * Ends the current segment at the [breakpoint] position and defines the next segment to output * a constant value ([value]). * a fixed value ([value]). * * Note: This segment can be used as the last segment in the specification. * Loading @@ -169,7 +169,7 @@ interface DirectionalBuilderScope { * @param semantics Updated semantics values to be applied. Must be a subset of the * [SemanticKey]s used when first creating this builder. */ fun constantValue( fun fixedValue( breakpoint: Float, value: Float, spring: SpringParameters = defaultSpring, Loading @@ -187,7 +187,7 @@ interface DirectionalBuilderScope { * * @param breakpoint The breakpoint defining the end of the current segment and the start of the * next. * @param delta An optional offset to apply to the mapped value to determine the constant value. * @param delta An optional offset to apply to the mapped value to determine the fixed value. * Defaults to 0f. * @param spring The [SpringParameters] for the transition to this breakpoint. Defaults to * [defaultSpring]. Loading @@ -196,7 +196,7 @@ interface DirectionalBuilderScope { * @param semantics Updated semantics values to be applied. Must be a subset of the * [SemanticKey]s used when first creating this builder. */ fun constantValueFromCurrent( fun fixedValueFromCurrent( breakpoint: Float, delta: Float = 0f, spring: SpringParameters = defaultSpring, Loading Loading @@ -238,7 +238,7 @@ interface DirectionalBuilderScope { * * @param breakpoint The breakpoint defining the end of the current segment and the start of the * next. * @param delta An optional offset to apply to the mapped value to determine the constant value. * @param delta An optional offset to apply to the mapped value to determine the fixed value. * @param spring The [SpringParameters] for the transition to this breakpoint. * @param guarantee The animation guarantee for this transition. * @param key A unique [BreakpointKey] for this breakpoint. Loading
mechanics/src/com/android/mechanics/spec/builder/DirectionalSpecBuilder.kt +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ fun MotionBuilderContext.effectsDirectionalMotionSpec( * target(breakpoint = 10f, from = 0f, to = 50f) * * // At breakpoint 20: Jump +5, and constant value 55. * constantValueFromCurrent(breakpoint = 20f, delta = 5f) * fixedValueFromCurrent(breakpoint = 20f, delta = 5f) * * // At breakpoint 30: Jump to 40. Linear mapping using: progress_since_breakpoint * fraction. * fractionalInput(breakpoint = 30f, from = 40f, fraction = 2f) Loading