Code example for ObjectAnimator

Methods: setDuration, setRepeatCount, setRepeatMode, start

0
        getWindow().setBackgroundDrawable(new ColorDrawable(0xffffffff));
        final LinesView view = new LinesView(this);
        setContentView(view);
 
        mAnimator = ObjectAnimator.ofFloat(view, "offset", 0.0f, 15.0f);
        mAnimator.setDuration(1500);
        mAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        mAnimator.setRepeatMode(ObjectAnimator.REVERSE);
        mAnimator.start();
    } 
 
    @Override 
    protected void onDestroy() { 
        super.onDestroy(); 
        mAnimator.cancel();
    } 
 
    public static class LinesView extends View {
        private static final boolean LINE_AA = true;
 
        private final Bitmap mBitmap1;