如何递归执行view的动画
2023-09-14 08:57:16 时间
如何递归执行view的动画
效果:
山寨的源头:
图片素材:
源码:
// // ViewController.m // RepeatAnimationView // Created by YouXianMing on 15/1/30. // Copyright (c) 2015年 YouXianMing. All rights reserved. #import "ViewController.h" @interface ViewController () @property (nonatomic, strong) UIImageView *imageView; @property (nonatomic) CGRect startRect; @property (nonatomic) CGRect centerRect; @property (nonatomic) CGRect endRect; @property (nonatomic) CGFloat distanceFromStartToCenter; @property (nonatomic) CGFloat distanceFromCenterToEnd; @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.distanceFromStartToCenter = 40.f; self.distanceFromCenterToEnd = 30.f; // 背景色 self.view.backgroundColor = [UIColor blackColor]; // 红色图片 self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red"]]; self.imageView.center = self.view.center; self.imageView.alpha = 0; [self.view addSubview:self.imageView];
// Created by YouXianMing on 15/1/30. // Copyright (c) 2015年 YouXianMing. All rights reserved. #import "ViewController.h" @interface ViewController () @property (nonatomic, strong) UIImageView *imageView; @property (nonatomic, strong) UIImageView *cyanView; @property (nonatomic) CGRect startRect; @property (nonatomic) CGRect centerRect; @property (nonatomic) CGRect endRect; @property (nonatomic) CGFloat distanceFromStartToCenter; @property (nonatomic) CGFloat distanceFromCenterToEnd; @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.distanceFromStartToCenter = 40.f; self.distanceFromCenterToEnd = 30.f; // 背景色 self.view.backgroundColor = [UIColor blackColor]; // 红色图片 self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red"]]; self.imageView.center = self.view.center; self.imageView.alpha = 0; [self.view addSubview:self.imageView]; self.cyanView = [[UIImageView alloc] initWithFrame:self.imageView.bounds]; self.cyanView.image = [UIImage imageNamed:@"cyan"]; [self.imageView addSubview:self.cyanView];
View的绘制过程从Activity.setContentView开始经过如下方法: Activity.setContentView PhoneWindow.
相关文章
- CSS动画示例(上一篇是CSS过渡…)
- Windows Store App 主题动画
- Android自定义View 画弧形,文字,并增加动画效果
- Core Animation之CABasicAnimation(基础动画)
- 属性动画之ValueAnimator
- 如何用 Keynote 制作动画演示(转)
- 【界面优化】使用viewpagerindicator添加下划线滑动动画
- uni-app:uni-transition动画分多个step执行(hbuilderx 3.7.3)
- iOS中Animation 动画 UI_22
- 动画--问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题。
- Android案例手册 - 实现下多个按钮展开收缩动画工具类
- 高性能Web动画和渲染原理系列(3)——transform和opacity为什么高性能
- 深入浅出matplotlib(43):动画显示与gif文件输出
- 深入浅出matplotlib(40):动画显示与MP4视频输出三
- Android开发 从底部弹出动画(选择菜单)