All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzu_animation.h File Reference

Classes

struct  KzuAnimation
 Animation structure. More...
 

Namespaces

 kanzi
 

Enumerations

enum  KzuAnimationTargetType { KZU_ANIMATION_TARGET_TYPE_FLOAT, KZU_ANIMATION_TARGET_TYPE_TEXTURE, KZU_ANIMATION_TARGET_TYPE_MATRIX }
 Type of the animation key data. More...
 

Functions

KANZI_API kzsError kzuAnimationCreate (kanzi::Domain *domain, struct KzuAnimation **out_animation)
 Allocates memory for animation structure without specifying the target or target type. More...
 
KANZI_API kzsError kzuAnimationCreateFloatTarget (kanzi::Domain *domain, kzString propertyTypePath, kanzi::PropertyField propertyField, struct KzuAnimation **out_animation)
 Allocates memory for animation structure for animating given float property. More...
 
KANZI_API kzsError kzuAnimationCreateMatrix (kanzi::Domain *domain, kzString propertyTypePath, struct KzuAnimation **out_animation)
 Allocates memory for animation structure for animating given matrix property. More...
 
KANZI_API kzsError kzuAnimationCreateTexture (kanzi::Domain *domain, kzString propertyTypePath, struct KzuAnimation **out_animation)
 Allocates memory for animation structure for animating given texture property. More...
 
KANZI_API kzsError kzuAnimationLoadFromKZB (struct KzuAnimation *animation, struct KzcInputStream *inputStream, const struct KzuBinaryFileInfo *file)
 Loads animation from KZB. More...
 
KANZI_API void kzuAnimationAddChild (KzuAnimation *parent, kanzi::AnimationSharedPtr child)
 Add child animation to given animation. More...
 
KANZI_API void kzuAnimationRemoveChild (KzuAnimation *parent, kanzi::AnimationSharedPtr child)
 Removes child from animation. More...
 
KANZI_API kzsError kzuAnimationAddKeyFrame (struct KzuAnimation *animation, const struct KzuAnimationKey *animationKey)
 Adds new animation key to animation. More...
 
KANZI_API kzsError kzuAnimationRemoveKeyFrame (KzuAnimation *animation, const struct KzuAnimationKey *animationKey)
 Removes animation key from animation. More...
 
KANZI_API void kzuAnimationSetKeyFrameValueSource (KzuAnimation *animation, KzuAnimationKey *key, KzuAnimationKeyValueSource source, kanzi::ResourceSharedPtr resource)
 Sets value source for animation key frame. More...
 
KANZI_API struct KzcDynamicArraykzuAnimationGetKeyFrames (const struct KzuAnimation *animation)
 Gets animation key frames as dynamic array. More...
 
KANZI_API kzsError kzuAnimationGetKeysAtTime (const struct KzuAnimation *animation, kzFloat time, struct KzuAnimationKey **out_animationKey1, struct KzuAnimationKey **out_animationKey2)
 Gets nearest smaller and bigger available animation keys for given animation. More...
 
KANZI_API kzsError kzuAnimationGetValueAtTime (struct KzuAnimation *animation, kzFloat time, kzFloat *out_value, kzBool *out_valueFound)
 Returns effective value of the animation at given time. More...
 
KANZI_API kzsError kzuAnimationApply (struct KzuAnimationPlayer *player, const struct KzuAnimation *animation, kzFloat time)
 Applies given animation and its children at given time for the target specified by parameter property. More...
 
KANZI_API kzFloat kzuAnimationGetStartTime (const struct KzuAnimation *animation)
 Gets the starting time of the animation and its children. More...
 
KANZI_API kzFloat kzuAnimationGetEndTime (const struct KzuAnimation *animation)
 Gets the ending time of the animation and its children. More...
 
KANZI_API kzsError kzuAnimationPrepare (struct KzuAnimationPlayer *player, const struct KzuAnimation *animation)
 Prepares animations target properties for animation update. More...
 
KANZI_API const struct
KzuPropertyType
kzuAnimationGetTargetPropertyType (const struct KzuAnimation *animation)
 Gets animation target property type to animate. More...
 
KANZI_API kanzi::PropertyField kzuAnimationGetTargetAttribute (const struct KzuAnimation *animation)
 Gets target attribute from animation. More...
 
KANZI_API kzsError kzuAnimationResolveObjectFromPath (kanzi::Domain *domain, kanzi::Node *parentObjectNode, kzString path, kanzi::Node **out_objectNode, kanzi::Resource **out_resource)
 Resolves object from given path. More...
 
KANZI_API kzsError kzuAnimationSetTargetPropertyType (struct KzuAnimation *animation, const struct KzuPropertyType *targetPropertyType)
 Sets target property type for animation. More...
 

Enumeration Type Documentation

Type of the animation key data.

Enumerator
KZU_ANIMATION_TARGET_TYPE_FLOAT 

Animation target is float.

KZU_ANIMATION_TARGET_TYPE_TEXTURE 

Animation target is texture.

KZU_ANIMATION_TARGET_TYPE_MATRIX 

Animation target is matrix.

Function Documentation

KANZI_API kzsError kzuAnimationCreate ( kanzi::Domain domain,
struct KzuAnimation **  out_animation 
)

Allocates memory for animation structure without specifying the target or target type.

