CABasicAnimation 如何解决保持移动后的位置状态不变

来源:互联网 发布:中信银行安全控件mac 编辑:程序博客网 时间:2024/04/30 18:42

CABasicAnimation *rotationAnimation = [CABasicAnimationanimationWithKeyPath:@"transform.rotation.z"];

    [rotationAnimation setRepeatCount:0];

    [rotationAnimation setDuration:0.6];

    [rotationAnimation setAutoreverses:NO];

    //以下两行同时设置才能保持移动后的位置状态不变

    rotationAnimation.fillMode=kCAFillModeForwards;

    rotationAnimation.removedOnCompletion =NO;

    [rotationAnimation setFromValue:[NSNumbernumberWithFloat:0.0]];

    [rotationAnimation setToValue:[NSNumbernumberWithFloat:(float) (M_PI/value)*derection]];

    [selfaddAnimation:rotationAnimation forKey:kBTSWiggleTransformAnimation];

原创粉丝点击