<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">

<Script file="RingTemplate.lua" />

<Frame name="ArcHUDRingTemplate" frameStrata="BACKGROUND" frameLevel="10" virtual="true">
	<Size x="256" y="256"/>
	
	<Layers>
		<Layer level="ARTWORK">
				<Texture name="$parentQ1"     parentKey="ringQuadrant1" file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Ring.tga"></Texture>
				<Texture name="$parentQ2"     parentKey="ringQuadrant2" file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Ring.tga"></Texture>
				<Texture name="$parentChip1"  parentKey="chip1"         file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Ring.tga"></Texture>
				<Texture name="$parentChip2"  parentKey="chip2"         file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Ring.tga"></Texture>
				<Texture name="$parentSlice1" parentKey="slice1"        file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Slice.tga"></Texture>
				<Texture name="$parentSlice2" parentKey="slice2"        file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Slice.tga"></Texture>
		</Layer>
		<Layer level="OVERLAY">
			<Texture name="$parentSpark"    parentKey="spark"    file="Interface\CastingBar\UI-CastingBar-Spark" alphaMode="ADD" hidden="true"></Texture>
			<Texture name="$parentSparkRed" parentKey="sparkRed" file="Interface\CastingBar\UI-CastingBar-SparkRed" alphaMode="ADD" hidden="true"></Texture>
		</Layer>
	</Layers>
	
	<Frames>
		<Frame name="$parentBG" frameLevel="1" parentKey="BG">
			<Size x="256" y="256"/>
			
			<Anchors>
				<Anchor point="BOTTOMLEFT" />
			</Anchors>
			
			<Layers>
				<Layer level="BACKGROUND">
				<Texture name="$parentQ1"     parentKey="ringQuadrant1" file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\RingBG.tga"></Texture>
				<Texture name="$parentQ2"     parentKey="ringQuadrant2" file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\RingBG.tga"></Texture>
				<Texture name="$parentChip1"  parentKey="chip1"         file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\RingBG.tga"></Texture>
				<Texture name="$parentChip2"  parentKey="chip2"         file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\RingBG.tga"></Texture>
				<Texture name="$parentSlice1" parentKey="slice1"        file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Slice.tga"></Texture>
				<Texture name="$parentSlice2" parentKey="slice2"        file="Interface\AddOns\MidnightHUD\Modules\ArcHUD\Icons\Slice.tga"></Texture>
				</Layer>
			</Layers>

			<Scripts>
				<OnLoad>
					ArcHUDRingTemplate:OnLoadBG(self)
				</OnLoad>
			</Scripts>
		</Frame>
		
		<Frame name="$parentShine" parentKey="shine" frameStrata="MEDIUM" hidden="true">
			<Layers>
				<Layer level="OVERLAY">
					<Texture name="$parentTexture" parentKey="texture" file="Interface\ComboFrame\ComboPoint" alphaMode="ADD">
						<Size x="60" y="35"/>
						<TexCoords left="0.5625" right="1" top="0" bottom="1"/>
					</Texture>
				</Layer>
			</Layers>
		</Frame>
		
		<Frame name="$parentFillUpdateFrame" parentKey="fillUpdateFrame">
			<Animations>
				<AnimationGroup parentKey="fillUpdate" looping="REPEAT">
					<Animation duration="1" order="1">
						<Scripts>
							<OnLoad>
								self.ring = self:GetParent():GetParent():GetParent();
							</OnLoad>
							<OnUpdate>
								ArcHUDRingTemplate.DoFadeUpdate(self.ring, elapsed);
							</OnUpdate>
						</Scripts>
					</Animation>
				</AnimationGroup>
			</Animations>
		</Frame>
	</Frames>

	<Animations>
		<AnimationGroup parentKey="applyAlpha">
			<Alpha parentKey="alphaAnim" duration="0.5" order="1" />
			<Scripts>
				<OnLoad>
					self.ring = self:GetParent();
				</OnLoad>
				<OnPlay>
					if (not self.ring.fillUpdate:IsPlaying()) then
						self.ring.fillUpdate:Play();
					end
					self.destAlpha = self.alphaAnim:GetToAlpha()
				</OnPlay>
				<OnFinished>
					self.ring:SetAlpha(self.destAlpha);
					self.ring:applyAlpha_OnFinished();
				</OnFinished>
			</Scripts>
		</AnimationGroup>
		
		<!-- (more or less) synchronized pulse -->
		<AnimationGroup parentKey="syncPulse" looping="REPEAT">
			<Animation duration="1" order="1">
				<Scripts>
					<OnLoad>
						self.ring = self:GetParent():GetParent();
					</OnLoad>
					<OnUpdate>
						self.ring:SetAlpha(0.6 + math.cos(GetTime() * 3.14159265) * 0.3);
					</OnUpdate>
					<OnFinished>
						local destAlpha = self.ring.destAlpha;
						self.ring.destAlpha = -1;
						self.ring:SetRingAlpha(destAlpha);
					</OnFinished>
				</Scripts>
			</Animation>
		</AnimationGroup>
	</Animations>
	
	<Scripts>
		<OnLoad>
			ArcHUDRingTemplate:OnLoad(self)
		</OnLoad>
	</Scripts>

</Frame>

</Ui>
