Java Code Examples for android.animation.ObjectAnimator#getValues()

The following examples show how to use android.animation.ObjectAnimator#getValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UDAnimator.java    From VideoOS-Android-SDK with GNU General Public License v3.0 6 votes vote down vote up
/**
 * build a copy of given animator
 *
 * @return
 */
public Animator build() {
    //这种方式clone出来的animator不能重复播放
    /* ObjectAnimator result = getAnimator().clone();//克隆一份
    setupListeners(result);
    result.setupStartValues();
    return result;*/

    ObjectAnimator self = this.getAnimator();
    ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(self.getTarget());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        anim.setAutoCancel(true);
    }
    if (self.getValues() != null) {
        anim.setValues(self.getValues());
    }
    anim.setInterpolator(self.getInterpolator());
    anim.setDuration(self.getDuration());
    anim.setStartDelay(self.getStartDelay());
    anim.setRepeatCount(self.getRepeatCount());
    anim.setRepeatMode(self.getRepeatMode());
    setupListeners(anim);
    return anim;
}
 
Example 2
Source File: UDAnimator.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 设置属性
 *
 * @param name
 * @return
 */
public UDAnimator ofProperty(String name, float... values) {
    ObjectAnimator animator = getAnimator();
    if (animator != null && !TextUtils.isEmpty(name) && values != null) {
        PropertyValuesHolder[] valuesHolders = null;
        if (animator.getValues() != null && animator.getValues().length > 0) {
            valuesHolders = Arrays.copyOf(animator.getValues(), animator.getValues().length + 1);
        } else {
            valuesHolders = new PropertyValuesHolder[1];
        }
        valuesHolders[valuesHolders.length - 1] = PropertyValuesHolder.ofFloat(name, values);
        animator.setValues(valuesHolders);
    }
    return this;
}