让一个动画一直执行的属性是_iOS 动画 一
View Animations
Animatable properties
? bounds: 改變 bounds 屬性可以在當(dāng)前 view 內(nèi)改變子視圖等的相對(duì)位置。
? frame: 改變 frame 可以移動(dòng)或者縮放 view 。
? center: 當(dāng)你想移動(dòng) view 到屏幕的新位置時(shí),可以改變此屬性。
? backgroundColor: 背景顏色。
? alpha: 改變此屬性,可以實(shí)現(xiàn)淡入淡出效果。
Animation options
options: 修改該屬性,可以實(shí)現(xiàn)多個(gè)自定義動(dòng)畫效果。
Repeating:
? .repeat: 添加該屬性,可以使動(dòng)畫一直循環(huán)重復(fù)執(zhí)行。
? .autoreverse: 只能和 .repeat 結(jié)合使用,先向前執(zhí)行動(dòng)畫,然后向相反方向進(jìn)行動(dòng)畫。
eg.
UIView.animate(withDuration: 0.5, delay: 0.4, options: [.repeat, .autoreverse], animations: { self.password.center.x += self.view.bounds.width }, completion: nil )Animation easing
現(xiàn)實(shí)中,物體移動(dòng)不是突然開始與戛然而止的,像汽車和火車那樣的運(yùn)動(dòng),是比較優(yōu)雅的加速、高速運(yùn)行、減速過程,像這樣:
illustrates.png
為使我們的動(dòng)畫看起來更接近現(xiàn)實(shí),我們可以通過簡(jiǎn)單設(shè)置 Animation easing 實(shí)現(xiàn)。
? .curveLinear: 該選項(xiàng)使動(dòng)畫無加速亦無減速過程。
? .curveEaseIn: 該選項(xiàng)使動(dòng)畫在開始的時(shí)候有個(gè)加速過程。
? .curveEaseOut: 該選項(xiàng)使動(dòng)畫在結(jié)束的時(shí)候有個(gè)減速過程。
? .curveEaseInOut: 該選項(xiàng)使動(dòng)畫在開始的時(shí)候有個(gè)加速過程,在結(jié)束的時(shí)候有個(gè)減速過程。
eg.
UIView.animate(withDuration: 0.5, delay: 0.4, options: [.repeat, .autoreverse, .curveEaseIn], animations: { self.password.center.x += self.view.bounds.width },completion: nil )附:demo下載地址
總結(jié)
以上是生活随笔為你收集整理的让一个动画一直执行的属性是_iOS 动画 一的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 什么是次级债券?次级债券与普通债券的区别
- 下一篇: oracle 匿名段,这段匿名块看着没什