【问题标题】:Coreplot animations with identifier带有标识符的 Coreplot 动画
【发布时间】:2016-03-03 18:29:27
【问题描述】:

我正在尝试在 coreplot 中执行多个动画。 运行我用过的第一个动画:

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

并实现CPTAnimationDelegate:

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

    [self performSecondAnimationWithnewXRange:newXrange];}

但是,我想使用标识符运行多个动画。我尝试过创建 PTAnimationOperation,但不知道如何触发它:

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?

【问题讨论】:

    标签: ios animation core-plot


    【解决方案1】:

    您可以像第一个动画一样开始第二个动画。将 nil 传递给起始值以使动画从属性的当前值开始。 +animate:property:… 方法都返回CPTAnimationOperation,因此您可以设置identifier,或者如果您想提前取消它,请参考。

    【讨论】:

    • 一如既往,Eric 的答案是最好的:D 像魅力一样工作。
    猜你喜欢
    • 2019-08-25
    • 2014-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多