iOS Developer Library

Developer

QuartzCore Framework Reference CAValueFunction Class Reference

Options
Deployment Target:

On This Page
Language:

CAValueFunction

Inheritance


Conforms To


Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in iOS 3.0 and later.

The CAValueFunction.h class provides a more flexible means of applying functions to property values during animation. A value function defines an optional transformation that is applied to the interpolated value before it is set in the presentation layer.

Using value transform functions, animations can effect the transform property of a layer using arbitrary transforms of each component (no normalization to 360°) and concatenate in the normally when multiple animations are applied at once.

You use a value transform function that rotates from 0° to 180° around the z-axis by creating a CAValueTransform function specifying the kCAValueFunctionRotateZ and then creating an animation with a fromValue of 0, a toValue of M_PI, and set the animation’s valueTransform property to the value transform instance.

  • name name Property

    Returns the name of the value function. (read-only)

    Declaration

    Swift

    var name: String! { get }

    Objective-C

    @property(readonly) NSString *name

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 3.0 and later.

  • Returns the value function object identified by the name.

    Declaration

    Swift

    convenience init!(name name: String!)

    Objective-C

    + (instancetype)functionWithName:(NSString *)name

    Parameters

    name

    The name of the value function.

    Return Value

    A new CAValueFunction instance with the value function specified by the name.

    Discussion

    The possible values for name are specified in Rotate Value Functions, Scale Value Functions, and Translate Functions.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 3.0 and later.

  • Rotate value transform functions construct a 4x4 matrix that represents the corresponding rotation matrix.

    Declaration

    Swift

    let kCAValueFunctionRotateX: String let kCAValueFunctionRotateY: String let kCAValueFunctionRotateZ: String

    Objective-C

    NSString * const kCAValueFunctionRotateX; NSString * const kCAValueFunctionRotateY; NSString * const kCAValueFunctionRotateZ;

    Constants

    • kCAValueFunctionRotateX

      kCAValueFunctionRotateX

      A value function that rotates by the input value, in radians, around the x-axis. This value function expects a single input value.

      Available in iOS 3.0 and later.

    • kCAValueFunctionRotateY

      kCAValueFunctionRotateY

      A value function that rotates by the input value, in radians, around the y-axis. This value function expects a single input value.

      Available in iOS 3.0 and later.

    • kCAValueFunctionRotateZ

      kCAValueFunctionRotateZ

      A value function that rotates by the input value, in radians, around the z-axis. This value function expects a single input value.

      Available in iOS 3.0 and later.

  • Scale value transform functions construct a 4x4 matrix that represents the corresponding scale matrix.

    Declaration

    Swift

    let kCAValueFunctionScale: String let kCAValueFunctionScaleX: String let kCAValueFunctionScaleY: String let kCAValueFunctionScaleZ: String

    Objective-C

    NSString * const kCAValueFunctionScale; NSString * const kCAValueFunctionScaleX; NSString * const kCAValueFunctionScaleY; NSString * const kCAValueFunctionScaleZ;

    Constants

    • kCAValueFunctionScale

      kCAValueFunctionScale

      A value function scales by the input value along all three axis. Animations using this value transform function must provide animation values in an NSArray of three NSNumber instances that specify the (x, y, z) scale values.

      Available in iOS 3.0 and later.

    • kCAValueFunctionScaleX

      kCAValueFunctionScaleX

      A value function scales by the input value along the x-axis. Animations referencing this value transform function must provide a single animation value.

      Available in iOS 3.0 and later.

    • kCAValueFunctionScaleY

      kCAValueFunctionScaleY

      A value function scales by the input value along the y-axis. Animations referencing this value function must provide a single animation value.

      Available in iOS 3.0 and later.

    • kCAValueFunctionScaleZ

      kCAValueFunctionScaleZ

      A value function that scales by the input value along the z-axis. Animations referencing this value function must provide a single animation value.

      Available in iOS 3.0 and later.

  • Translate value transform functions construct a 4x4 matrix that represents the corresponding translate matrix.

    Declaration

    Swift

    let kCAValueFunctionTranslate: String let kCAValueFunctionTranslateX: String let kCAValueFunctionTranslateY: String let kCAValueFunctionTranslateZ: String

    Objective-C

    NSString * const kCAValueFunctionTranslate; NSString * const kCAValueFunctionTranslateX; NSString * const kCAValueFunctionTranslateY; NSString * const kCAValueFunctionTranslateZ;

    Constants

    • kCAValueFunctionTranslate

      kCAValueFunctionTranslate

      A value function that translates by the input values along all three axis. Animations using this value transform function must provide animation values in an NSArray of three NSNumber instances that specify the (x, y, z) translate values.

      Available in iOS 3.0 and later.

    • kCAValueFunctionTranslateX

      kCAValueFunctionTranslateX

      A value function translates by the input value along the x-axis. Animations referencing this value function must provide a single input value.

      Available in iOS 3.0 and later.

    • kCAValueFunctionTranslateY

      kCAValueFunctionTranslateY

      A value function translates by the input value along the y-axis. Animations referencing this value function must provide a single input value.

      Available in iOS 3.0 and later.

    • kCAValueFunctionTranslateZ

      kCAValueFunctionTranslateZ

      A value function translates by the input value along the z-axis. Animations referencing this value function must provide a single input value.

      Available in iOS 3.0 and later.