Loading mechanics/src/com/android/mechanics/impl/Computations.kt +12 −12 Original line number Diff line number Diff line Loading @@ -481,6 +481,13 @@ internal abstract class Computations : CurrentFrameInput, LastFrameState, Static guaranteeState.updatedSpringParameters(lastBreakpoint) } springState = springState.calculateUpdatedState( nextBreakpointCrossTime - lastAnimationTime, springParameters, ) lastAnimationTime = nextBreakpointCrossTime val mappingBefore = mappings[segmentIndex] val beforeBreakpoint = mappingBefore.map(nextBreakpoint.position) val mappingAfter = mappings[segmentIndex + directionOffset] Loading @@ -498,18 +505,7 @@ internal abstract class Computations : CurrentFrameInput, LastFrameState, Static " after: $afterBreakpoint (mapping: $mappingAfter)", ) } if (!hasJumped && delta != 0f) { hasJumped = true springState = springState.nudge(velocityDelta = directMappedVelocity) } springState = springState.calculateUpdatedState( nextBreakpointCrossTime - lastAnimationTime, springParameters, ) lastAnimationTime = nextBreakpointCrossTime hasJumped = hasJumped || delta != 0f if (deltaIsFinite) { springState = springState.nudge(displacementDelta = -delta) Loading @@ -534,6 +530,10 @@ internal abstract class Computations : CurrentFrameInput, LastFrameState, Static } } if (hasJumped) { springState = springState.nudge(velocityDelta = directMappedVelocity) } val tightened = guarantee.updatedSpringParameters(segment.entryBreakpoint) DiscontinuityAnimation(springState, tightened, lastAnimationTime) Loading mechanics/tests/goldens/magneticDetach_afterAttach_detachesAgain.json +39 −39 Original line number Diff line number Diff line Loading @@ -214,25 +214,25 @@ 65, 60, 55, 46.603424, 42.153717, 36.203827, 30.321402, 25.1608, 21.651463, 18.9976, 17.06427, 15.6970415, 14.754084, 14.11806, 13.697852, 13.425745, 13.253073, 13.145809, 13.080716, 13.042264, 13.020281, 13.008238, 50, 43.38443, 36.351646, 29.990938, 24.672552, 21.162388, 18.574236, 16.725906, 15.440355, 14.566638, 13.985239, 13.6060915, 13.363756, 13.212058, 13.11921, 13.063812, 13.031747, 13.013887, 13.004453, 13, 13.75, 14.5, Loading @@ -245,26 +245,26 @@ 28.15, 30.1, 32.05, 35.264374, 44.949898, 58.693554, 67.97366, 76.22729, 82.931595, 88.0746, 91.862114, 94.56434, 96.44223, 97.71758, 98.56564, 99.118324, 99.47132, 99.69214, 99.82718, 99.90767, 99.954216, 99.980095, 99.99374, 34, 44.585567, 58.759357, 68.21262, 76.507256, 83.19111, 88.2904, 92.03026, 94.689606, 96.532425, 97.780754, 98.60885, 99.14723, 99.49028, 99.70432, 99.83485, 99.9124, 99.957054, 99.98176, 99.994675, 100 ] }, Loading mechanics/tests/goldens/magneticDetach_attach_snapsToOrigin.json +24 −24 Original line number Diff line number Diff line Loading @@ -133,30 +133,30 @@ 65, 60, 55, 46.603424, 42.153717, 36.203827, 30.321402, 25.1608, 20.901463, 17.4976, 14.814271, 12.6970415, 6.739443, 1.0775535, 0.635472, 0.35061052, 0.17432979, 0.07051067, 0.013341078, -0.014990943, -0.02636234, -0.028412364, -0.025858387, -0.02147111, -0.016770272, -0.012503948, -0.008967604, 50, 43.38443, 36.351646, 29.990938, 24.672552, 20.412388, 17.074236, 14.475905, 12.440355, 6.552413, 0.9461464, 0.54626375, 0.29212147, 0.13740596, 0.048214816, 0.0006277391, -0.021660766, -0.02938723, -0.029362231, -0.02572238, -0.020845085, -0.015992891, -0.01175198, -0.008320414, 0 ] }, Loading mechanics/tests/goldens/magneticDetach_detach_animatesDetach.json +20 −20 Original line number Diff line number Diff line Loading @@ -153,26 +153,26 @@ 29.5, 31, 32.5, 35.018974, 39.663006, 48.42785, 57.752815, 66.05525, 72.80347, 77.98236, 81.797516, 84.52017, 86.412674, 87.6982, 88.55319, 89.11048, 89.46649, 89.68923, 89.82548, 89.906715, 89.9537, 89.979836, 89.99362, 34, 39.29379, 48.383503, 57.851955, 66.20173, 72.95019, 78.10937, 81.899025, 84.597176, 86.4689, 87.738045, 88.58072, 89.129074, 89.4788, 89.69721, 89.83055, 89.909874, 89.95562, 89.98097, 89.99428, 90 ] }, Loading mechanics/tests/goldens/magneticDetach_placedWithDifferentBaseMapping.json +28 −28 Original line number Diff line number Diff line Loading @@ -129,34 +129,34 @@ -44.000008, -92.000015, -140, -183.21191, -271.30652, -366.4972, -451.83313, -521.4713, -575.0593, -614.6159, -642.8908, -662.57166, -675.9569, -684.86957, -690.6854, -694.4051, -696.73505, -698.16223, -699.01447, -699.5083, -699.7837, -699.9295, -700.00073, -700.03076, -700.0393, -700.03766, -700.03186, -700.0251, -700.01886, -700.0137, -700.0096, -214.33502, -311.3978, -404.9687, -484.4225, -547.1691, -594.3692, -628.61395, -652.7499, -669.3473, -680.51227, -687.87, -692.62244, -695.6304, -697.49365, -698.6208, -699.2841, -699.66156, -699.867, -699.9719, -700.02014, -700.03784, -700.04016, -700.03577, -700.02905, -700.0223, -700.0164, -700.0117, -700.0081, -700 ] }, Loading Loading
mechanics/src/com/android/mechanics/impl/Computations.kt +12 −12 Original line number Diff line number Diff line Loading @@ -481,6 +481,13 @@ internal abstract class Computations : CurrentFrameInput, LastFrameState, Static guaranteeState.updatedSpringParameters(lastBreakpoint) } springState = springState.calculateUpdatedState( nextBreakpointCrossTime - lastAnimationTime, springParameters, ) lastAnimationTime = nextBreakpointCrossTime val mappingBefore = mappings[segmentIndex] val beforeBreakpoint = mappingBefore.map(nextBreakpoint.position) val mappingAfter = mappings[segmentIndex + directionOffset] Loading @@ -498,18 +505,7 @@ internal abstract class Computations : CurrentFrameInput, LastFrameState, Static " after: $afterBreakpoint (mapping: $mappingAfter)", ) } if (!hasJumped && delta != 0f) { hasJumped = true springState = springState.nudge(velocityDelta = directMappedVelocity) } springState = springState.calculateUpdatedState( nextBreakpointCrossTime - lastAnimationTime, springParameters, ) lastAnimationTime = nextBreakpointCrossTime hasJumped = hasJumped || delta != 0f if (deltaIsFinite) { springState = springState.nudge(displacementDelta = -delta) Loading @@ -534,6 +530,10 @@ internal abstract class Computations : CurrentFrameInput, LastFrameState, Static } } if (hasJumped) { springState = springState.nudge(velocityDelta = directMappedVelocity) } val tightened = guarantee.updatedSpringParameters(segment.entryBreakpoint) DiscontinuityAnimation(springState, tightened, lastAnimationTime) Loading
mechanics/tests/goldens/magneticDetach_afterAttach_detachesAgain.json +39 −39 Original line number Diff line number Diff line Loading @@ -214,25 +214,25 @@ 65, 60, 55, 46.603424, 42.153717, 36.203827, 30.321402, 25.1608, 21.651463, 18.9976, 17.06427, 15.6970415, 14.754084, 14.11806, 13.697852, 13.425745, 13.253073, 13.145809, 13.080716, 13.042264, 13.020281, 13.008238, 50, 43.38443, 36.351646, 29.990938, 24.672552, 21.162388, 18.574236, 16.725906, 15.440355, 14.566638, 13.985239, 13.6060915, 13.363756, 13.212058, 13.11921, 13.063812, 13.031747, 13.013887, 13.004453, 13, 13.75, 14.5, Loading @@ -245,26 +245,26 @@ 28.15, 30.1, 32.05, 35.264374, 44.949898, 58.693554, 67.97366, 76.22729, 82.931595, 88.0746, 91.862114, 94.56434, 96.44223, 97.71758, 98.56564, 99.118324, 99.47132, 99.69214, 99.82718, 99.90767, 99.954216, 99.980095, 99.99374, 34, 44.585567, 58.759357, 68.21262, 76.507256, 83.19111, 88.2904, 92.03026, 94.689606, 96.532425, 97.780754, 98.60885, 99.14723, 99.49028, 99.70432, 99.83485, 99.9124, 99.957054, 99.98176, 99.994675, 100 ] }, Loading
mechanics/tests/goldens/magneticDetach_attach_snapsToOrigin.json +24 −24 Original line number Diff line number Diff line Loading @@ -133,30 +133,30 @@ 65, 60, 55, 46.603424, 42.153717, 36.203827, 30.321402, 25.1608, 20.901463, 17.4976, 14.814271, 12.6970415, 6.739443, 1.0775535, 0.635472, 0.35061052, 0.17432979, 0.07051067, 0.013341078, -0.014990943, -0.02636234, -0.028412364, -0.025858387, -0.02147111, -0.016770272, -0.012503948, -0.008967604, 50, 43.38443, 36.351646, 29.990938, 24.672552, 20.412388, 17.074236, 14.475905, 12.440355, 6.552413, 0.9461464, 0.54626375, 0.29212147, 0.13740596, 0.048214816, 0.0006277391, -0.021660766, -0.02938723, -0.029362231, -0.02572238, -0.020845085, -0.015992891, -0.01175198, -0.008320414, 0 ] }, Loading
mechanics/tests/goldens/magneticDetach_detach_animatesDetach.json +20 −20 Original line number Diff line number Diff line Loading @@ -153,26 +153,26 @@ 29.5, 31, 32.5, 35.018974, 39.663006, 48.42785, 57.752815, 66.05525, 72.80347, 77.98236, 81.797516, 84.52017, 86.412674, 87.6982, 88.55319, 89.11048, 89.46649, 89.68923, 89.82548, 89.906715, 89.9537, 89.979836, 89.99362, 34, 39.29379, 48.383503, 57.851955, 66.20173, 72.95019, 78.10937, 81.899025, 84.597176, 86.4689, 87.738045, 88.58072, 89.129074, 89.4788, 89.69721, 89.83055, 89.909874, 89.95562, 89.98097, 89.99428, 90 ] }, Loading
mechanics/tests/goldens/magneticDetach_placedWithDifferentBaseMapping.json +28 −28 Original line number Diff line number Diff line Loading @@ -129,34 +129,34 @@ -44.000008, -92.000015, -140, -183.21191, -271.30652, -366.4972, -451.83313, -521.4713, -575.0593, -614.6159, -642.8908, -662.57166, -675.9569, -684.86957, -690.6854, -694.4051, -696.73505, -698.16223, -699.01447, -699.5083, -699.7837, -699.9295, -700.00073, -700.03076, -700.0393, -700.03766, -700.03186, -700.0251, -700.01886, -700.0137, -700.0096, -214.33502, -311.3978, -404.9687, -484.4225, -547.1691, -594.3692, -628.61395, -652.7499, -669.3473, -680.51227, -687.87, -692.62244, -695.6304, -697.49365, -698.6208, -699.2841, -699.66156, -699.867, -699.9719, -700.02014, -700.03784, -700.04016, -700.03577, -700.02905, -700.0223, -700.0164, -700.0117, -700.0081, -700 ] }, Loading