2016-03-03 41 views
0

我想在coreplot中執行多個動畫。然而Coreplot動畫與標識

-(void)animationDidFinish:(nonnull CPTAnimationOperation *)operation { 
    CPTPlotRange *newxRange = [CPTPlotRange 
           plotRangeWithLocation:@500 
           length:@100]; 

    [self performSecondAnimationWithnewXRange:newXrange];} 

我想,運行使用標識多個動畫: 要運行的第一個動畫我用:

[CPTAnimation animate:plotSpace 
       property:@"xRange" 
      fromPlotRange:oldXrange 
       toPlotRange:newxRange 
       duration:1.0 
       withDelay:0 
      animationCurve:CPTAnimationCurveCubicInOut 
       delegate:self]; 

和實施CPTAnimationDelegate。我試過creatingPTAnimationOperation,但不知道如何啓動它:

CPTAnimationOperation* animation1 = [[CPTAnimationOperation alloc] init]; 
CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPlotRange:plotSpace.xRange 
                     endPlotRange:newxRange 
                      duration:3.0 
                      withDelay:0.0]; 
animation1.identifier = @"animation1ID"; 
animation1.period = period; 

如何真正開始動畫,所以委託我可以檢查它的ID?

回答

1

您可以按照第一個動畫的方式啓動第二個動畫。通過nil作爲起始值,使動畫從屬性的當前值開始。 +animate:property:…的方法都返回CPTAnimationOperation,所以你可以設置identifier或有一個參考,如果你想早點取消它。

+0

一如既往,埃裏克的答案是最好的:D工作就像一個魅力。 – izik461