Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MotionLayout make app laggy when animation starts in some devices #4

Open
hsnmrd opened this issue Jun 20, 2020 · 0 comments
Open

MotionLayout make app laggy when animation starts in some devices #4

hsnmrd opened this issue Jun 20, 2020 · 0 comments

Comments

@hsnmrd
Copy link

hsnmrd commented Jun 20, 2020

I'm using motion layout in my project and animation starts with lag in some devices like HTC Desire 820, Samsung J5 2017 (the devices that I test myself).
in my layout description file, scaleX, scaleY, alpha and views position changed

here is my layout description source
`

<Transition
    motion:constraintSetStart="@+id/start"
    motion:constraintSetEnd="@+id/end"
    motion:duration="1000"/>

<ConstraintSet android:id="@+id/start">

    <Constraint
        android:id="@id/mock_view"
        android:layout_width="0dp"
        android:layout_height="0dp"
        motion:layout_constraintEnd_toEndOf="parent"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintBottom_toBottomOf="parent"/>

    <Constraint
        android:id="@id/cv_content"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:rotation="0"
        android:alpha="1"
        motion:layout_constraintRight_toLeftOf="@+id/button"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"/>

    <Constraint
        android:id="@id/content"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:rotation="0"
        motion:layout_constraintRight_toLeftOf="@+id/button"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"/>


    <Constraint
        android:id="@id/v_activity_main_content"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        motion:layout_constraintEnd_toEndOf="parent"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintBottom_toBottomOf="parent"
        motion:layout_constraintStart_toEndOf="parent"/>

    <Constraint
        android:id="@id/cv_content_shadow"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:alpha="0"
        motion:layout_constraintRight_toRightOf="@+id/content_space"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1" />

    <Constraint
        android:id="@id/content_shadow"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:alpha="0"
        motion:layout_constraintRight_toRightOf="@+id/content_space"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1" />

</ConstraintSet>

<ConstraintSet android:id="@+id/end">

    <Constraint
        android:id="@id/mock_view"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="0.6"
        android:layout_height="0dp"
        motion:layout_constraintEnd_toEndOf="parent"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintBottom_toBottomOf="parent"/>

    <Constraint
        android:id="@id/cv_content"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:rotation="0"
        android:scaleX="0.72"
        android:scaleY="0.75"
        android:alpha="1"
        motion:layout_constraintRight_toLeftOf="@+id/button"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1" />

    <Constraint
        android:id="@id/content"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:rotation="0"
        android:scaleX="0.72"
        android:scaleY="0.72"
        motion:layout_constraintRight_toLeftOf="@+id/button"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1" />

    <Constraint
        android:id="@id/cv_content_shadow"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:scaleX="0.62"
        android:scaleY="0.65"
        android:alpha="0.3"
        motion:layout_constraintRight_toRightOf="@+id/content_space"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1" />

    <Constraint
        android:id="@id/content_shadow"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:scaleX="0.62"
        android:scaleY="0.62"
        android:alpha="0.3"
        motion:layout_constraintRight_toRightOf="@+id/content_space"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1" />

    <Constraint
        android:id="@id/v_activity_main_content"
        android:layout_width="0dp"
        android:scaleX="0.75"
        android:scaleY="0.75"
        android:layout_height="match_parent"
        motion:layout_constraintRight_toLeftOf="@+id/button"
        motion:layout_constraintTop_toTopOf="parent"
        motion:layout_constraintWidth_default="percent"
        motion:layout_constraintWidth_percent="1"/>

</ConstraintSet>

`

here is a video that shows lag
https://drive.google.com/file/d/1ucnXWONejnssdlHSKN1qijL1UR03eKFj/view?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant