ios22--动画
控制器:
//
// ViewController.m
// 07-渐变动画
//
// Created by xiaomage on 15/12/30.
// Copyright © 2015年 小码哥. All rights reserved.
// #import "ViewController.h" @interface ViewController ()
@property (weak, nonatomic) IBOutlet UIView *animationView; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
} /**
* 平移
*/
- (IBAction)translate {
// 渐变动画
// 方式一
/*
// 1. 开始动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0]; // 2.动画代码
CGRect frame = self.animationView.frame;
frame.origin.y -= 50;
self.animationView.frame = frame; // 3.提交动画
[UIView commitAnimations];
*/ // 方式二:
/*
[UIView animateWithDuration:2.0 animations:^{
// 1.动画代码
CGRect frame = self.animationView.frame;
frame.origin.y -= 50;
self.animationView.frame = frame;
}];
*/ /*
[UIView animateWithDuration:1.0 animations:^{
// 执行动画
CGRect frame = self.animationView.frame;
frame.origin.y -= 50;
self.animationView.frame = frame;
} completion:^(BOOL finished) {
// 动画完成做什么事情
self.animationView.backgroundColor = [UIColor blackColor];
}];
*/
/*
UIViewAnimationOptionCurveEaseInOut 动画开始/结束比较缓慢,中间相对较快
UIViewAnimationOptionCurveEaseIn 动画开始比较缓慢
UIViewAnimationOptionCurveEaseOut 动画结束比较缓慢
UIViewAnimationOptionCurveLinear 线性---> 匀速
*/
[UIView animateWithDuration:1.0 delay:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ CGRect frame = self.animationView.frame;
frame.origin.y += ;
self.animationView.frame = frame; } completion:^(BOOL finished) {
self.animationView.backgroundColor = [UIColor greenColor];
}];
} /**
* 缩放
*/
- (IBAction)scale { [UIView animateWithDuration:1.0 delay:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ CGRect frame = self.animationView.frame;
frame.size = CGSizeMake(, );
self.animationView.frame = frame; } completion:^(BOOL finished) {
NSLog(@"动画完成");
}];
} /**
* 透明度动画
*/
- (IBAction)alpha {
[UIView animateWithDuration:1.0 delay:0.5 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.animationView.alpha -= 0.9;
} completion:^(BOOL finished) {
[UIView animateWithDuration:2.0 animations:^{
self.animationView.alpha += 0.9;
}];
}];
}
@end
ios22--动画的更多相关文章
- 动画requestAnimationFrame
前言 在研究canvas的2D pixi.js库的时候,其动画的刷新都用requestAnimationFrame替代了setTimeout 或 setInterval 但是jQuery中还是采用了s ...
- 梅须逊雪三分白,雪却输梅一段香——CSS动画与JavaScript动画
CSS动画并不是绝对比JavaScript动画性能更优越,开源动画库Velocity.js等就展现了强劲的性能. 一.两者的主要区别 先开门见山的说说两者之间的区别. 1)CSS动画: 基于CSS的动 ...
- CSS 3学习——animation动画
以下内容根据官方文档翻译以及自己的理解整理. 1. 介绍 本方案介绍动画(animations).通过动画,开发者可以将CSS属性值的变化指定为一个随时间变化的关键帧(keyframes)的集合.在 ...
- javascript动画系列第三篇——碰撞检测
前面的话 前面分别介绍了拖拽模拟和磁性吸附,当可视区域内存在多个可拖拽元素,就出现碰撞检测的问题,这也是javascript动画的一个经典问题.本篇将详细介绍碰撞检测 原理介绍 碰撞检测的方法有很多, ...
- 虾扯蛋:Android View动画 Animation不完全解析
本文结合一些周知的概念和源码片段,对View动画的工作原理进行挖掘和分析.以下不是对源码一丝不苟的分析过程,只是以搞清楚Animation的执行过程.如何被周期性调用为目标粗略分析下相关方法的执行细节 ...
- Visaul Studio 常用快捷键的动画演示
从本篇文章开始,我将会陆续介绍提高 VS 开发效率的文章,欢迎大家补充~ 在进行代码开发的时候,我们往往会频繁的使用键盘.鼠标进行协作,但是切换使用两种工具会影响到我们的开发速度,如果所有的操作都可以 ...
- transtion:过渡动画
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px Monaco; color: #4f5d66 } p.p2 { margin: 0.0px 0 ...
- 再谈CAAnimation动画
CAAnimaton动画分为CABasicAnimation & CAKeyframeAnimation CABasicAnimation动画, 顾名思义就是最基本的动画, 老规矩先上代码: ...
- jQuery动画-圣诞节礼物
▓▓▓▓▓▓ 大致介绍 下午看到了一个送圣诞礼物的小动画,正好要快到圣诞节了,就动手模仿并改进了一些小问题 原地址:花式轮播----圣诞礼物传送 思路:动画中一共有五个礼物,他们平均分布在屏幕中,设置 ...
- jQuery学习之路(4)- 动画
▓▓▓▓▓▓ 大致介绍 通过jQuery中基本的动画方法,能够轻松地为网页添加非常精彩的视觉效果,给用户一种全新的体验 ▓▓▓▓▓▓ jQuery中的动画 ▓▓▓▓▓▓ show()和hide()方法 ...
随机推荐
- 牛客网提高组第二场---solution
T1 方差 根据题目要求将式子先写出来注意下面式子中的 $n$ 全部都是 $n-1$$$\begin{aligned}ans&=n^2\times \frac{1}{n}\times \sum ...
- 零基础入门学习Python(15)--格式化
前言 上节课我们介绍了字符串N多种奇葩方法的用法,但是我们唯独漏掉了format方法,那为何不把format方法和上节课的内容一起讲呢? 因为小甲鱼觉得format方法,跟今天的主题是如出一辙的,都是 ...
- Centos6.5下 执行“ll”提示“-bash: ll: command not found”
ll 是 ls -l的别名,之所所以 ll出现错误是因为没有定义别名. 如果要实现ll 命令,可以做如下操作: 编辑 ~./bashrc 添加 ls -l 的别名为 ll即可 [root@Centos ...
- 用PHP写一个最简单的解释器Part4(写一个最简单的脚本语言)
好吧!我承认我想标题党了.大家对解释器的吸引,绝对没有自己动手写一个脚本语言更有吸引力.不过如果看到标题过来的,可能也是 我承认,之前收藏的减肥视频,我都是这样对待他们的. 不过我还是相信很多程序猿o ...
- Python之爬虫-京东商品
Python之爬虫-京东商品 #!/usr/bin/env python # coding: utf-8 from selenium import webdriver from selenium.we ...
- Courses on Turbulence
Courses on Turbulence Table of Contents 1. Lecture 1.1. UIUC Renewable energy and turbulent environm ...
- C语言学习3
实现输入错误后重新输入 通过输入指定的行数和列数打印出二维数组对应的任一行任一列的值: #include <stdio.h> void main() { ][] = {{, , , },{ ...
- JS数组添加元素的三种方式
1.push() 结尾添加 数组.push(元素) 参数 描述 newelement1 必需.要添加到数组的第一个元素. newelement2 可选.要添加到数组的第二个元素. newelement ...
- js用for...in 这种遍历的方式
var arr = new Array("first", "second", "third") for(var item in arr) { ...
- BNUOJ 5997 Fibonacci again and again
Fibonacci again and again Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HD ...