DZAnimatedGift
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
XCode
Installation
DZAnimatedGift is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DZAnimatedGift'
Sample
at first, Import framework
import DZAnimatedGift
Simple
Add one image to screen, use default queue
DZAnimatedGift.addGift(image: "heart_pink",
at: CGPoint(x:sender.frame.midX, y:sender.frame.midY),
absolutePath: points,
duration: drand48()+2.0);
or
DZAnimatedGift.addGift(image: "heart_pink",
at: CGPoint(x:sender.frame.midX, y:sender.frame.midY),
relativePath: points,
duration: drand48()+2.0);
or
DZAnimatedGift.addGift(image: String,
at: CGPoint,
path: [PathNode],
type: .relative/.absolute,
duration: drand48()+2.0)
About the Parameter
image: String // the image of gift
at: CGPoint // start point of the animation
absolutePath: [PathNode] // path of the animation(absolute in view)
relativePath: [PathNode] // path of the animation(relative of the start point)
duration: CGFloat // duration of the animation
struct PathNode
PathNode
var point: CGPoint! // point
var controlPoint: CGPoint? // control point
Complex
let queue = DZAnimatedGift.createQueue(name: "QueueName", inView: self.view);
let width = 64*[0.6, 0.8, 1.0, 1.2].random();
let duration = 1.5*[0.7, 0.8, 0.9, 1.0, 1.2].random();
let g = GiftObject(image: "heart_pink",
startPoint: startPoint,
path: points,
duration: duration,
relative: true,
size: CGSize(width: width, height: width));
queue.add(object: g);
Author
darkzero, [email protected] iOS developer, working in Tokyo/Shanghai
License
DZAnimatedGift is available under the MIT license. See the LICENSE file for more info.