/* this assumes you have all frame source as .png files called my_anim01.png, my_anim02.png etc. */ #define FRM_ENC \ LOSSY 80 #define FRM_IMG(base, num) \ image: base""num".png" FRM_ENC #define FRM(base, num) \ description { state: "_frm"num 0.0; image { normal: base"_"num".png"; } } #define ANIM(part, num, next, time) \ program { name: "_frm"num; action: STATE_SET "_frm"num 0.0; target: part; transition LINEAR time; after "_frm"next; } #define ANIM_END(part, num) \ program { name: "_frm"num; action: STATE_SET "_frm"num 0.0; target: part; } images { FRM_IMG("my_anim", "01"); /* store these frames */ FRM_IMG("my_anim", "02"); FRM_IMG("my_anim", "03"); FRM_IMG("my_anim", "04"); FRM_IMG("my_anim", "05"); FRM_IMG("my_anim", "06"); FRM_IMG("my_anim", "07"); FRM_IMG("my_anim", "08"); FRM_IMG("my_anim", "09"); FRM_IMG("my_anim", "10"); } collections { group { name: "animation group"; part { name: "anim_obj"; mouse_events: 0; description { state: "default" 0.0; } FRM("my_anim", "01"); /* declare what frames this part can have */ FRM("my_anim", "02"); FRM("my_anim", "03"); FRM("my_anim", "04"); FRM("my_anim", "05"); FRM("my_anim", "06"); FRM("my_anim", "07"); FRM("my_anim", "08"); FRM("my_anim", "09"); FRM("my_anim", "10"); } programs { ANIM("anim_obj", "01", "02", 0.5); /* display frame 01 for 0.5 seconds then go to frame 02 */ ANIM("anim_obj", "02", "03", 0.1); /* display frame 02 for 0.1 seconds then go to frame 03 */ ANIM("anim_obj", "03", "04", 1.0); /* display frame 03 for 1.0 seconds then go to frame 04 */ ANIM("anim_obj", "04", "05", 0.2); ANIM("anim_obj", "05", "06", 0.3); ANIM("anim_obj", "06", "07", 0.8); ANIM("anim_obj", "07", "08", 0.5); ANIM("anim_obj", "08", "09", 5.0); ANIM("anim_obj", "09", "10", 2.0); ANIM_END("anim_obj", "10"); } } }