-- todo: add sounds, fix extra animations
local t = Def.ActorFrame{
	OnCommand=cmd(sleep,4);

	LoadActor( THEME:GetPathB("","star") )..{
		InitCommand=cmd(Center;zoom,0;);
		BeginCommand=function(self)
			if GAMESTATE:HasEarnedExtraStage() then
				if GAMESTATE:IsExtraStage() then
					self:diffuse( color("1.0,0.8,0.8,1") );
				elseif GAMESTATE:IsExtraStage2() then
					self:diffuse( color("1.0,1.0,0.8,1") );
				end;
			end;
		end;
		OnCommand=cmd(sleep,1;rotationz,0;linear,1;rotationz,-1280;zoom,10);
	};

	LoadActor( "_extra1" )..{
		InitCommand=cmd(Center;diffusealpha,0;zoom,10;);
		BeginCommand=function(self)
			-- earned extra in normal mode
			self:visible(GAMESTATE:HasEarnedExtraStage() and not GAMESTATE:IsExtraStage2());
		end;
		OnCommand=cmd(linear,0.5;rotationz,1800;zoom,1;diffusealpha,1;sleep,2;linear,0.5;diffusealpha,0);
	};

	LoadActor( "_extra2" )..{
		InitCommand=cmd(Center;diffusealpha,0;zoom,10;);
		BeginCommand=function(self)
			-- earned extra2 in extra1.
			self:visible(GAMESTATE:HasEarnedExtraStage() and GAMESTATE:IsExtraStage2());
		end;
		OnCommand=cmd(linear,0.5;rotationz,1800;zoom,1;diffusealpha,1;sleep,2;linear,0.5;diffusealpha,0);
	};

	LoadActor( "cleared" )..{
		InitCommand=cmd(Center;diffusealpha,0;);
		BeginCommand=cmd(hide_if,GAMESTATE:HasEarnedExtraStage());
		OnCommand=cmd(sleep,1;linear,0.5;diffusealpha,1;sleep,2;linear,0.5;diffusealpha,0);
	};

	LoadActor( THEME:GetPathB("","star.png") )..{
		InitCommand=cmd(Center;diffuse,color("0,0,0,1");zoom,0;);
		OnCommand=cmd(sleep,3.7;rotationz,0;linear,0.3;rotationz,-1000;zoom,3);
	};
};

return t;