swift -pop的简单动画
//2.写入 pod ‘pop’,’~>1.0’ 保存
//3.打开终端,进入项目路径 执行pod install
//4.新建桥接头文件 导入#import <POP/POP.h>
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let redBall = UIView(frame: CGRect(x: 100, y: 100, width: 100, height: 100))
redBall.backgroundColor = UIColor.redColor()
redBall.layer.cornerRadius = 50
self.view.addSubview(redBall)
//实例化一个pop
let scale = POPSpringAnimation(propertyNamed: kPOPViewScaleXY)
//设置结束时的值
scale.toValue = NSValue(CGPoint: CGPointMake(2, 2))
//弹性,振幅之类的属性,范围0-20
scale.springBounciness = 20
//震动速度,值越大动画结束越快,范围0-20
scale.springSpeed = 1
//pop对象关键字
redBall.pop_addAnimation(scale, forKey: "scale")
//x坐标位移动画
let move = POPSpringAnimation(propertyNamed: kPOPLayerPositionY)
move.toValue = 500
move.springBounciness = 20
move.springSpeed = 5
redBall.layer.pop_addAnimation(move, forKey: "ilove")
//旋转动画
let spin = POPSpringAnimation(propertyNamed: kPOPLayerRotation)
spin.toValue = M_PI * 4
spin.springBounciness = 20
spin.springSpeed = 5
redBall.layer.pop_addAnimation(spin, forKey: "spin")
// //背景颜色的变化
let color = POPSpringAnimation(propertyNamed: kPOPLayerBackgroundColor)
color.toValue = UIColor.greenColor()
color.springBounciness = 20
color.springSpeed = 5
redBall.pop_addAnimation(color, forKey: "color")
swift -pop的简单动画的更多相关文章
- 原生JS封装简单动画效果
原生JS封装简单动画效果 一致使用各种插件,有时候对原生JS陌生了起来,所以决定封装一个简单动画效果,熟悉JS原生代码 function animate(obj, target,num){ if(ob ...
- jquery添加光棒效果的各种方式以及简单动画复杂动画
过滤器.绑定事件.动画 一.基本过滤器 语法 描述 返回值 :first 选取第一个元素 单个元素 :last 选取最后一个元素 单个元素 :not(selector) 选取去除所有与给定选择器匹 ...
- UIView简单动画
UIView动态实现的效果有以下几种: 1.动态改变frame 2.动态改变color 3.动态改变alpha 4.动态改变bounds 首先,我们先看几种BasicView动画 #pragma ma ...
- IOS 简单动画 首尾式动画
首尾式动画 首尾式动画即通过实现控件由初始状态到结束状态的过程.(主要表现在控件的Frame 透明度 ) // // ViewController.m // CX 简单动画 // // Created ...
- Swift 实现iOS Animation动画教程
这是一篇翻译文章.原文出处:http://www.raywenderlich.com/95910/uiview-animation-swift-tutorial 动画( animation)是iOS用 ...
- 李洪强iOS开发Swift篇—01_简单介绍
李洪强iOS开发Swift篇—01_简单介绍 一.简介 Swift是苹果于2014年WWDC(苹果开发者大会)发布的全新编程语言 Swift在天朝译为“雨燕”,是它的LOGO 是一只燕子,跟Objec ...
- jQuery中自定义简单动画的实现
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...
- canvas制作简单动画
在画布元素<canvas>中,除了绘制图形.图像.文字外,还可以制作一些简单的动画,制作过程十分简单,主要分为两步操作: 1.自定义一个函数,用于图形的移动或其他动作. 2.使用setIn ...
- iOS_SN_push/pop转场动画封装和一般动画封装
封装类中的方法: #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface AnimationE ...
随机推荐
- logstash使用分享
1.logstash时间处理函数 当业务场景需要自有的time字段覆盖@timestamp字段的情况下 需要使用 date { match => ["time", " ...
- android adb端口被占用解决方法
1.输入adb devices命令 C:\Users\Nick>adb devices List of devices attached adb server version (31) does ...
- Android之NFC
来源:http://blog.csdn.net/bear_huangzhen/article/details/46333421 NFC简介: Near Field Communication 近场通信 ...
- Hive-表连接
Hive只支持等值连接,即ON子句中使用等号连接,不支持非等值连接. Hive内置的数据存储类型,TextFile, SequenceFile, ORC(列式存储) 如果连接语句中有WHERE子句,会 ...
- 短信发送接口demo
public class SendValidCode { // 短信发送的接口网关 private static String sendUrl = "******************** ...
- IO在block级别的过程分析
btt User Guide在百度找了3天没找到,bing也不行,结果google第一页第5个结果就是. 可恶的GFW http://www.fis.unipr.it/doc/blktrace-1.0 ...
- 安装face_recognition
Ubuntu安装face_recognition需要先安装dlib 1.安装dlib的依赖 sudo apt-get install build-essential cmake sudo apt-ge ...
- uva-11044-水题
#include <iostream> #include<memory.h> #include<stdio.h> using namespace std; int ...
- IIS 禁止访问:在 Web 服务器上已拒绝目录列表
webconfig <configuration> <system.webServer> <directoryBrowse enabled="true" ...
- VMware CentOS Device eth0 does not seem to be present
在VMware里克隆出来的CentOS Linux.. ifconfig...没有看到eth0..然后重启网卡又报下面错误. 故障现象: service network restartShutting ...