fujiyuu75 / Sequent

A simple continuous animation library for Android UI.
254 stars 36 forks source link

Issue with Animation (Blink effect) #18

Closed edwinperaza closed 7 years ago

edwinperaza commented 7 years ago

Hi,

I have a problem when I am trying to use Sequent, below you can see my code. The problem is that the animation produce a "blink" effect at the end. Can you explain me how to fix it? @fujiyuu75 Thanks.

Sequent.origin(mConstraintLayout)
                        .duration(5000) 
                        .delay(500) // option. StartOffSet time.
                        .offset(1000) //option. Interval time.
                        .flow(Direction.BACKWARD) // option. 
                        .start();

sequent_example

fujiyuu75 commented 7 years ago

Hi,

I guess it's probably needed to initialize the view animation before use Sequent. I will modify the library to initialize the view in a couple days, so please wait until then if you do not mind.

Thank you for teaching me the problem.

fujiyuu75 commented 7 years ago

Since I released a new version 0.1.3, could you try out the behavior? @edwinperaza Thanks.

edwinperaza commented 7 years ago

Hi @fujiyuu75 i get the same blink effect :( If I use this Sequent.origin(mConstraintLayout).start(); or this

Sequent.origin(mConstraintLayout)
                        .duration(5000) 
                        .delay(500) // option. StartOffSet time.
                        .offset(1000) //option. Interval time.
                        .flow(Direction.BACKWARD) // option. 
                        .start();

piece of code. I don´t know what happens.

But the behavior is normal if I use this Sequent.origin(mConstraintLayout).anim(mContext, R.anim.overshoot).start(); and this Sequent.origin(mConstraintLayout).anim(mContext, R.anim.fadeup).start();

Thanks.

edwinperaza commented 7 years ago

Hi @fujiyuu75 this is my whole class, you can check my implementation is you consider it neccesary.

public class MainTestActivity extends AppCompatActivity {

    ConstraintLayout mConstraintLayout;
    TextView mOneTextView;
    TextView mTwoTextView;
    TextView mThreeTextView;
    TextView mFourTextView;
    Button mAnimationButton;
    Context mContext;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_test);
        mConstraintLayout = (ConstraintLayout) findViewById(R.id.main_constraintLayout);
        mOneTextView = (TextView) findViewById(R.id.tv_one);
        mTwoTextView = (TextView) findViewById(R.id.tv_two);
        mThreeTextView = (TextView) findViewById(R.id.tv_three);
        mFourTextView = (TextView) findViewById(R.id.tv_four);
        mAnimationButton = (Button) findViewById(R.id.btn_animation);
        mContext = getApplicationContext();

        mAnimationButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //Sequent.origin(mConstraintLayout).start();
                //Sequent.origin(mConstraintLayout).anim(mContext, R.anim.overshoot).start();
                //Sequent.origin(mConstraintLayout).anim(mContext, R.anim.fadeup).start();
                Sequent.origin(mConstraintLayout)
                        .duration(5000) // How much time thw animation spent until finish.
                        .delay(500) // option. StartOffSet time.
                        .offset(1000) //option. Interval time.
                        .flow(Direction.BACKWARD) // option. Flow of animations in (FORWARD/BACKWARD/RANDOM).
                        .start();

            }
        });

    }
}

Thanks.

fujiyuu75 commented 7 years ago

Hi @edwinperaza

Thank you for your whole class. Since I want to reproduce the behavior, could you also show me xml layout code?

Thanks.

edwinperaza commented 7 years ago

Hi @fujiyuu75, yes this is my XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.edwinperaza.mytestlibrary.MainTestActivity">

    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/main_constraintLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:context="com.edwinperaza.mytestlibrary.MainTestActivity"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="8dp"
        android:layout_marginRight="8dp"
        app:layout_constraintRight_toRightOf="parent">

        <TextView
            android:id="@+id/tv_one"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_orange_light"
            android:gravity="center_horizontal"
            android:text="Hello World!"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.14" />

        <TextView
            android:id="@+id/tv_two"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:gravity="center_horizontal"
            android:text="Hello World! 2"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tv_one"
            app:layout_constraintVertical_bias="0.14" />

        <TextView
            android:id="@+id/tv_three"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@android:color/holo_red_light"
            android:gravity="center_horizontal"
            android:text="Hello World! 3"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tv_two"
            app:layout_constraintVertical_bias="0.14" />

        <TextView
            android:id="@+id/tv_four"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@android:color/holo_green_light"
            android:gravity="center_horizontal"
            android:text="Hello World! 4"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tv_three"
            app:layout_constraintVertical_bias="0.14" />

    </android.support.constraint.ConstraintLayout>

    <LinearLayout
        android:layout_width="368dp"
        android:layout_height="140dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="36dp"
        android:gravity="center_vertical|center_horizontal"
        android:orientation="horizontal"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/main_constraintLayout">

        <Button
            android:id="@+id/btn_animation"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Iniciar Animación" />
    </LinearLayout>

</android.support.constraint.ConstraintLayout>

I will be waiting your response.

Thanks.

fujiyuu75 commented 7 years ago

Hi @edwinperaza I confirmed correct animation with version 0.2.1. Please confirm that.

hammerheadlrx22cy_fujikawa06162017181334

If you can not do it well, it may be mobile terminal dependency, so please tell me the mobile terminal and os version.

Thanks.

edwinperaza commented 7 years ago

Hi @fujiyuu75 It works like a charm.

Thanks for your attention.

fujiyuu75 commented 7 years ago

Thank you @edwinperaza