Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why using TypeEvaluator instead of Interpolator in this library? #6

Closed
tankcong opened this issue Jul 23, 2015 · 1 comment
Closed

Comments

@tankcong
Copy link

PropertyAnimation文档里似乎更推荐通过自定义Interpolator来控制所选属性的变化率。而TypeEvaluator的描述是:If you want to animate a type that is _unknown_ to the Android system, you can create your own evaluator by implementing the TypeEvaluator interface,似乎更加强调针对自定义类型或属性改变的情况。
自己在项目中几乎都使用Interpolator,这里不太明白,请教一下。
Thank you!:)

@daimajia daimajia changed the title 请教一下,为什么这里使用TypeEvaluator而不是Interpolator? Why using TypeEvaluator instead of Interpolator in this library? Feb 15, 2017
@daimajia
Copy link
Owner

@tankcong This is a really good question. And it's also the hardest part of this library.

Since easing functions need four parameters

  • time
  • begin value
  • value change
  • duration

If you try to use interpolator, you are unable to get or calculate all the value from Interpolator.

The following code is calculating these four parameters:
https://github.com/daimajia/AnimationEasingFunctions/blob/master/library/src/main/java/com/daimajia/easing/BaseEasingMethod.java#L70-L78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants