Get current CAAnimation transform value

前端 未结 4 679
感情败类
感情败类 2021-01-11 23:11

I want to access get the value of the transform scale at a point in time. Here is the animation creation :

    CABasicAnimation *grow = [CABasicAnimation ani         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-01-11 23:46

    Swift 5: The nicest answer, in a function from Hacking With Swift

    func scale(from transform: CGAffineTransform) -> Double {
        return sqrt(Double(transform.a * transform.a + transform.c * transform.c))
    }
    

提交回复
热议问题