本文整理汇总了Java中com.robinhood.spark.SparkView类的典型用法代码示例。如果您正苦于以下问题:Java SparkView类的具体用法?Java SparkView怎么用?Java SparkView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SparkView类属于com.robinhood.spark包,在下文中一共展示了SparkView类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnimation
import com.robinhood.spark.SparkView; //导入依赖的package包/类
@Override
public Animator getAnimation(final SparkView sparkView) {
ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
final Path linePath = sparkView.getSparkLinePath();
if(linePath == null) {
return null;
}
// get path length
final PathMeasure pathMeasure = new PathMeasure(linePath, false);
final float endLength = pathMeasure.getLength();
if(endLength <= 0) {
return null;
}
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float animatedValue = (float) animation.getAnimatedValue();
float animatedPathLength = animatedValue * endLength;
linePath.reset();
pathMeasure.getSegment(0, animatedPathLength, linePath, true);
// set the updated path for the animation
sparkView.setAnimationPath(linePath);
}
});
return animator;
}
示例2: getAnimation
import com.robinhood.spark.SparkView; //导入依赖的package包/类
/**
* Returns an Animator that performs the desired animation. Must call
* {@link SparkView#setAnimationPath} for each animation frame.
*
* See {@link LineSparkAnimator} and {@link MorphSparkAnimator} for examples.
*
* @param sparkView The SparkView object
*/
Animator getAnimation(final SparkView sparkView);