CoreAnimation.CABasicAnimation Class
Single keyframe based animations.

See Also: CABasicAnimation Members

Syntax

[Foundation.Register("CABasicAnimation", true)]
public class CABasicAnimation : CAPropertyAnimation

Remarks

The animation is created by calling the CABasicAnimation.FromKeyPath 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:

SettingsResult
No values are setInterpolates between old value and new value in the presentation layer.
From is setInterpolation is done from the From value to the current value in the presentation layer.
To is setInterpolation is done from the current value in the presentation layer to the To value.
By is setInterpolation is done between the current value on the presentation layer to the current value plus the value in By.
From and To are setInterpolation is done between the From and To values.
From and By are setInterpolation is done between the value set in From to From plus By.
To and By are setInterpolation 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.

c# Example

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:

c# Example

var radiusAnimation = CABasicAnimation.FromKeyPath (“shadowColor");
radiusAnimation.Duration = 3;
radiusAnimation.SetTo (UIColor.Red.CGColor);
radiusAnimation.RepeatCount = 10;

Related content

Requirements

Namespace: CoreAnimation
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0