CGAffineTransform scale and translation - jump before animation

后端 未结 5 1126
孤独总比滥情好
孤独总比滥情好 2021-02-01 03:43

I am struggling with an issue regarding CGAffineTransform scale and translation where when I set a transform in an animation block on a view that already has a transform the vie

5条回答
  •  甜味超标
    2021-02-01 04:23

    The source of the issue is the lack of perspective information to the transform.

    You can add perspective information modifying the m34 property of your 3d transform

    var transform = CATransform3DIdentity
    transform.m34 = 1.0 / 200 //your own perspective value here
    transform = CATransform3DScale(transform, 1.1, 1.1, 1.0)
    transform = CATransform3DTranslate(transform, 10, 10, 0)
    view.layer.transform = transform
    

提交回复
热议问题