美文网首页
关键帧动画CAKeyframeAnimation

关键帧动画CAKeyframeAnimation

作者: 歌手的剑 | 来源:发表于2017-03-15 11:36 被阅读15次

    let anima: CAKeyframeAnimation = CAKeyframeAnimation(keyPath: "transform.translation.x")

    let currentTx = self.centerHexaView.transform.tx

    anima.duration = 1.2

    anima.values = [currentTx, currentTx - 4.5, currentTx, currentTx + 4.5, currentTx]

    anima.keyTimes = [0, 0.3, 0.6, 0.9, 1.2]

    anima.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)

    self.centerHexaView.layer.add(anima, forKey: "kAFViewShakerAnimationKey")


    相关文章

      网友评论

          本文标题:关键帧动画CAKeyframeAnimation

          本文链接:https://www.haomeiwen.com/subject/qmrlnttx.html