1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.mechanics.spec 18 19 /** 20 * Describes the condition by which a discontinuity at a breakpoint must have finished animating. 21 * 22 * With a guarantee in effect, the spring parameters will be continuously adjusted, ensuring the 23 * guarantee's target will be met. 24 */ 25 sealed class Guarantee { 26 /** 27 * No guarantee is provided. 28 * 29 * The spring animation will proceed at its natural pace, regardless of the input or gesture's 30 * progress. 31 */ 32 data object None : Guarantee() 33 34 /** 35 * Guarantees that the animation will be complete before the input value is [delta] away from 36 * the [Breakpoint] position. 37 */ 38 data class InputDelta(val delta: Float) : Guarantee() 39 40 /** 41 * Guarantees to complete the animation before the gesture is [delta] away from the gesture 42 * position captured when the breakpoint was crossed. 43 */ 44 data class GestureDragDelta(val delta: Float) : Guarantee() 45 } 46