乐透动画完全淡出

时间:2019-07-03 10:47:23

标签: html css lottie bodymovin

我一次播放很多动画。完成播放后,我要淡出它。

最好的方法是什么?

我正在尝试淡入和淡出SVG Lottie动画。

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:app="http://schemas.android.com/apk/res-auto"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/frmContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:expanded="true">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

                <FrameLayout
                    android:id="@+id/frmMenu"
                    android:layout_width="match_parent"
                    android:layout_height="300dp"
                    android:clickable="true"
                    android:focusable="true"/>

            </com.google.android.material.appbar.CollapsingToolbarLayout>

        </com.google.android.material.appbar.AppBarLayout>

        <com.xpto.customview.PullView
            android:id="@+id/pullDownView"
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            app:layout_anchor="@+id/appBarLayout"
            app:layout_anchorGravity="bottom|center_horizontal"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"/>


    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</FrameLayout>

2 个答案:

答案 0 :(得分:0)

尝试使用此代码淡出完整动画中的元素

    anim.onComplete = function (e) {
        // fade out code...
    }

这是一个Codepen示例:

https://codepen.io/jaredstanley/pen/NmQYQY

答案 1 :(得分:0)

anim.onComplete = function(){
  //
}

这是一个带有工作示例的codepen(向下滚动到js面板的btm) https://codepen.io/jaredstanley/pen/NmQYQY