Animation
public class Animation : AnimationBasic
The basic class for single-keyframe animations.
Animation(type: .color)
.duration(duration)
.from(UIColor)
.to(UIColor)
Animation(type: .textColor)
.duration(duration)
.from(UIColor)
.to(UIColor)
Animation(type: .position)
.duration(duration)
.from(x, y)
.to(x, y)
.resetOnStop(true)
Animation(type: .rotation)
.duration(duration)
.from(fromValue)
.to(toValue)
Animation(type: .scale)
.duration(duration)
.from(xScale, yScale)
.to(xScale, yScale)
Animation(type: .contentOffset)
.duration(duration)
.from(x, y)
.to(x, y)
-
Initializer
Declaration
Swift
required public init(type: AnimationType)
Parameters
type
The type of the animation.
-
Specifies the basic duration of the animation, in seconds.
Declaration
Swift
@discardableResult public func duration(_ duration: Float) -> Self
Parameters
duration
The basic duration of the animation, in seconds.
Return Value
Self
-
Specifies the amount of time (measured in seconds) to wait before beginning the animations.
Declaration
Swift
@discardableResult public func delay(_ delay: Float) -> Self
Parameters
delay
The amount of time (measured in seconds) to wait before beginning the animations. Specify a value of 0 to begin the animations immediately.
Return Value
Self
-
Determines the number of times the animation will repeat.
Declaration
Swift
@discardableResult public func repeatCount(_ count: Int) -> Self
Parameters
count
The number of times the animation will repeat.
Return Value
Self
-
Sets a Boolean value that controls whether that repeats this animation forever.
Declaration
Swift
@discardableResult public func repeatForever(_ forever: Bool) -> Self
Parameters
forever
A Boolean value that controls whether that repeats this animation forever.
Return Value
Self
-
Determines if the animation plays in the reverse upon completion.
Declaration
Swift
@discardableResult public func autoReverse(_ reverse: Bool) -> Self
Parameters
reverse
true if you want to this animaiton plays in the reverse upon completion.
Return Value
Self
-
Sets an optional timing function defining the pacing of the animation.
Declaration
Swift
@discardableResult public func timingFunc(_ timing: AnimationTimingFunc) -> Self
Parameters
timing
An optional timing function defining the pacing of the animation.
Return Value
Self
-
Defines the float value the animation uses to start interpolation.
Declaration
Swift
@discardableResult public func from(_ v1: Float) -> Self
Parameters
v1
The float value the animation uses to start interpolation.
Return Value
Self
-
Defines the point value the animation uses to start interpolation.
Declaration
Swift
@discardableResult public func from(_ v1: Float, _ v2: Float) -> Self
Parameters
v1
The x of the point.
v2
The y of the point.
Return Value
Self
-
Defines the point value the animation uses to start interpolation.
Declaration
Swift
@discardableResult public func from(_ tuple: (Float, Float)) -> Self
Parameters
tuple
The tuple value that describes the point. (x, y)
Return Value
self
-
Defines the color value the animation uses to start interpolation.
Declaration
Swift
@discardableResult public func from(_ tuple: (Float, Float, Float, Float)) -> Self
Parameters
tuple
The tuple value that describes the color. (red, green, blue, alpha) 0~ 255
Return Value
Self
-
Defines the color value the animation uses to start interpolation.
Declaration
Swift
@discardableResult public func from(_ v1: Float, _ v2: Float, _ v3: Float, _ v4: Float) -> Self
Parameters
v1
The red value of the color object. 0~ 255
v2
The green value of the color object. 0~ 255
v3
The blue value of the color object. 0~ 255
v4
The opacity value of the color object, specified as a value from 0.0 to 1.0.
Return Value
Self
-
Defines the color value the animation uses to start interpolation.
Declaration
Swift
@discardableResult public func from(_ color: UIColor) -> Self
Parameters
color
The color value the animation uses to start interpolation.
Return Value
Self.
-
Defines the float value the animation uses to end interpolation.
Declaration
Swift
@discardableResult public func to(_ v1: Float) -> Self
Parameters
v1
The float value the animation uses to end interpolation.
Return Value
Self
-
Defines the point value the animation uses to end interpolation.
Declaration
Swift
@discardableResult public func to(_ v1: Float, _ v2: Float) -> Self
Parameters
v1
The x of the point.
v2
The y of the point.
Return Value
Self
-
Defines the point value the animation uses to end interpolation.
Declaration
Swift
@discardableResult public func to(_ tuple: (Float, Float)) -> Self
Parameters
tuple
The tuple value that describes the point. (x, y)
Return Value
Self
-
Defines the color value the animation uses to end interpolation.
Declaration
Swift
@discardableResult public func to(_ tuple: (Float, Float, Float, Float)) -> Self
Parameters
tuple
The tuple value that describes the color. (red, green, blue, alpha) 0~ 255
Return Value
Self
-
Defines the color value the animation uses to end interpolation.
Declaration
Swift
@discardableResult public func to(_ v1: Float, _ v2: Float, _ v3: Float, _ v4: Float) -> Self
Parameters
v1
The red value of the color object. 0~ 255
v2
The green value of the color object. 0~ 255
v3
The blue value of the color object. 0~ 255
v4
The opacity value of the color object, specified as a value from 0.0 to 1.0.
Return Value
Self
-
Defines the color value the animation uses to end interpolation.
Declaration
Swift
@discardableResult public func to(_ color: UIColor) -> Self
Parameters
color
The color value the animation uses to end interpolation.
Return Value
Self
-
Updates this animation.
Declaration
Swift
@discardableResult public override func update(progress: Float) -> Self
Parameters
progress
The progess of the animation. 0.0~1.0
Return Value
Self
-
Attach this animation to the specific UIKit view.
Declaration
Swift
@discardableResult public override func attach(_ view: UIView) -> Self
Parameters
view
The UIKit view that attachs this animation.
Return Value
Self
-
Starts this animation.
Declaration
Swift
public override func start()
Parameters
serial
Not working in this class.
-
Pause this animation.
Declaration
Swift
public override func pause()
-
Resume this animation.
Declaration
Swift
public override func resume()
-
Stop this animation.
Declaration
Swift
public override func stop()
-
Sets the call back of start animation.
Declaration
Swift
public func startCallback(_ callback: @escaping StartCallback) -> Self
Parameters
callback
The call back of start animation.
Return Value
Self
-
Sets the call back of pause animation.
Declaration
Swift
public func pauseCallback(_ callback: @escaping PauseCallback) -> Self
Parameters
callback
The call back of pause animation.
Return Value
Self
-
Sets the call back of resume animation.
Declaration
Swift
public func resumeCallback(_ callback: @escaping ResumeCallback) -> Self
Parameters
callback
The call back of resume animation.
Return Value
Self
-
Sets the call back of repeat animation.
Declaration
Swift
public func repeatCallback(_ callback: @escaping RepeatCallback) -> Self
Parameters
callback
The call back of repeat animation.
Return Value
Self
-
Sets the call back of finish animation.
Declaration
Swift
public func finishCallback(_ callback: @escaping FinishCallback) -> Self
Parameters
callback
The call back of finish animation.
Return Value
Self
-
Builds animation with elements.
let config: [AnimationElement] = [ .type(type), .duration(duration), .from(from), .to(to), .view(view) ] let animation = Animation.build(config)
Declaration
Swift
public static func build(_ elements: [AnimationElement]) -> Animation
Parameters
elements
The element of the animation.
Return Value
The animation object.