CABasicAnimation Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Single keyframe based animations.
[Foundation.Register("CABasicAnimation", true)]
public class CABasicAnimation : CoreAnimation.CAPropertyAnimation
[<Foundation.Register("CABasicAnimation", true)>]
type CABasicAnimation = class
inherit CAPropertyAnimation
- Inheritance
- Derived
- Attributes
Remarks
The animation is created by calling the FromKeyPath(String) method and providing a keyPath that identifies the property on the target that will be animated. The animation is performed by using the values on the From, To and By properties applied to the keyPath.
The interpolation will depend on the values that you choose to set for From, To and By. The following table shows the effects of setting one or more of those properites on the property referenced by the key path:
| Settings | Result |
|---|---|
| No values are set | Interpolates between old value and new value in the presentation layer. |
| From is set | Interpolation is done from the From value to the current value in the presentation layer. |
| To is set | Interpolation is done from the current value in the presentation layer to the To value. |
| By is set | Interpolation is done between the current value on the presentation layer to the current value plus the value in By. |
| From and To are set | Interpolation is done between the From and To values. |
| From and By are set | Interpolation is done between the value set in From to From plus By. |
| To and By are set | Interpolation is done between To minus By and By. |
The From, To and By properties all take NSObject parameters. If you need to specify other parameters, like a CGColor, you can use the methods that take INativeObject parameters (GetByAs, GetFromAs, GetToAs, SetBy, SetFrom, SetTo).
For example, the following will animate the "radius" property for three seconds, from its current value, to the value 120 and will repeat this ten times.
var radiusAnimation = CABasicAnimation.FromKeyPath ("radius");
radiusAnimation.Duration = 3;
radiusAnimation.To = NSNumber.FromDouble (120);
radiusAnimation.RepeatCount = 10;
The above works to set the “To” property to an NSObject, in this case the number 120. If you want to set this for other kinds of objects, you can use the SetTo method, for example, the following sets the target color to a CGColor:
var radiusAnimation = CABasicAnimation.FromKeyPath ("shadowColor");
radiusAnimation.Duration = 3;
radiusAnimation.SetTo (UIColor.Red.CGColor);
radiusAnimation.RepeatCount = 10;
Constructors
| CABasicAnimation() |
Creates a new CABasicAnimation with default values. |
| CABasicAnimation(NativeHandle) |
A constructor used when creating managed representations of unmanaged objects. Called by the runtime. |
| CABasicAnimation(NSCoder) |
A constructor that initializes the object from the data stored in the unarchiver object. |
| CABasicAnimation(NSObjectFlag) |
Constructor to call on derived classes to skip initialization and merely allocate the object. |
Properties
| AccessibilityAttributedUserInputLabels | (Inherited from NSObject) |
| AccessibilityRespondsToUserInteraction | (Inherited from NSObject) |
| AccessibilityTextualContext | (Inherited from NSObject) |
| AccessibilityUserInputLabels | (Inherited from NSObject) |
| Additive | (Inherited from CAPropertyAnimation) |
| AnimationEvents | (Inherited from CAAnimation) |
| AutoReverses | (Inherited from CAAnimation) |
| BeginTime | (Inherited from CAAnimation) |
| By |
Value to increment by. |
| Class | (Inherited from NSObject) |
| ClassHandle |
The Objective-C class handle for this class. |
| Cumulative | (Inherited from CAPropertyAnimation) |
| DebugDescription | (Inherited from NSObject) |
| Delegate |
An instance of the CoreAnimation.CAAnimationDelegate model class which acts as the class delegate. (Inherited from CAAnimation) |
| Description | (Inherited from NSObject) |
| Duration | (Inherited from CAAnimation) |
| ExposedBindings | (Inherited from NSObject) |
| FadeInDuration | (Inherited from CAAnimation) |
| FadeOutDuration | (Inherited from CAAnimation) |
| FillMode | (Inherited from CAAnimation) |
| From |
Initial value for the property to animate. |
| Handle |
Handle (pointer) to the unmanaged object representation. (Inherited from NSObject) |
| IsDirectBinding | (Inherited from NSObject) |
| IsProxy | (Inherited from NSObject) |
| KeyPath | (Inherited from CAPropertyAnimation) |
| PreferredFrameRateRange | (Inherited from CAAnimation) |
| RemovedOnCompletion |
Whether the animation is removed from the layer on completion. (Inherited from CAAnimation) |
| RepeatCount | (Inherited from CAAnimation) |
| RepeatDuration | (Inherited from CAAnimation) |
| RetainCount | (Inherited from NSObject) |
| Self | (Inherited from NSObject) |
| Speed | (Inherited from CAAnimation) |
| Superclass | (Inherited from NSObject) |
| SuperHandle |
Handle used to represent the methods in the base class for this NSObject. (Inherited from NSObject) |
| TimeOffset | (Inherited from CAAnimation) |
| TimingFunction |
The timing function used to compute the animation. (Inherited from CAAnimation) |
| To |
Destination value for the property to animate. |
| UsesSceneTimeBase | (Inherited from CAAnimation) |
| ValueFunction | (Inherited from CAPropertyAnimation) |
| WeakDelegate |
An object that can respond to the delegate protocol for this type (Inherited from CAAnimation) |
| Zone | (Inherited from NSObject) |
Methods
Events
| AnimationStarted |
Event raised by the object. (Inherited from CAAnimation) |
| AnimationStopped |
Event raised by the object. (Inherited from CAAnimation) |