@@ -729,12 +729,12 @@ private fun AnimationSpecKeyframeWithSpline() {
729729 // [START android_compose_animation_spec_keyframes_with_spline]
730730 val offset by animateOffsetAsState(
731731 targetValue = Offset (300f , 300f ),
732- animationSpec = keyframesWithSpline {
733- durationMillis = 6000
734- Offset (0f , 0f ) at 0
735- Offset (150f , 200f ) atFraction 0.5f
736- Offset (0f ,100f ) atFraction 0.7f
737- }
732+ animationSpec = keyframesWithSpline {
733+ durationMillis = 6000
734+ Offset (0f , 0f ) at 0
735+ Offset (150f , 200f ) atFraction 0.5f
736+ Offset (0f , 100f ) atFraction 0.7f
737+ }
738738 )
739739 // [END android_compose_animation_spec_keyframes_with_spline]
740740}
@@ -788,32 +788,32 @@ private fun OffsetKeyframeWithSplineDemo() {
788788 offsetAnim.animateTo(
789789 targetValue = Offset .Zero ,
790790 animationSpec =
791- keyframesWithSpline {
792- durationMillis = 4400
793-
794- // Increasingly approach the halfway point moving from side to side
795- repeat(4 ) {
796- val i = it + 1
797- val sign = if (i % 2 == 0 ) 1 else - 1
798- Offset (
799- x = maxXOff * (i.toFloat() / 5f ) * sign,
800- y = (maxYOff) * (i.toFloat() / 5f )
801- ) atFraction (0.1f * i)
802- }
791+ keyframesWithSpline {
792+ durationMillis = 4400
793+
794+ // Increasingly approach the halfway point moving from side to side
795+ repeat(4 ) {
796+ val i = it + 1
797+ val sign = if (i % 2 == 0 ) 1 else - 1
798+ Offset (
799+ x = maxXOff * (i.toFloat() / 5f ) * sign,
800+ y = (maxYOff) * (i.toFloat() / 5f )
801+ ) atFraction (0.1f * i)
802+ }
803803
804- // Halfway point (at bottom of the screen)
805- Offset (0f , maxYOff) atFraction 0.5f
806-
807- // Return with mirrored movement
808- repeat(4 ) {
809- val i = it + 1
810- val sign = if (i % 2 == 0 ) 1 else - 1
811- Offset (
812- x = maxXOff * (1f - i.toFloat() / 5f ) * sign,
813- y = (maxYOff) * (1f - i.toFloat() / 5f )
814- ) atFraction ((0.1f * i) + 0.5f )
815- }
804+ // Halfway point (at bottom of the screen)
805+ Offset (0f , maxYOff) atFraction 0.5f
806+
807+ // Return with mirrored movement
808+ repeat(4 ) {
809+ val i = it + 1
810+ val sign = if (i % 2 == 0 ) 1 else - 1
811+ Offset (
812+ x = maxXOff * (1f - i.toFloat() / 5f ) * sign,
813+ y = (maxYOff) * (1f - i.toFloat() / 5f )
814+ ) atFraction ((0.1f * i) + 0.5f )
816815 }
816+ }
817817 )
818818 points.clear()
819819 }
0 commit comments