本文整理匯總了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);