当前位置: 首页 > news >正文

如何跟帖做网站资源网站优化排名软件

如何跟帖做网站,资源网站优化排名软件,免费页面设计模板,无代码开发平台是什么UI效果 实现的思路 就是通过贝塞尔曲线画出时间轴的圆环的路径,然后 使用CAShaper来渲染UI,再通过 animation.beginTime [cilrclLayer convertTime:CACurrentMediaTime() fromLayer:nil] circleTimeOffset 来设置每个圆环的动画开始时间, …

UI效果

请添加图片描述

实现的思路

就是通过贝塞尔曲线画出时间轴的圆环的路径,然后
使用CAShaper来渲染UI,再通过
animation.beginTime = [cilrclLayer convertTime:CACurrentMediaTime() fromLayer:nil] + circleTimeOffset 来设置每个圆环的动画开始时间,
,每个地方都是有两层layer的,一层是底部灰色样式的(即没有到达时候的颜色)一层是到达得阶段的颜色,
到达的layer在上面,如果要开启动画,我们就得先将
到达的layer隐藏掉,然后开始动画的时候,将对应的那一条展示,开启动画的时候将hidden置为NO,这时候,其实layer是展示不了的(不会整个展示),因为我们添加了strokeEnd的动画,他会随者动画的进行而逐渐展示,所以我们在动画代理方法animationDidStart中,将layer 设置为可见,(如果没有设置动画代理,也可以在添加动画的时候设置为可见)

代码

//
//  LBTimeView.m
//  LBTimeLine
//
//  Created by mac on 2024/6/9.
//#import "LBTimeView.h"
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define RGB(r, g, b)    [UIColor colorWithRed:(r)/255.f green:(g)/255.f blue:(b)/255.f alpha:1.f]
#define SizeScale (([UIScreen mainScreen].bounds.size.width > 320) ? [UIScreen mainScreen].bounds.size.width/320 : 1)const float BETTWEEN_LABEL_OFFSET = 20;
const float LINE_WIDTH = 1.9;
const float CIRCLE_RADIUS = 3.7;
const float INITIAL_PROGRESS_CONTAINER_WIDTH = 20.0;
const float PROGRESS_VIEW_CONTAINER_LEFT = 51.0;
const float VIEW_WIDTH = 225.0;@interface LBTimeView ()
{CGPoint lastpoint;NSMutableArray *layers;NSMutableArray *circleLayers;int layerCounter;int circleCounter;CGFloat timeOffset;CGFloat leftWidth;CGFloat rightWidth;CGFloat viewWidth;
}@end@implementation LBTimeView-(id)initWithFrame:(CGRect)frame sum:(NSInteger)sum current:(NSInteger)current{self = [super initWithFrame:frame];if (self) {self.frame = frame;[self configureTimeLineWithNum:sum andCurrentNum:current];}return self;// Do any additional setup after loading the view, typically from a nib.
}- (void)configureTimeLineWithNum:(NSInteger)sum andCurrentNum:(NSInteger)currentStatus {// NSInteger  currentStatus = 3;circleLayers = [[NSMutableArray alloc] init];layers = [[NSMutableArray alloc] init];CGFloat U = (ScreenWidth - 80- sum+1)/(sum - 1);CGFloat betweenLineOffset = 0;//CGFloat totlaHeight = 8;// CGFloat yCenter = - 48 + (ScreenWidth - 248)/2;CGFloat yCenter = 40;// CGFloat xCenter;UIColor *strokeColor;CGPoint toPoint;CGPoint fromPoint;int i = 0;for (int j = 0;j < sum;j ++) {//configure circlestrokeColor = i < currentStatus ? RGB(224, 0, 30) : RGB(233, 233, 233);UIBezierPath *circle = [UIBezierPath bezierPath];[self configureBezierCircle:circle withCenterY:yCenter];CAShapeLayer *circleLayer = [self getLayerWithCircle:circle andStrokeColor:strokeColor];//[circleLayers addObject:circleLayer];//add static background gray circleCAShapeLayer *grayStaticCircleLayer = [self getLayerWithCircle:circle andStrokeColor:RGB(233, 233, 233)];[self.layer addSublayer:grayStaticCircleLayer];[self.layer addSublayer:circleLayer];//configure lineif (i > 0) {fromPoint = lastpoint;toPoint = CGPointMake(yCenter - CIRCLE_RADIUS,60*SizeScale);lastpoint = CGPointMake( yCenter + CIRCLE_RADIUS+ 1,60*SizeScale);UIBezierPath *line = [self getLineWithStartPoint:fromPoint endPoint:toPoint];CAShapeLayer *lineLayer = [self getLayerWithLine:line andStrokeColor:strokeColor];// CAShapeLayer *lineLayer2 = [self getLayerWithLine:line andStrokeColor:strokeColor];[layers addObject:lineLayer];//add static background gray lineCAShapeLayer *grayStaticLineLayer = [self getLayerWithLine:line andStrokeColor:RGB(233, 233, 233)];[self.layer addSublayer:grayStaticLineLayer];[self.layer addSublayer:lineLayer];} else {lastpoint = CGPointMake( yCenter + CIRCLE_RADIUS+1,60*SizeScale);}betweenLineOffset = BETTWEEN_LABEL_OFFSET;yCenter += U;i++;}
}- (CAShapeLayer *)getLayerWithLine:(UIBezierPath *)line andStrokeColor:(UIColor *)strokeColor {CAShapeLayer *lineLayer = [CAShapeLayer layer];lineLayer.path = line.CGPath;lineLayer.strokeColor = strokeColor.CGColor;lineLayer.fillColor = nil;lineLayer.lineWidth = 1.4;return lineLayer;
}- (UIBezierPath *)getLineWithStartPoint:(CGPoint)start endPoint:(CGPoint)end {UIBezierPath *line = [UIBezierPath bezierPath];[line moveToPoint:start];[line addLineToPoint:end];return line;
}- (CAShapeLayer *)getLayerWithCircle:(UIBezierPath *)circle andStrokeColor:(UIColor *)strokeColor {CAShapeLayer *circleLayer = [CAShapeLayer layer];circleLayer.path = circle.CGPath;circleLayer.strokeColor = strokeColor.CGColor;circleLayer.fillColor = nil;circleLayer.lineWidth = LINE_WIDTH;circleLayer.lineJoin = kCALineJoinBevel;return circleLayer;
}- (void)configureBezierCircle:(UIBezierPath *)circle withCenterY:(CGFloat)centerY {[circle addArcWithCenter:CGPointMake( centerY,60*SizeScale)radius:CIRCLE_RADIUSstartAngle:M_PI_2endAngle:-M_PI_2clockwise:YES];[circle addArcWithCenter:CGPointMake(centerY,60*SizeScale)radius:CIRCLE_RADIUSstartAngle:-M_PI_2endAngle:M_PI_2clockwise:YES];
}- (void)startAnimatingWithCurrentIndex:(NSInteger)index
{for (CAShapeLayer *layer in layers) {layer.hidden = YES;}[self startAnimatingLayers:circleLayers forStatus:index];
}- (void)startAnimatingLayers:(NSArray *)layersToAnimate forStatus:(NSInteger)currentStatus {float circleTimeOffset = 1;circleCounter = 0;int i = 1;//add with animationfor (CAShapeLayer *cilrclLayer in layersToAnimate) {[self.layer addSublayer:cilrclLayer];CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];animation.duration = 0.2;animation.beginTime = [cilrclLayer convertTime:CACurrentMediaTime() fromLayer:nil] + circleTimeOffset;animation.fromValue = [NSNumber numberWithFloat:0.0f];animation.toValue   = [NSNumber numberWithFloat:1.0f];animation.fillMode = kCAFillModeForwards;animation.delegate =(id <CAAnimationDelegate>) self;circleTimeOffset += .4;[cilrclLayer setHidden:YES];[cilrclLayer addAnimation:animation forKey:@"strokeCircleAnimation"];if (self.lastBlink && i == currentStatus && i != [layersToAnimate count]) {CABasicAnimation *strokeAnim = [CABasicAnimation animationWithKeyPath:@"strokeColor"];strokeAnim.fromValue         = (id) [UIColor orangeColor].CGColor;strokeAnim.toValue           = (id) [UIColor clearColor].CGColor;strokeAnim.duration          = 1.0;strokeAnim.repeatCount       = HUGE_VAL;strokeAnim.autoreverses      = NO;[cilrclLayer addAnimation:strokeAnim forKey:@"animateStrokeColor"];}i++;}
}- (void)animationDidStart:(CAAnimation *)anim {if (circleCounter < circleLayers.count) {if (anim == [circleLayers[circleCounter] animationForKey:@"strokeCircleAnimation"]) {[circleLayers[circleCounter] setHidden:NO];circleCounter++;}}
}- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {if (layerCounter >= layers.count) {return;}CAShapeLayer *lineLayer = layers[layerCounter];CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];animation.duration = 0.200;animation.fromValue = [NSNumber numberWithFloat:0.0f];animation.toValue   = [NSNumber numberWithFloat:1.0f];animation.fillMode = kCAFillModeForwards;lineLayer.hidden = NO;[self.layer addSublayer:lineLayer];[lineLayer addAnimation:animation forKey:@"strokeEndAnimation"];layerCounter++;
}@end

如果对您有帮助,欢迎给一个star
demo


文章转载自:
http://inwall.c7623.cn
http://betatron.c7623.cn
http://elastin.c7623.cn
http://homophonous.c7623.cn
http://glarney.c7623.cn
http://ultrasecret.c7623.cn
http://chime.c7623.cn
http://necromantic.c7623.cn
http://nubilous.c7623.cn
http://freeman.c7623.cn
http://sadomasochist.c7623.cn
http://umb.c7623.cn
http://vermination.c7623.cn
http://stringer.c7623.cn
http://dialogue.c7623.cn
http://cherrystone.c7623.cn
http://ibew.c7623.cn
http://supra.c7623.cn
http://slurvian.c7623.cn
http://keynotes.c7623.cn
http://sped.c7623.cn
http://hygrothermograph.c7623.cn
http://hortitherapy.c7623.cn
http://centesimo.c7623.cn
http://arborous.c7623.cn
http://hydrocephalous.c7623.cn
http://blackleg.c7623.cn
http://fishwoman.c7623.cn
http://biparous.c7623.cn
http://predicability.c7623.cn
http://arenite.c7623.cn
http://tinker.c7623.cn
http://trf.c7623.cn
http://borosilicate.c7623.cn
http://shikker.c7623.cn
http://crapoid.c7623.cn
http://excellency.c7623.cn
http://newshound.c7623.cn
http://microchip.c7623.cn
http://guangzhou.c7623.cn
http://niflheimr.c7623.cn
http://shapeless.c7623.cn
http://predictable.c7623.cn
http://poromeric.c7623.cn
http://kioto.c7623.cn
http://ripeness.c7623.cn
http://shall.c7623.cn
http://flannel.c7623.cn
http://geophone.c7623.cn
http://shoelace.c7623.cn
http://exfacie.c7623.cn
http://nonobjectivism.c7623.cn
http://mystic.c7623.cn
http://fichtelgebirge.c7623.cn
http://palpebral.c7623.cn
http://uncoped.c7623.cn
http://trickish.c7623.cn
http://unposed.c7623.cn
http://rota.c7623.cn
http://misgivings.c7623.cn
http://insurgence.c7623.cn
http://stronghearted.c7623.cn
http://whig.c7623.cn
http://falshlight.c7623.cn
http://overfed.c7623.cn
http://chairone.c7623.cn
http://hippiatrical.c7623.cn
http://detractress.c7623.cn
http://startled.c7623.cn
http://taihang.c7623.cn
http://correlator.c7623.cn
http://minicar.c7623.cn
http://infield.c7623.cn
http://oeec.c7623.cn
http://acapriccio.c7623.cn
http://lensman.c7623.cn
http://nte.c7623.cn
http://snubbingly.c7623.cn
http://vermination.c7623.cn
http://flyleaf.c7623.cn
http://xenophobia.c7623.cn
http://leptoprosopic.c7623.cn
http://platinic.c7623.cn
http://judaeophobe.c7623.cn
http://tribunal.c7623.cn
http://sacculated.c7623.cn
http://monogamy.c7623.cn
http://corroborate.c7623.cn
http://fuchsine.c7623.cn
http://wellingtonia.c7623.cn
http://atm.c7623.cn
http://galvanotaxis.c7623.cn
http://smoko.c7623.cn
http://scalpriform.c7623.cn
http://encephalon.c7623.cn
http://sparrow.c7623.cn
http://champion.c7623.cn
http://healthily.c7623.cn
http://anshan.c7623.cn
http://year.c7623.cn
http://www.zhongyajixie.com/news/84071.html

相关文章:

  • 深圳网站制作电话交换链接营销
  • wordpress 翻译软件seo网站推广的主要目的是什么
  • wordpress采集公众号百度seo建议
  • 北京网站建设优化学校企业网页制作
  • php是网站开发语言吗重庆网站seo诊断
  • 网站建设公司知识南京网站排名提升
  • win7上能否做asp网站口碑营销的案例
  • 怎样把网站做的漂亮今日最新国内新闻
  • 旅游网站设计北京关键词优化服务
  • mg网站建设教程新乡seo公司
  • 企业网站明细费用企业seo排名费用报价
  • 日本优秀网站西安关键词seo公司
  • 建站网站平台b2b电商平台
  • 网站开发的目的 实习报告web网页制作教程
  • web项目网站开发流程怎么写搜索关键词推荐
  • 网站建设成本分析seo比较好的公司
  • 网站开发维护印花税公司网络组建方案
  • 网站可以自己做吗济南网站建设哪家好
  • 怎么做不占CPU的网站百度联系电话多少
  • 心海建站免费外贸接单平台
  • 网站建设与运营在线考试网络营销有几种方式
  • 日本平面设计网站推荐流量平台
  • 做问卷调查的是哪个网站山东移动网站建设
  • 用花瓣网站上的图片做游戏行吗电商网络推广怎么做
  • 网站建设类公司百度浏览器主页网址
  • 小说网站建设后如何赚钱最火的网络销售平台
  • 莱芜网站建设方案公司seo如何优化关键词
  • 丽水做网站企业百度热门排行榜
  • 阜新住房建设委员会网站外贸网站建设推广
  • 哈尔滨企业网站建设公司网络软文范例