Một số code mẫu về hiệu ứng với Object Animator trong android java

Code: Xml | Auth: 03cd82
<!-- Hãy tham khảo bài viết này trước: https://zezo.dev/note/huong-dan-su-dung-object-animator-de-tao-hieu-ung-cho-view-trong-android --> 

<!-- Code viết trong file hiệu ứng XML nhé, bạn hãy thử nghiệm với từng đoạn code, đừng copy cả đống vào luôn -->
<!--        di chuyển theo chiều ngang từ vị trí hiện tại tới vị trí 500dp, trong thời gian 3s (3000 ms)-->
        <objectAnimator android:propertyName="x"
            android:valueTo="500"
            android:duration="3000"
            />
<!--        di chuyển theo chiều dọc (y) từ vị trí hiện tại tới vị trí 500dp, trong thời gian 3s (3000 ms)-->

        <objectAnimator android:propertyName="y"
            android:valueTo="500"
            android:duration="3000"/>

<!--    Xoay một góc 70 độ với thời gian để hoàn thành xoay là 3s-->
    <objectAnimator android:propertyName="rotation"
        android:valueFrom="0"
        android:valueTo="70"
        android:duration="3000"
        />
<!--phóng to theo chiều ngang (trục x) lên 1,5 lần với thời gian hoàn thành phóng to là 3s-->
    <objectAnimator android:propertyName="scaleX"
        android:duration="3000"
        android:valueTo="1.5"/>
    
<!--phóng to theo chiều dọc (trục y) lên 4 lần với thời gian hoàn thành phóng to là 3s-->
    <objectAnimator android:propertyName="scaleY"
        android:duration="3000"
        android:valueTo="4.0"/>

<!--    làm mờ cái view đến mức không nhìn thấy gì, giá trị ban đầu là nhìn rõ (1.0), giá trị cuối valueTo="0" (mờ 100%)-->
<!--    chú ý: Giá trị nhận từ 0 đến 1, có thể điền 0.5 hoặc 0.2.... -->
    <objectAnimator android:propertyName="alpha"
        android:valueTo="0"
        android:valueFrom="1.0"
        android:duration="3000"
        />
<!--    Làm cho view hiển thị rõ nét từ trạng thái mờ-->
    <objectAnimator android:propertyName="alpha"
        android:valueTo="1.0"
        android:valueFrom="0"
        android:duration="3000"
        />


<!--    Nếu muốn cả 2 hiệu ứng cùng chạy thì gom vào trong 1 thẻ set-->
<!--    nếu android:ordering="together" là cùng chạy đồng thời 2 hiệu ứng-->
<!--    nếu android:ordering="sequentially" là chạy từng hiệu ứng, hết x rồi mới chạy y-->
    <set android:ordering="together">
        <objectAnimator android:propertyName="scaleX"
            android:duration="3000"
            android:valueTo="2"/>
        <objectAnimator android:propertyName="scaleY"
            android:duration="3000"
            android:valueTo="2"/>
    </set>