UIDynamicAnimator简述
2016-04-01 15:24
323 查看
1.UIDynamicAnimator
是一种物理仿真的容器,引擎 。通过添加各种行为,来控制UIView的物理运动。
// 初始化的时候 确定作用的范围
- (instancetype)initWithReferenceView:(UIView *)view
// 添加行为
- (void)addBehavior:(UIDynamicBehavior *)behavior;
// 去除行为
- (void)removeBehavior:(UIDynamicBehavior *)behavior;
- (void)removeAllBehaviors;
//重力行为
1)UIGravityBehavior
// 添加行为作用的视图
- (void)addItem:(id <UIDynamicItem>)item;
// CGVector为矢量
就是物理中的矢量图 x方向长度越大方向越偏向x y方向的长度越大越偏向y
@property (readwrite,
nonatomic) CGVector gravityDirection;
//重力作用的方向 x为0度
@property (readwrite,
nonatomic) CGFloat angle;
// 量级 用来控制加速度 1.0代表 1000points/seconds^2
@property (readwrite,
nonatomic) CGFloat magnitude;
// 附着行为
2)UIAttachmentBehavior
//给视图添加一个行为 并设定一个锚点 视图将会围绕锚点摆动
- (instancetype)initWithItem:(id <UIDynamicItem>)item
attachedToAnchor:(CGPoint)point;
// 视图的锚点 固定点
@property (readwrite,
nonatomic) CGPoint anchorPoint;
// 视图距离锚点的长度
@property (readwrite,
nonatomic) CGFloat length;
// 阻尼数值是指任何振动系统在振动中,由于外界作用或系统本身固有的原因引起的振动幅度逐渐下降的特性,以及此一特性的量化表征。
在电学中,是响应时间的意思。
@property (readwrite,
nonatomic) CGFloat damping;
// 1: critical damping
// 振动频率 振动物体在单位时间内的振动次数
@property (readwrite,
nonatomic) CGFloat frequency;
// in Hertz
//摩擦扭矩
@property (readwrite,
nonatomic) CGFloat frictionTorque
// 碰撞行为
3)UICollisionBehavior
// 给视图添加碰撞行为
- (void)addItem:(id <UIDynamicItem>)item;
//是否参照视图的bounds为边界
@property (nonatomic,
readwrite) BOOL translatesReferenceBoundsIntoBoundary;
// 设置参照视图的bounds为边界 并设置内边距
- (void)setTranslatesReferenceBoundsIntoBoundaryWithInsets:(UIEdgeInsets)insets;
// 自己设置路径为bounds为边界
- (void)addBoundaryWithIdentifier:(id <NSCopying>)identifier forPath:(UIBezierPath
*)bezierPath;
// 分为三种碰撞类型(元素 边界 全体)
@property (nonatomic,
readwrite) UICollisionBehaviorMode collisionMode;
// 推动行为
4)UIPushBehavior
//推动类型
@property (nonatomic,
readonly) UIPushBehaviorMode mode;
@property (nonatomic,
readwrite) BOOL active;
// 力的角度
@property (readwrite,
nonatomic) CGFloat angle;
// A continuous force vector with a magnitude of 1.0, applied to a 100 point x 100 point view whose density value is 1.0, results in view acceleration of 100 points per s^2
@property (readwrite,
nonatomic) CGFloat magnitude;
// 矢量的推动方向
@property (readwrite,
nonatomic) CGVector pushDirection;
// 捕捉行为
5)UISnapBehavior
// 为视图添加行为 从视图的到 制定的点移动
- (instancetype)initWithItem:(id <UIDynamicItem>)item
snapToPoint:(CGPoint)point
NS_DESIGNATED_INITIALIZER;
// 运动过程中的阻尼
@property (nonatomic,
assign) CGFloat damping;
// 公共的特性 辅助行为
6)UIDynamicItemBehavior
// 弹性系数
@property (readwrite,
nonatomic) CGFloat elasticity;
// Usually between 0 (inelastic) and 1 (collide elastically)
// 摩擦系数
@property (readwrite,
nonatomic) CGFloat friction;
// 0 being no friction between objects slide along each other
// 密度
@property (readwrite,
nonatomic) CGFloat density;
// 1 by default
// 阻力系数
@property (readwrite,
nonatomic) CGFloat resistance;
// 0: no velocity damping
// 角阻力 旋转时
@property (readwrite,
nonatomic) CGFloat angularResistance;
// 0: no angular velocity damping
是一种物理仿真的容器,引擎 。通过添加各种行为,来控制UIView的物理运动。
// 初始化的时候 确定作用的范围
- (instancetype)initWithReferenceView:(UIView *)view
// 添加行为
- (void)addBehavior:(UIDynamicBehavior *)behavior;
// 去除行为
- (void)removeBehavior:(UIDynamicBehavior *)behavior;
- (void)removeAllBehaviors;
//重力行为
1)UIGravityBehavior
// 添加行为作用的视图
- (void)addItem:(id <UIDynamicItem>)item;
// CGVector为矢量
就是物理中的矢量图 x方向长度越大方向越偏向x y方向的长度越大越偏向y
@property (readwrite,
nonatomic) CGVector gravityDirection;
//重力作用的方向 x为0度
@property (readwrite,
nonatomic) CGFloat angle;
// 量级 用来控制加速度 1.0代表 1000points/seconds^2
@property (readwrite,
nonatomic) CGFloat magnitude;
// 附着行为
2)UIAttachmentBehavior
//给视图添加一个行为 并设定一个锚点 视图将会围绕锚点摆动
- (instancetype)initWithItem:(id <UIDynamicItem>)item
attachedToAnchor:(CGPoint)point;
// 视图的锚点 固定点
@property (readwrite,
nonatomic) CGPoint anchorPoint;
// 视图距离锚点的长度
@property (readwrite,
nonatomic) CGFloat length;
// 阻尼数值是指任何振动系统在振动中,由于外界作用或系统本身固有的原因引起的振动幅度逐渐下降的特性,以及此一特性的量化表征。
在电学中,是响应时间的意思。
@property (readwrite,
nonatomic) CGFloat damping;
// 1: critical damping
// 振动频率 振动物体在单位时间内的振动次数
@property (readwrite,
nonatomic) CGFloat frequency;
// in Hertz
//摩擦扭矩
@property (readwrite,
nonatomic) CGFloat frictionTorque
// 碰撞行为
3)UICollisionBehavior
// 给视图添加碰撞行为
- (void)addItem:(id <UIDynamicItem>)item;
//是否参照视图的bounds为边界
@property (nonatomic,
readwrite) BOOL translatesReferenceBoundsIntoBoundary;
// 设置参照视图的bounds为边界 并设置内边距
- (void)setTranslatesReferenceBoundsIntoBoundaryWithInsets:(UIEdgeInsets)insets;
// 自己设置路径为bounds为边界
- (void)addBoundaryWithIdentifier:(id <NSCopying>)identifier forPath:(UIBezierPath
*)bezierPath;
// 分为三种碰撞类型(元素 边界 全体)
@property (nonatomic,
readwrite) UICollisionBehaviorMode collisionMode;
// 推动行为
4)UIPushBehavior
//推动类型
@property (nonatomic,
readonly) UIPushBehaviorMode mode;
@property (nonatomic,
readwrite) BOOL active;
// 力的角度
@property (readwrite,
nonatomic) CGFloat angle;
// A continuous force vector with a magnitude of 1.0, applied to a 100 point x 100 point view whose density value is 1.0, results in view acceleration of 100 points per s^2
@property (readwrite,
nonatomic) CGFloat magnitude;
// 矢量的推动方向
@property (readwrite,
nonatomic) CGVector pushDirection;
// 捕捉行为
5)UISnapBehavior
// 为视图添加行为 从视图的到 制定的点移动
- (instancetype)initWithItem:(id <UIDynamicItem>)item
snapToPoint:(CGPoint)point
NS_DESIGNATED_INITIALIZER;
// 运动过程中的阻尼
@property (nonatomic,
assign) CGFloat damping;
// 公共的特性 辅助行为
6)UIDynamicItemBehavior
// 弹性系数
@property (readwrite,
nonatomic) CGFloat elasticity;
// Usually between 0 (inelastic) and 1 (collide elastically)
// 摩擦系数
@property (readwrite,
nonatomic) CGFloat friction;
// 0 being no friction between objects slide along each other
// 密度
@property (readwrite,
nonatomic) CGFloat density;
// 1 by default
// 阻力系数
@property (readwrite,
nonatomic) CGFloat resistance;
// 0: no velocity damping
// 角阻力 旋转时
@property (readwrite,
nonatomic) CGFloat angularResistance;
// 0: no angular velocity damping
相关文章推荐
- 去掉uitableveiw多余的分割线
- android之在activity中控制另一个activity的UI更新_如何在activity之间传递handler
- iOS 解决UIScrollView布局问题(布局受statusBar和NavigationBar影响)
- Vue.js组件示例
- 51. N-Queens 回溯算法浅谈
- 初学iOS之UITextView
- iOS UIRefreshControl使用详解
- UI基础 - UILabel
- FreeSWITCH安装报错“You must install libyuv-dev to build mod_fsv”的解决方案
- iOS9 UIButton设置字体颜色和字体的大小、字体的位置
- android的 UI 布局总结
- Java多线程总结之线程安全队列Queue
- AD Query related commands
- Iphone中的UIPopoverController
- CC2650 之UUID配置
- iOS-更改UINavigationBar样式+更改返回ButtonItem文字
- 调用CRM自己的Dialogue
- UITabBarController点击UITabBarItem 禁止跳转ViewController
- Microsoft Build 2016 Day 2 记录(多图慎入)
- 仿写“同行说”之UI控件介绍