Chaining Core Animation animations

前端 未结 6 1572
一整个雨季
一整个雨季 2020-12-02 10:22

Which is the most elegant and modular way to chain animation in a Core Animation context?

I mean to do animations that starts just when other finis

6条回答
  •  -上瘾入骨i
    2020-12-02 10:50

    I pull this off using the setCompletionBlock method to define a closure that triggers the next animation when the first one is finished:

    [CATransaction begin]
    layer1.property = new_property;
    CATransaction.setCompletionBlock {
        [CATransaction begin]
        layer2.property2 = new_property2;
        [CATransaction commit];
    }
    [CATransaction commit];
    

提交回复
热议问题