Skip to content

Format of file, with animations (sad::animations::File, supported from 1.5 alpha )

Dmitry Mamontov edited this page May 22, 2015 · 1 revision

What is animations file

Animations file is a simple JSON file, which contains list of animations, as resources. Note, that this is not the same, as storing animations as database, since if you store animations in it, you can reload animations, while changing it.

A file should contain list of animations, as resources in database in correct format

Format

A file must contain an object, whose keys, are string of names of resources for animations and values are objects, descripting animations. Note, that those objects must have type property, pointing correct class name for animation. Those objects are stored in similar manner as in database, so you can use IFaceEditor to see format, through saving animations to database and looking to output, or by analysing schema, described in code of animation.

Example

An example of such file could be found in $SADDY$/bin/tests/animations/test.json

{
	"rotate" : {
		"time" : 1000,
		"looped" : true,
		"min_angle" : 0,
		"max_angle" : 360,
		"type" : "sad::animations::Rotate"	
	}
}

Here described looped rotation animation as resource, with name rotate, with starting angle 0 and ending angle - 360.

How to load

You can add following description in your file, describing resources to load file with animations. Below described whole resource file, but you can add only object from it.

[
    {
         "type"   : "sad::animations::File",
         "filename": "tests/animations/test.json"
    }
]