iOS 动画应用

    xiaoxiao2021-03-25  94

    _redView是需要添加动画的view

    NSString *subtypeString; subtypeString = kCATransitionFromLeft; [self transitionWithType:@"oglFlip" WithSubtype:subtypeString ForView:_redView];

    - (void) transitionWithType:(NSString *) type WithSubtype:(NSString *) subtype ForView : (UIView *) view { //创建CATransition对象 CATransition *animation = [CATransition animation]; //设置运动时间 animation.duration = 2; animation.repeatCount = 100; //设置运动type animation.type = type; if (subtype != nil) { //设置子类 animation.subtype = subtype; } //设置运动速度 animation.timingFunction = UIViewAnimationOptionCurveEaseInOut; [view.layer addAnimation:animation forKey:@"animation"]; }
    转载请注明原文地址: https://ju.6miu.com/read-14680.html

    最新回复(0)