storyboardで画面下部に配置した画像に、以下のようなアニメーションを設定しようと思っています。
swift
1let animation = CABasicAnimation() 2 animation.valueFunction = CAValueFunction(name: kCAValueFunctionRotateZ) 3 animation.fromValue = -0.2 4 animation.toValue = 0.2 5 animation.duration = 0.4 6 animation.autoreverses = true 7 animation.repeatCount = 1 8 9 let layer = image.layer 10 layer.anchorPoint = CGPoint(x: 0.5, y: 1.0) 11 layer.addAnimation(animation, forKey: "transform")
しかしコンパイルすると、画像の位置が上にずれてしまいます。
自分で調べてみた結果、anchorPointが設定されているからだと推測できたのですが、直し方がわかりません。
(参考:https://teratail.com/questions/8613)
もし分かる方がいらっしゃいましたらご教授頂けると幸いです。
宜しくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/01/20 05:09
2016/01/20 10:25
2016/01/25 14:06