Search in sources :

Example 41 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class ViewLayersActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_layers);
    setupList(R.id.list1);
    setupList(R.id.list2);
    setupList(R.id.list3);
    getWindow().getDecorView().postDelayed(new Runnable() {

        @Override
        public void run() {
            final View leftList = findViewById(R.id.list1);
            final View middleList = findViewById(R.id.list2);
            final View rightList = findViewById(R.id.list3);
            final ObjectAnimator moveRight = ObjectAnimator.ofFloat(leftList, "x", 0, rightList.getLeft());
            moveRight.setDuration(1500);
            moveRight.setRepeatCount(ObjectAnimator.INFINITE);
            moveRight.setRepeatMode(ObjectAnimator.REVERSE);
            final ObjectAnimator moveLeft = ObjectAnimator.ofFloat(rightList, "x", rightList.getLeft(), 0);
            moveLeft.setDuration(1500);
            moveLeft.setRepeatCount(ObjectAnimator.INFINITE);
            moveLeft.setRepeatMode(ObjectAnimator.REVERSE);
            final ObjectAnimator rotate = ObjectAnimator.ofFloat(middleList, "rotationY", 0, 360);
            rotate.setDuration(3000);
            rotate.setRepeatCount(ObjectAnimator.INFINITE);
            rotate.setRepeatMode(ObjectAnimator.REVERSE);
            Paint p = new Paint();
            p.setColorFilter(new PorterDuffColorFilter(0xffff0000, PorterDuff.Mode.MULTIPLY));
            Paint p2 = new Paint();
            p2.setAlpha(127);
            Paint p3 = new Paint();
            p3.setColorFilter(new PorterDuffColorFilter(0xff00ff00, PorterDuff.Mode.MULTIPLY));
            leftList.setLayerType(View.LAYER_TYPE_SOFTWARE, p);
            leftList.setAlpha(0.5f);
            middleList.setLayerType(View.LAYER_TYPE_HARDWARE, p3);
            middleList.setAlpha(0.5f);
            middleList.setVerticalFadingEdgeEnabled(true);
            rightList.setLayerType(View.LAYER_TYPE_SOFTWARE, p2);
            moveRight.start();
            moveLeft.start();
            rotate.start();
            ((View) leftList.getParent()).setAlpha(0.5f);
        }
    }, 2000);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Paint(android.graphics.Paint) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView)

Example 42 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class ViewPropertyAlphaActivity method startAnim.

private void startAnim(View target) {
    ObjectAnimator anim = ObjectAnimator.ofFloat(target, View.ALPHA, 0);
    anim.setRepeatCount(ValueAnimator.INFINITE);
    anim.setRepeatMode(ValueAnimator.REVERSE);
    anim.setDuration(1000);
    anim.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator)

Example 43 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class Animated3dActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ImageView view = new ImageView(this);
    view.setImageResource(R.drawable.large_photo);
    setContentView(view, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, 360.0f);
    animator.setDuration(4000);
    animator.setRepeatCount(ObjectAnimator.INFINITE);
    animator.setRepeatMode(ObjectAnimator.REVERSE);
    animator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView)

Example 44 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class ClipOutlineActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final RegionView group = new RegionView(this);
    final TextView text = new TextView(this);
    text.setText(buildText());
    group.addView(text);
    setContentView(group);
    ObjectAnimator animator = ObjectAnimator.ofFloat(group, "clipPosition", 0.0f, 1.0f);
    animator.setDuration(3000);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) TextView(android.widget.TextView)

Example 45 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class ScaledTextActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final ScaledTextView view = new ScaledTextView(this);
    setContentView(view);
    ObjectAnimator animation = ObjectAnimator.ofFloat(view, "textScale", 1.0f, 10.0f);
    animation.setDuration(3000);
    animation.setRepeatCount(ObjectAnimator.INFINITE);
    animation.setRepeatMode(ObjectAnimator.REVERSE);
    animation.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)790 Animator (android.animation.Animator)313 AnimatorSet (android.animation.AnimatorSet)214 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)208 PropertyValuesHolder (android.animation.PropertyValuesHolder)128 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)101 Paint (android.graphics.Paint)68 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)48 TextView (android.widget.TextView)48 ViewGroup (android.view.ViewGroup)45 Rect (android.graphics.Rect)35 LinearInterpolator (android.view.animation.LinearInterpolator)35 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)29 OvershootInterpolator (android.view.animation.OvershootInterpolator)28 ArrayList (java.util.ArrayList)22 TargetApi (android.annotation.TargetApi)21 Interpolator (android.view.animation.Interpolator)20