KANZI_API kzsError kzuAnimationCreateFloatTarget ( kanzi::Domain domain,
kzString  propertyTypePath,
kanzi::PropertyField  propertyField,
struct KzuAnimation **  out_animation 
)

Allocates memory for animation structure for animating given float property.

Parameters
memoryManagerThe memory manager to use.
domainThe UI domain to use.
propertyTypePathString specifying the target property. See the top of the page for the format.
out_animationPointer that is set to point to the new KzuAnimation.
KANZI_API kzsError kzuAnimationCreateMatrix ( kanzi::Domain domain,
kzString  propertyTypePath,
struct KzuAnimation **  out_animation 
)

Allocates memory for animation structure for animating given matrix property.

Parameters
memoryManagerThe memory manager to use.
domainThe UI domain to use.
propertyTypePathString specifying the target property. See the top of the page for the format.
out_animationPointer that is set to point to the new KzuAnimation.
KANZI_API kzsError kzuAnimationCreateTexture ( kanzi::Domain domain,
kzString  propertyTypePath,
struct KzuAnimation **  out_animation 
)

Allocates memory for animation structure for animating given texture property.

Parameters
memoryManagerThe memory manager to use.
domainThe UI domain to use.
propertyTypePathString specifying the target property. See the top of the page for the format.
out_animationPointer that is set to point to the new KzuAnimation.
KANZI_API kzsError kzuAnimationLoadFromKZB ( struct KzuAnimation animation,
struct KzcInputStream inputStream,
const struct KzuBinaryFileInfo file 
)

Loads animation from KZB.

KANZI_API void kzuAnimationAddChild ( KzuAnimation parent,
kanzi::AnimationSharedPtr  child 
)

Add child animation to given animation.

KANZI_API void kzuAnimationRemoveChild ( KzuAnimation parent,
kanzi::AnimationSharedPtr  child 
)

Removes child from animation.

KANZI_API kzsError kzuAnimationAddKeyFrame ( struct KzuAnimation animation,
const struct KzuAnimationKey animationKey 
)

Adds new animation key to animation.

Takes ownership of animationKey.

KANZI_API kzsError kzuAnimationRemoveKeyFrame ( KzuAnimation animation,
const struct KzuAnimationKey animationKey 
)

Removes animation key from animation.

KANZI_API void kzuAnimationSetKeyFrameValueSource ( KzuAnimation animation,
KzuAnimationKey key,
KzuAnimationKeyValueSource  source,
kanzi::ResourceSharedPtr  resource 
)

Sets value source for animation key frame.

KANZI_API struct KzcDynamicArray* kzuAnimationGetKeyFrames ( const struct KzuAnimation animation)

Gets animation key frames as dynamic array.

KANZI_API kzsError kzuAnimationGetKeysAtTime ( const struct KzuAnimation animation,
kzFloat  time,
struct KzuAnimationKey **  out_animationKey1,
struct KzuAnimationKey **  out_animationKey2 
)

Gets nearest smaller and bigger available animation keys for given animation.

The nearest smaller key is returned in out_animationKey1 and nearest higher key is returned in out_animationKey2. If there are no keys at some direction the corresponding out_animationKey is set to KZ_NULL.

KANZI_API kzsError kzuAnimationGetValueAtTime ( struct KzuAnimation animation,
kzFloat  time,
kzFloat out_value,
kzBool out_valueFound 
)

Returns effective value of the animation at given time.

Parameters
out_valueOutput value evaluated from animation. KZ_NULL for ignoring the return value.
out_valueFoundReturns if value was found at all, for example if sampling outside keyframes value is not found. KZ_NULL for ignoring the return value.
KANZI_API kzsError kzuAnimationApply ( struct KzuAnimationPlayer player,
const struct KzuAnimation animation,
kzFloat  time 
)

Applies given animation and its children at given time for the target specified by parameter property.

Parameters
timeTime of animation. If out of range [0, (endTime - startTime)] the first or last key value is used. If animation targets scale or rotation components of matrix, the transformations from the target matrix is set to identity.
KANZI_API kzFloat kzuAnimationGetStartTime ( const struct KzuAnimation animation)

Gets the starting time of the animation and its children.

KANZI_API kzFloat kzuAnimationGetEndTime ( const struct KzuAnimation animation)

Gets the ending time of the animation and its children.

KANZI_API kzsError kzuAnimationPrepare ( struct KzuAnimationPlayer player,
const struct KzuAnimation animation 
)

Prepares animations target properties for animation update.

Resets states and values.

KANZI_API const struct KzuPropertyType* kzuAnimationGetTargetPropertyType ( const struct KzuAnimation animation)

Gets animation target property type to animate.

KANZI_API kanzi::PropertyField kzuAnimationGetTargetAttribute ( const struct KzuAnimation animation)

Gets target attribute from animation.

KANZI_API kzsError kzuAnimationResolveObjectFromPath ( kanzi::Domain domain,
kanzi::Node parentObjectNode,
kzString  path,
kanzi::Node **  out_objectNode,
kanzi::Resource **  out_resource 
)

Resolves object from given path.

KANZI_API kzsError kzuAnimationSetTargetPropertyType ( struct KzuAnimation animation,
const struct KzuPropertyType targetPropertyType 
)

Sets target property type for animation.