Skip to content

Commit

Permalink
remove individual reset calls from each example
Browse files Browse the repository at this point in the history
  • Loading branch information
u10int committed Feb 9, 2019
1 parent ba1e018 commit d82e256
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 64 deletions.
8 changes: 0 additions & 8 deletions Example/Kinetic/BasicFromToTweenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,7 @@ class BasicFromToTweenViewController: ExampleViewController {
square.backgroundColor = UIColor.red
view.addSubview(square)

// let tween = Kinetic.animate(square).from(.Position(50,50)).to(.Position(200,200), .Scale(2)).duration(0.5).ease(Easing.inOutCubic).delay(0.5)
let tween = Kinetic.animate(square).from(Position(50,50)).to(Position(200,200)).duration(0.5).ease(Cubic.easeInOut)
animation = tween
}

override func reset() {
super.reset()
// square.layer.transform = CATransform3DIdentity
// square.frame = CGRect(x: 0, y: 200, width: 50, height: 50)
animation?.seek(0)
}
}
6 changes: 0 additions & 6 deletions Example/Kinetic/BasicFromTweenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,4 @@ class BasicFromTweenViewController: ExampleViewController {
let tween = Kinetic.animate(square).from(X(50), Size(height: 10)).duration(0.5).ease(Quartic.easeInOut)
animation = tween
}

override func reset() {
super.reset()
// square.frame = CGRect(x: 200, y: 200, width: 100, height: 100)
animation?.seek(0)
}
}
5 changes: 0 additions & 5 deletions Example/Kinetic/BasicTweenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,4 @@ class BasicTweenViewController: ExampleViewController {
let tween = square.tween().to(X(250), Size(height: 100)).duration(0.5).ease(Cubic.easeInOut)
animation = tween
}

override func reset() {
super.reset()
square.frame = CGRect(x: 50, y: 50, width: 50, height: 50)
}
}
16 changes: 1 addition & 15 deletions Example/Kinetic/CountingLabelViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,11 @@ class CountingLabelViewController: ExampleViewController {
.ease(Exponential.easeOut)

tween.on(.updated) { (animation) -> Void in
// self.textLabel.text = "\(String(format:"%.1f", self.testObject.value))"
}.on(.completed) { (animation) -> Void in
self.textLabel.text = "\(String(format:"%.1f", self.testObject.value))"
}

tween.on(.updated) { (animation) in
self.textLabel.text = "\(String(format:"%.1f", self.testObject.value))"
}.on(.completed) { (animation) in
}.on(.completed) { (animation) -> Void in
print("DONE")
}

animation = tween
}

override func reset() {
super.reset()

testObject.value = 50
textLabel.text = "\(testObject.value)"
}

}
2 changes: 1 addition & 1 deletion Example/Kinetic/GroupTweenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GroupTweenViewController: ExampleViewController {

let moveX: Tween = Tween(target: square).to(X(200)).duration(0.5).ease(Cubic.easeInOut)
let moveY: Tween = Tween(target: square).to(Y(290)).duration(0.75).ease(Sine.easeOut)
let color: Tween = Tween(target: square).to(BackgroundColor(UIColor.yellow)).duration(0.5).ease(Sine.easeOut)
let color: Tween = Tween(target: square).to(BackgroundColor(.yellow)).duration(0.5).ease(Sine.easeOut)

let timeline = Timeline(tweens: [moveX, moveY, color], align: .start)
timeline.yoyo().forever()
Expand Down
5 changes: 0 additions & 5 deletions Example/Kinetic/PathTweenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ class PathTweenViewController: ExampleViewController {
setPathType(type: .quadratic)
}

override func reset() {
super.reset()
square.center = start.center
}

func pathTypeChanged(control: UIControl) {
if let control = control as? UISegmentedControl {
let type: PathType = control.selectedSegmentIndex == 1 ? .cubic : .quadratic
Expand Down
3 changes: 1 addition & 2 deletions Example/Kinetic/PhysicsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ class PhysicsViewController: ExampleViewController {
}

override func reset() {
animation?.stop()
super.reset()
Kinetic.killTweensOf(square)
square.frame = CGRect(x: 50, y: 50, width: 50, height: 50)
}

func tensionChanged(_ sender: UISlider) {
Expand Down
1 change: 0 additions & 1 deletion Example/Kinetic/PreloaderViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class PreloaderViewController: ExampleViewController {

if idx < dotCount {
// timeline.add(Kinetic.from(dot, duration: 0.5, options: [ .Alpha(0), .Scale(0.01) ]).ease(Easing.outQuart), position: Float(idx) * 0.1)

let t = Tween(target: dot).to(Rotation(deg2rad(rotation - 360))).duration(2).ease(Quartic.easeInOut)
timeline.add(t, position: Float(idx) * 0.15)
timeline.addCallback(Float(idx) * 0.15 + 1.5, block: { [unowned self] in
Expand Down
6 changes: 0 additions & 6 deletions Example/Kinetic/SequenceViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ class SequenceViewController: ExampleViewController {

animation = timeline
}

override func reset() {
super.reset()
square.frame = CGRect(x: 50, y: 50, width: 50, height: 50)
square.backgroundColor = UIColor.red
}

func slower() {
// animation?.slower()
Expand Down
8 changes: 0 additions & 8 deletions Example/Kinetic/StaggerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,4 @@ class StaggerViewController: ExampleViewController {
}
animation = timeline
}

override func reset() {
super.reset()

for square in squares {
square.frame.size.width = 50
}
}
}
7 changes: 0 additions & 7 deletions Example/Kinetic/TimelineViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ class TimelineViewController: ExampleViewController {
}
}

override func reset() {
super.reset()

animation?.stop()
updateProgress(0)
}

func timelineProgressChanged(_ sender: UISlider) {
timelineProgressValue.text = "\(Int(round(sender.value * 100)))%"

Expand Down

0 comments on commit d82e256

Please sign in to comment.