1 /*
<lambda>null2  * 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.wallpaper.picker.preview.ui.util
18 
19 import android.graphics.Path
20 import androidx.core.animation.PathInterpolator
21 import androidx.transition.Fade
22 import androidx.transition.Transition
23 
24 object AnimationUtil {
25     /** Immediate quick fade out with a bit of ease in. */
26     fun getFastFadeOutTransition(): Transition {
27         val fastOut =
28             Path().apply {
29                 quadTo(0.1f, 0f, 0.25f, 1f)
30                 lineTo(1f, 1f)
31             }
32         return Fade().setInterpolator { input -> PathInterpolator(fastOut).getInterpolation(input) }
33     }
34 
35     /** Delayed quick fade in with a bit of ease out. */
36     fun getFastFadeInTransition(): Transition {
37         val fastIn =
38             Path().apply {
39                 lineTo(0.75f, 0f)
40                 quadTo(0.9f, 1f, 1f, 1f)
41             }
42         return Fade().setInterpolator { input -> PathInterpolator(fastIn).getInterpolation(input) }
43     }
44 }
45