blob: 429c4356f10ad44105b145ace1c64f67bb8b9673 [file] [log] [blame]
Chet Haase17fb4b02010-06-28 17:55:07 -07001/*
2 * Copyright (C) 2010 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
17package android.animation;
18
19/**
Chet Haasea18a86b2010-09-07 13:20:00 -070020 * Interface for use with the {@link ValueAnimator#setEvaluator(TypeEvaluator)} function. Evaluators
Chet Haase17fb4b02010-06-28 17:55:07 -070021 * allow developers to create animations on arbitrary property types, by allowing them to supply
Sascha Haeberlingbac75262013-08-15 19:37:32 -070022 * custom evaluators for types that are not automatically understood and used by the animation
Chet Haase17fb4b02010-06-28 17:55:07 -070023 * system.
24 *
Chet Haasea18a86b2010-09-07 13:20:00 -070025 * @see ValueAnimator#setEvaluator(TypeEvaluator)
Chet Haase17fb4b02010-06-28 17:55:07 -070026 */
Chet Haaseb39f0512011-05-24 14:36:40 -070027public interface TypeEvaluator<T> {
Chet Haase17fb4b02010-06-28 17:55:07 -070028
29 /**
30 * This function returns the result of linearly interpolating the start and end values, with
31 * <code>fraction</code> representing the proportion between the start and end values. The
Chet Haase5f9ea812014-05-06 17:07:16 -070032 * calculation is a simple parametric calculation: <code>result = x0 + t * (x1 - x0)</code>,
Chet Haase17fb4b02010-06-28 17:55:07 -070033 * where <code>x0</code> is <code>startValue</code>, <code>x1</code> is <code>endValue</code>,
34 * and <code>t</code> is <code>fraction</code>.
35 *
36 * @param fraction The fraction from the starting to the ending values
37 * @param startValue The start value.
38 * @param endValue The end value.
39 * @return A linear interpolation between the start and end values, given the
40 * <code>fraction</code> parameter.
41 */
Chet Haaseb39f0512011-05-24 14:36:40 -070042 public T evaluate(float fraction, T startValue, T endValue);
Chet Haase17fb4b02010-06-28 17:55:07 -070043
Sascha Haeberlingbac75262013-08-15 19:37:32 -070044}