CABasicAnimation

本文深入探讨了CABasicAnimation在Core Animation框架中的应用,包括其继承关系、遵循协议、框架依赖、可用性以及相关示例代码。重点介绍了如何通过设置关键帧、从值、到值和相对偏移值来实现动画效果,以及这些参数之间的相互作用。

CABasicAnimation Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/ QuartzCore.framework
Availability
Available in iOS 2.0 and later.
Declared in
CAAnimation.h
Companion guides
Related sample code

Overview

CABasicAnimation provides basic, single-keyframe animation capabilities for a layer property. You create an instance of CABasicAnimation using the inherited animationWithKeyPath: method, specifying the key path of the property to be animated in the render tree.

Setting Interpolation Values

The fromValue, byValue and toValue properties define the values being interpolated between. All are optional, and no more than two should be non-nil. The object type should match the type of the property being animated.

The interpolation values are used as follows:

  • Both fromValue and toValue are non-nil. Interpolates between fromValue and toValue.

  • fromValue and byValue are non-nil. Interpolates between fromValue and (fromValue + byValue).

  • byValue and toValue are non-nil. Interpolates between (toValue - byValue) and toValue.

  • fromValue is non-nil. Interpolates between fromValue and the current presentation value of the property.

  • toValue is non-nil. Interpolates between the current value of keyPath in the target layer’s presentation layer and toValue.

  • byValue is non-nil. Interpolates between the current value of keyPath in the target layer’s presentation layer and that value plus byValue.

  • All properties are nil. Interpolates between the previous value of keyPath in the target layer’s presentation layer and the current value of keyPath in the target layer’s presentation layer.

Tasks

Interpolation Values

Properties

byValue

Defines the value the receiver uses to perform relative interpolation.

@property(retain) id byValue
Discussion

See “Setting Interpolation Values” for details on how byValue interacts with the other interpolation values.

Availability
  • Available in iOS 2.0 and later.
Declared In
CAAnimation.h

fromValue

Defines the value the receiver uses to start interpolation.

@property(retain) id fromValue
Discussion

See “Setting Interpolation Values” for details on how fromValue interacts with the other interpolation values.

Availability
  • Available in iOS 2.0 and later.
Declared In
CAAnimation.h

toValue

Defines the value the receiver uses to end interpolation.

@property(retain) id toValue
Discussion

See “Setting Interpolation Values” for details on how toValue interacts with the other interpolation values.

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
Declared In
CAAnimation.h

转载于:https://www.cnblogs.com/zyingn/articles/iOS_reference1.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值