當前位置: 首頁>>代碼示例>>Java>>正文


Java SparkView類代碼示例

本文整理匯總了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;
}
 
開發者ID:robinhood,項目名稱:spark,代碼行數:37,代碼來源:LineSparkAnimator.java

示例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);
 
開發者ID:robinhood,項目名稱:spark,代碼行數:10,代碼來源:SparkAnimator.java


注:本文中的com.robinhood.spark.SparkView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。