CABasicAnimation 的 fillMode 定义了在动画active duration
结束后的行为状态,
Determines if the receiver’s presentation is frozen or removed once its active duration has completed.
Defines how the timed object behaves outside its active duration.Local time may be clamped to either end of the active duration, or the element may be removed from the presentation. The legal values are
backwards',
forwards,
both’ andremoved
. Defaults toremoved
.
在 Swift 4.2 以前 fillModel 的类型为 String
1 | /* `fillMode' options. */ |
Swift 4.2 中 类型更改为 CAMediaTimingFillMode
, 是一个 struct
1 | public struct CAMediaTimingFillMode : Hashable, Equatable, RawRepresentable { |
此属性常常配合另一个属性isRemovedOnCompletion
配合使用,两者的组合效果如下图: