2016-04-13 12 views
1

私は2年以来Android developperですが、私はアニメーションを使ったことがありません。 私の会社のために解決するのに問題があります。次の画像に示すようにシークバーの価値を高めるほど悲しい顔を描き、彼をより幸せにする必要があります。Android:シークバーでアニメーション化されたベクトル描画可能なアニメーション

Smile following the progress of a seek bar

私はアンドロイドのマニュアルに関するAnimatedVectorDrawable

を追った。しかし、今のアニメーションは、3000msの期間を追跡し、私が求めて(ビデオのような)アニメーションを制御したいと思います笑顔アニメーションを描画しますバー。

本当に3日間以上インターネット上で何かを見つけようとしましたが、私が欲しいものを見つけるためのキーワードを持っていないと思います。

マイアニメーションベクトル:

<animated-vector 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:drawable="@drawable/face" > 
    <target 
     android:name="mouth" 
     android:animation="@animator/smile" /> 
</animated-vector> 

マイベクトル

<vector 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:height="200dp" 
    android:width="200dp" 
    android:viewportHeight="100" 
    android:viewportWidth="100" > 
    <path 
    android:fillColor="@color/yellow" 
    android:pathData="@string/path_circle"/> 
    <path 
    android:fillColor="@android:color/black" 
    android:pathData="@string/path_face_left_eye"/> 
    <path 
    android:fillColor="@android:color/black" 
    android:pathData="@string/path_face_right_eye"/> 
    <path 
    android:name="mouth" 
    android:strokeColor="@android:color/black" 
    android:strokeWidth="@integer/stroke_width" 
    android:strokeLineCap="round" 
    android:pathData="@string/path_face_mouth_sad"/> 
</vector> 

マイオブジェクトアニメーター

<objectAnimator 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:duration="3000" 
    android:propertyName="pathData" 
    android:valueFrom="@string/path_face_mouth_sad" 
    android:valueTo="@string/path_face_mouth_happy" 
    android:valueType="pathType" 
    android:interpolator="@android:anim/accelerate_interpolator"/> 

私のアニメーション機能

private void animate() { 
    Drawable drawable = imageView.getDrawable(); 
    if (drawable instanceof Animatable) { 
    ((AnimatedVectorDrawable) drawable).start(); 
    } 
} 

はあなたの助けのためにありがとうございました。私の試行についての情報がさらに必要な場合は、お気軽にお問い合わせください。

答えて

1

あなたはRoadRunnerを見てください。それはSVGで動作し、手動で進捗を設定することもできます。

+0

おかげで、私はそれを見ていたではなく、詳細に、私は再びチェックします。あなたに知らせる – Chami

0

使用ValueAnimator:

ValueAnimator mProgressAnimator = ValueAnimator.ofInt(progress, 
getMax()).setDuration(timeToEnd); 
mProgressAnimator.setInterpolator(new LinearInterpolator()); 
mProgressAnimator.addUpdateListener(this); 
mProgressAnimator.start(); 

@Override 
public void onAnimationUpdate(final ValueAnimator valueAnimator) { 
    final int animatedIntValue = (int) 
    valueAnimator.getAnimatedValue(); 
    setProgress(animatedIntValue); 
} 
関連する問題