现在的位置: 首页 > 综合 > 正文

动画库 CPAnimationSequence

2013年12月03日 ⁄ 综合 ⁄ 共 1193字 ⁄ 字号 评论关闭

https://github.com/yangmeyer/CPAnimationSequence

CPAnimationSequence

Declaratively describe animation sequences that consist of multiple steps.

Something like this:

CPAnimationSequence* shakespeare = [CPAnimationSequence sequenceWithSteps:
    [CPAnimationStep           for:0.2 animate:^{ self.romeo.alpha = 1.0;
                                                       self.julia.alpha = 1.0; }],
    [CPAnimationStep after:1.0 for:0.7 animate:^{
                            CGPoint kiss = CGPointMake((self.romeo.center.x + self.julia.center.x)/2,
                                                       (self.romeo.center.y + self.julia.center.y)/2);
                            self.romeo.center = kiss;
                            self.julia.center = kiss;
    }],
    [CPAnimationStep after:2.0 for:0.5 animate:[self dramaticDeathAnimationStep]],
    [CPAnimationStep           for:0.0 animate:^{ self.theEnd.hidden = NO; }],
    nil];
[shakespeare runAnimated:YES];

I described the rationale and possible improvements on the compeople developer blog on Mobile Apps.

CPAnimationProgram

With the addition of CPAnimationProgram, you can now also run steps (and sequences, and programs) in parallel, or overlap steps
(and sequences, and programs).

This is still somewhat experimental, so you might run into problems with particularly complex overlaps. It does seem to work well, though, so give it a try.

Composite
pattern

The component implements the Composite design pattern, which means that you can nest sequences and programs as much as device memory and your sanity allow.

抱歉!评论已关闭.