zoukankan      html  css  js  c++  java
  • CABasicAnimation 划线动画

    CGFloat animateDuration = 2;
        
        UIBezierPath *bezierPath = [[UIBezierPath alloc] init];
        CGPoint centerFromP = noAnimateView.center;
        [bezierPath moveToPoint:centerFromP];
        CGPoint centerEndP = endView.center;
        [bezierPath addLineToPoint:centerEndP];
        
        CAShapeLayer *layer = [CAShapeLayer layer];
        layer.lineWidth = 5;
        layer.strokeColor = [UIColor blackColor].CGColor;
        layer.fillColor = [UIColor clearColor].CGColor;
        layer.path = bezierPath.CGPath;
        layer.lineCap = kCALineCapRound;
    //    [layer setLineDashPattern:[NSArray arrayWithObjects:[NSNumber numberWithInt:15], [NSNumber numberWithInt:10],nil]];
        
        //create the keyframe animation
        CABasicAnimation *animation = [CABasicAnimation animation];
        animation.keyPath = @"strokeEnd";
        animation.fromValue = [NSNumber numberWithInteger:0];
        animation.toValue = [NSNumber numberWithInteger:1];
        animation.duration = animateDuration;
        animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        [layer addAnimation:animation forKey:nil];
  • 相关阅读:
    [转] Web前端优化之 Server篇
    [转] Web前端优化之 内容篇
    [学习笔记] Web设计过程中该做和不该做的
    web前端性能优化
    jQuery代码片段
    socket.io
    ajax阻塞UI线程
    前端面试题整理
    nodejs之async异步编程
    jquery源码笔记
  • 原文地址:https://www.cnblogs.com/tufei7/p/9958654.html
Copyright © 2011-2022 走看看