NoveltyML reference > Resources > Animation

<Animation>

An animation resource.
Contains a collection of frames and timing information. Animations can be used by images.


Animation attributes

Attribute Description
loop Enable/disable looping
time Duration of animation

Additionally, this asset type inherits all resource attributes.


loop [boolean]

Set to false to disable looping.
Setting loop to "reverse" will cause the sequence to play forward and backwards repeatedly.
Default value is true.

Example:
loop = "false"


time [float]

Sets the total duration for this animation (in seconds).
If this attribute is omitted then the animation will be timed based on the individual frames' durations. Default value is 1 (second).

Example:
time = "5.0"


Valid child tags

Child tags Description
<Frame> Animation frame
<Sequence> Animation sequence
<Region> Region of animation frames
<Meta> Meta information


<Sequence>

Named animation sequence.
Contains a collection of frames and timing information.

Attribute Description Type
name Unique name of this animation sequence String
time Total length of animation in seconds Float
loop Loop animation? Boolean
texture Name of (different) texture asset String

Remarks: time may be omitted if all frames have their respective durations set.
Setting loop to "reverse" will cause the sequence to play forwards and backwards repeatedly.

Child tags Description
<Frame> Animation frame
<Region> Animation frame


<Frame>

Animation frame.
Each frame defines a rectangular region of a texture (in pixels) and the duration this frame should be shown.

Attribute> Description Type
rect [Required] Frame coordinates in pixels ("x, y, width, height") Vector4
time Duration of frame in seconds. Float

Remarks: If time is omitted, the duration of this frame will be the parent animation's time value / number of frames.
If that in turn still results in a zero value, a default of 0.1 is used.


<Region>

Defines a region in which frame coordinates can be calculated automatically using indices.

Attribute Description Type
rect [Required] Region coordinates in pixels ("x, y, width, height") Vector4
frame-size [Required] Size of frames within the region ("width, height") Vector2

Remarks: For all <Frame> in <Region> the index-attribute overrides rect.

Child tags Description>
<Frame> Animation frame


<Frame>

Indexed animation frame.

Attribute Description Type
index [Required] Frame index (zero-based) Integer
time Duration of frame in seconds. Float

Remarks: If time is omitted, the duration of this frame will be the parent animation's time value / number of frames.
If that in turn still results in a zero value, a default of 0.1 is used.


Example

<Animation name="My animation">
	<!-- Inline sequence -->
	<Frame rect="0,0,64,64"    time="0.2"/>
	<Frame rect="64,0,64,64"   time="0.1"/>
	<Frame rect="128,0,64,64"  time="0.1"/>
	<Frame rect="256,0,64,64"  time="0.1"/>

	<!-- Named sequence -->
	<Sequence name="Other" loop="false">
		<Frame rect="0,64,64,64"    time="0.2"/>
		<Frame rect="64,64,64,64"   time="0.1"/>
	</Sequence>
</Animation>
		

Back to top