Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for testing hound #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SSSpinnerButton Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
btnRippleEffect.setRippleEffect(rippleEffectAnimationDuration: 0.3, initialOpacity: 0.5, rippleEffectColor: .black, rippleEffectPercent: 0.45, initialRippleEffectPercent: 0.3)
print("hello world")
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func onSpinnnerButtonClick(_ sender: SSSpinnerButton) {
let arr: [SpinnerType] = [.ballClipRotate, .ballSpinFade, .lineSpinFade, .ballRotateChase, .circleStrokeSpin, .ballClipRotate, .ballSpinFade, .lineSpinFade, .ballRotateChase, .pacman, .circleScaleMultiple, .circleWaveSpin]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,45 @@ class SSCircleScaleMultiple: SSSpinnerAnimationDelegate {
layer.addSublayer(circle)
}
}

func setupSpinnerAnimation(layer: CALayer, frame: CGRect, color: UIColor, spinnerSize: UInt?) {
let sizeValue =min(frame.width, frame.height)
let center =CGPoint(x: 0, y: 0)
let duration:CFTimeInterval = 1
let beginTime = CACurrentMediaTime()
let beginTimes = [0, 0.2, 0.4]

// Scale animation
let scaleAnimation =CABasicAnimation(keyPath: "transform.scale")

scaleAnimation.duration = duration
scaleAnimation.fromValue = 0
scaleAnimation.toValue = 1

// Opacity animation
let opacityAnimation = CAKeyframeAnimation(keyPath: "opacity")
opacityAnimation.duration = duration
opacityAnimation.keyTimes = [0, 0.05, 1]
opacityAnimation.values = [0, 1, 0]

// Animation
let animation = CAAnimationGroup()

animation.animations = [scaleAnimation, opacityAnimation]
animation.timingFunction = CAMediaTimingFunction(name: .linear)
animation.duration = duration
animation.repeatCount = HUGE
animation.isRemovedOnCompletion = false

// Draw balls
for i in 0 ..< 3 {
let circle = SpinnerShape.circle.layerWith(size: CGSize(width: sizeValue, height: sizeValue), color: color)
let frame = CGRect(x: center.x, y: center.y, width: sizeValue, height: sizeValue)
animation.beginTime = beginTime + beginTimes[i]
circle.frame = frame
circle.opacity = 0
circle.add(animation, forKey: "animation")
layer.addSublayer(circle)
}
}
}