-
Notifications
You must be signed in to change notification settings - Fork 0
Animation Object
nhmkdev edited this page Jan 5, 2014
·
14 revisions
An animation object is common in the framework for specifying the animation settings for a variety of entities.
The format of an animation object expands upon the base defined below depending on the type of entity. All of the settings below directly map to parameters required to create an animation in ImpactJS. Further information can be found in the ImpactJS documentation.
ao: // animation object
{
i:'redflag', // image name ('media/' is prepended and .png is appended)
w:16, // width of frame
h:16, // height of frame
a: // animation states
{
collect: // state name
{
ft:1, // frametime
seq:[0] // sequence
s:true, // stop (after playing anim) (default: false)
},
idle: // state name
{
ft:1, // frametime
seq:[1], // sequence
s:true, // stop (after playing anim) (default: false)
}
}
}
In the state driven format there are extra fields used to determine what state should apply based on the Save flag state.
Below is a sample animation state within an ao object:
closed:
{
c:'FIXED' // The type of collision for this state (see ig.Entity.COLLIDES values) (default: 'NEVER')
b: { x:2, y: 32}, // bounds for collision (default: the entire image bounds)
bo: {x: 2, y: 2}, // bounds offset for collision (default: {x:0, y:0})
// standard animation state fields
ft:1, // frametime
seq:[1] // sequence
s:false // stop anim
}