[英]View visible before animation and then animation occurs
I want to animate journeyText: TextView
from left side after all the rest of the animations are finished. 我希望在所有其他动画完成后从左侧动画化
journeyText: TextView
。 But the journeyText
is visible during start and then the animation occurs. 但是
journeyText
在开始时是可见的,然后动画发生。
I have done the following: 我做了以下事情:
val animator1 = ObjectAnimator.ofFloat(circularFace, "translationY", 2000f,0f)
animator1.repeatCount = 0
animator1.duration = 1000
val animator2 = ObjectAnimator.ofFloat(happyBdayText, "translationX", -2000f, 0f)
animator2.repeatCount = 0
animator2.duration = 1000
val animator3 = ObjectAnimator.ofFloat(journeyText, "translationX", -2000f, 0f)
animator3.repeatCount = 0
animator3.duration = 2000
animator3.startDelay = 5000
val set = AnimatorSet()
set.play(animator1)
set.play(animator2)
set.play(animator3)
set.start()
I have tried setting the visibility but it is not working. 我已经尝试设置可见性,但它无法正常工作。
You could just reduce your startDelay
value. 你可以减少你的
startDelay
值。
package com.example.myapplication
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val textView = findViewById<TextView>(R.id.text)
val animator1 = ObjectAnimator.ofFloat(textView, "translationY", 2000f, 0f)
animator1.repeatCount = 0
animator1.duration = 1000
val textTwo = findViewById<TextView>(R.id.texttwo)
val animator2 = ObjectAnimator.ofFloat(textTwo, "translationX", -2000f, 0f)
animator2.repeatCount = 0
animator2.duration = 1000
val textThree = findViewById<TextView>(R.id.textThree)
val animator3 = ObjectAnimator.ofFloat(textThree, "translationX", -2000f, 0f)
animator3.repeatCount = 0
animator3.duration = 2000
animator3.startDelay = 1
val set = AnimatorSet()
set.play(animator1)
set.play(animator2)
set.play(animator3)
set.start()
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.