Search in sources :

Example 1 with ArcMotion

use of android.transition.ArcMotion in project Conductor by bluelinelabs.

the class ArcFadeMoveChangeHandler method getTransition.

@Override
@NonNull
protected Transition getTransition(@NonNull ViewGroup container, View from, View to, boolean isPush) {
    TransitionSet transition = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL).addTransition(new Fade(Fade.OUT)).addTransition(new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform())).addTransition(new Fade(Fade.IN));
    transition.setPathMotion(new ArcMotion());
    return transition;
}
Also used : ChangeTransform(android.transition.ChangeTransform) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Fade(android.transition.Fade) ArcMotion(android.transition.ArcMotion) ChangeClipBounds(android.transition.ChangeClipBounds) NonNull(android.support.annotation.NonNull)

Example 2 with ArcMotion

use of android.transition.ArcMotion in project animate by hitherejoe.

the class PopupActivity method setupSharedElementTransitionsButton.

public void setupSharedElementTransitionsButton(@NonNull Activity activity, @Nullable View target) {
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);
    int color = ContextCompat.getColor(activity, R.color.accent);
    Interpolator easeInOut = AnimationUtils.loadInterpolator(activity, android.R.interpolator.fast_out_slow_in);
    MorphButtonToDialog sharedEnter = new MorphButtonToDialog(color);
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);
    MorphDialogToButton sharedReturn = new MorphDialogToButton(color);
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);
    if (target != null) {
        sharedEnter.addTarget(target);
        sharedReturn.addTarget(target);
    }
    activity.getWindow().setSharedElementEnterTransition(sharedEnter);
    activity.getWindow().setSharedElementReturnTransition(sharedReturn);
}
Also used : MorphButtonToDialog(com.hitherejoe.animate.util.MorphButtonToDialog) MorphDialogToButton(com.hitherejoe.animate.util.MorphDialogToButton) Interpolator(android.view.animation.Interpolator) ArcMotion(android.transition.ArcMotion)

Example 3 with ArcMotion

use of android.transition.ArcMotion in project animate by hitherejoe.

the class PopupActivity method setupSharedElementTransitionsFab.

public void setupSharedElementTransitionsFab(@NonNull Activity activity, @Nullable View target, int dialogCornerRadius) {
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);
    int color = ContextCompat.getColor(activity, R.color.accent);
    Interpolator easeInOut = AnimationUtils.loadInterpolator(activity, android.R.interpolator.fast_out_slow_in);
    MorphFabToDialog sharedEnter = new MorphFabToDialog(color, dialogCornerRadius);
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);
    MorphDialogToFab sharedReturn = new MorphDialogToFab(color);
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);
    if (target != null) {
        sharedEnter.addTarget(target);
        sharedReturn.addTarget(target);
    }
    activity.getWindow().setSharedElementEnterTransition(sharedEnter);
    activity.getWindow().setSharedElementReturnTransition(sharedReturn);
}
Also used : MorphDialogToFab(com.hitherejoe.animate.util.MorphDialogToFab) Interpolator(android.view.animation.Interpolator) MorphFabToDialog(com.hitherejoe.animate.util.MorphFabToDialog) ArcMotion(android.transition.ArcMotion)

Example 4 with ArcMotion

use of android.transition.ArcMotion in project CloudReader by youlookwhat.

the class BaseHeaderActivity method setMotion.

/**
     * 设置自定义 Shared Element切换动画
     * 默认不开启曲线路径切换动画,
     * 开启需要重写setHeaderPicView(),和调用此方法并将isShow值设为true
     *
     * @param imageView 共享的图片
     * @param isShow    是否显示曲线动画
     */
protected void setMotion(ImageView imageView, boolean isShow) {
    if (!isShow) {
        return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //定义ArcMotion
        ArcMotion arcMotion = new ArcMotion();
        arcMotion.setMinimumHorizontalAngle(50f);
        arcMotion.setMinimumVerticalAngle(50f);
        //插值器,控制速度
        Interpolator interpolator = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);
        //实例化自定义的ChangeBounds
        CustomChangeBounds changeBounds = new CustomChangeBounds();
        changeBounds.setPathMotion(arcMotion);
        changeBounds.setInterpolator(interpolator);
        changeBounds.addTarget(imageView);
        //将切换动画应用到当前的Activity的进入和返回
        getWindow().setSharedElementEnterTransition(changeBounds);
        getWindow().setSharedElementReturnTransition(changeBounds);
    }
}
Also used : Interpolator(android.view.animation.Interpolator) CustomChangeBounds(com.example.jingbin.cloudreader.view.CustomChangeBounds) ArcMotion(android.transition.ArcMotion)

Aggregations

ArcMotion (android.transition.ArcMotion)4 Interpolator (android.view.animation.Interpolator)3 NonNull (android.support.annotation.NonNull)1 ChangeBounds (android.transition.ChangeBounds)1 ChangeClipBounds (android.transition.ChangeClipBounds)1 ChangeTransform (android.transition.ChangeTransform)1 Fade (android.transition.Fade)1 TransitionSet (android.transition.TransitionSet)1 CustomChangeBounds (com.example.jingbin.cloudreader.view.CustomChangeBounds)1 MorphButtonToDialog (com.hitherejoe.animate.util.MorphButtonToDialog)1 MorphDialogToButton (com.hitherejoe.animate.util.MorphDialogToButton)1 MorphDialogToFab (com.hitherejoe.animate.util.MorphDialogToFab)1 MorphFabToDialog (com.hitherejoe.animate.util.MorphFabToDialog)1