Skip to content

Commit

Permalink
Merge pull request #379 from IBAnimatable/hotfix/animations
Browse files Browse the repository at this point in the history
Fix view translate {x,y} for {slide, squeeze} animation
  • Loading branch information
tbaranes committed Dec 27, 2016
2 parents 0807a1d + 3914a1d commit 0d81c6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -12,7 +12,8 @@ None
None

#### Bugfixes
None

- Fix `slide(.out, *)` and `squeeze(.out, *)` translation coordinates [#379](https://github.com/IBAnimatable/IBAnimatable/issues/379)

### [3.1.2](https://github.com/IBAnimatable/IBAnimatable/releases/tag/3.1.2)

Expand Down
13 changes: 7 additions & 6 deletions IBAnimatable/Animatable.swift
Expand Up @@ -406,8 +406,6 @@ public extension Animatable where Self: UIView {

private extension Animatable where Self: UIView {
func computeValues(way: AnimationType.Way, direction: AnimationType.Direction, shouldScale: Bool) -> AnimationValues {
let yDistance = screenSize.height * force
let xDistance = screenSize.width * force
let scale = 3 * force
var scaleX: CGFloat = 1
var scaleY: CGFloat = 1
Expand All @@ -416,14 +414,17 @@ private extension Animatable where Self: UIView {
var y: CGFloat = 0
switch direction {
case .left:
x = -xDistance
x = -(screenSize.width - frame.maxX + frame.width)
case .right:
x = xDistance
x = frame.maxX
case .down:
y = -yDistance
y = -(screenSize.height - frame.maxY + frame.height)
case .up:
y = yDistance
y = frame.maxY
}

x *= force
y *= force
if shouldScale && direction.isVertical() {
scaleY = scale
} else if shouldScale {
Expand Down

0 comments on commit 0d81c6e

Please sign in to comment.