0ea31924460786ea1ebb3a65a5e4947f23caaa63
[pub/Android/ownCloud.git] / actionbarsherlock / src / com / actionbarsherlock / internal / nineoldandroids / animation / TypeEvaluator.java
1 /*
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
17 package com.actionbarsherlock.internal.nineoldandroids.animation;
18
19 /**
20 * Interface for use with the {@link ValueAnimator#setEvaluator(TypeEvaluator)} function. Evaluators
21 * allow developers to create animations on arbitrary property types, by allowing them to supply
22 * custom evaulators for types that are not automatically understood and used by the animation
23 * system.
24 *
25 * @see ValueAnimator#setEvaluator(TypeEvaluator)
26 */
27 public interface TypeEvaluator<T> {
28
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
32 * calculation is a simple parametric calculation: <code>result = x0 + t * (v1 - v0)</code>,
33 * 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 */
42 public T evaluate(float fraction, T startValue, T endValue);
43
44 }