本文整理汇总了Java中com.nineoldandroids.animation.TypeEvaluator类的典型用法代码示例。如果您正苦于以下问题:Java TypeEvaluator类的具体用法?Java TypeEvaluator怎么用?Java TypeEvaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeEvaluator类属于com.nineoldandroids.animation包,在下文中一共展示了TypeEvaluator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseAnimatorFromTypeArray
import com.nineoldandroids.animation.TypeEvaluator; //导入依赖的package包/类
/**
* @param anim The animator, must not be null
* @param arrayAnimator Incoming typed array for Animator's attributes.
* @param arrayObjectAnimator Incoming typed array for Object Animator's
* attributes.
*/
private static void parseAnimatorFromTypeArray(ValueAnimator anim,
TypedArray arrayAnimator, TypedArray arrayObjectAnimator) {
long duration = arrayAnimator.getInt(R.styleable.Animator_android_duration, 300);
long startDelay = arrayAnimator.getInt(R.styleable.Animator_android_startOffset, 0);
int valueType = arrayAnimator.getInt(R.styleable.Animator_vc_valueType, 0);
TypeEvaluator evaluator = null;
// Must be a path animator by the time I reach here
if (valueType == VALUE_TYPE_PATH) {
evaluator = setupAnimatorForPath(anim, arrayAnimator);
} else {
throw new IllegalArgumentException("target is not a pathType target");
}
anim.setDuration(duration);
anim.setStartDelay(startDelay);
if (arrayAnimator.hasValue(R.styleable.Animator_android_repeatCount)) {
anim.setRepeatCount(
arrayAnimator.getInt(R.styleable.Animator_android_repeatCount, 0));
}
if (arrayAnimator.hasValue(R.styleable.Animator_android_repeatMode)) {
anim.setRepeatMode(
arrayAnimator.getInt(R.styleable.Animator_android_repeatMode,
ValueAnimator.RESTART));
}
if (evaluator != null) {
anim.setEvaluator(evaluator);
}
if (arrayObjectAnimator != null) {
setupObjectAnimator(anim, arrayObjectAnimator);
}
}
开发者ID:canyinghao,项目名称:CanDialog,代码行数:44,代码来源:PathAnimatorInflater.java
示例2: setupAnimatorForPath
import com.nineoldandroids.animation.TypeEvaluator; //导入依赖的package包/类
/**
* Setup the Animator to achieve path morphing.
*
* @param anim The target Animator which will be updated.
* @param arrayAnimator TypedArray for the ValueAnimator.
* @return the PathDataEvaluator.
*/
private static TypeEvaluator setupAnimatorForPath(ValueAnimator anim,
TypedArray arrayAnimator) {
TypeEvaluator evaluator = null;
String fromString = arrayAnimator.getString(R.styleable.Animator_android_valueFrom);
String toString = arrayAnimator.getString(R.styleable.Animator_android_valueTo);
PathParser.PathDataNode[] nodesFrom =PathParser.createNodesFromPathData(fromString);
PathParser.PathDataNode[] nodesTo = PathParser.createNodesFromPathData(toString);
if (nodesFrom != null) {
if (nodesTo != null) {
anim.setObjectValues(nodesFrom, nodesTo);
if (!PathParser.canMorph(nodesFrom, nodesTo)) {
throw new InflateException(arrayAnimator.getPositionDescription()
+ " Can't morph from " + fromString + " to " + toString);
}
} else {
anim.setObjectValues((Object)nodesFrom);
}
evaluator = new PathDataEvaluator(PathParser.deepCopyNodes(nodesFrom));
} else if (nodesTo != null) {
anim.setObjectValues((Object)nodesTo);
evaluator = new PathDataEvaluator(PathParser.deepCopyNodes(nodesTo));
}
if (DBG_ANIMATOR_INFLATER && evaluator != null) {
Log.v(TAG, "create a new PathDataEvaluator here");
}
return evaluator;
}
开发者ID:canyinghao,项目名称:CanDialog,代码行数:38,代码来源:PathAnimatorInflater.java
注:本文中的com.nineoldandroids.animation.TypeEvaluator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论