View Single Post
03-22-13, 06:45 PM   #1
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Lua equivalent for Animation.targetKey

I've noticed that in Blizzard's XML code, animations can have a 'targetKey' attribute which specifies which region of the animation's animation group's target frame () is animated. This allows frames to have multiple animations which each affect a different region of the frame, rather than the frame as a whole.

Example:

Code:
<Frame name="WorldMapPing" framestrata="FULLSCREEN" hidden="true">
		<Size x="64" y="64"/>
		<Anchors>
			<Anchor point="CENTER" relativeTo="WorldMapFrame"/>
		</Anchors>
		<Layers>
			<Layer level="OVERLAY">
				<Texture parentKey="centerRing" file="Interface\minimap\UI-Minimap-Ping-Center">
					<Size x="32" y="32"/>
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
				<Texture parentKey="rotatingRing" file="Interface\minimap\UI-Minimap-Ping-Rotate">
					<Size x="48" y="48"/>
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
				<Texture parentKey="expandingRing" file="Interface\minimap\UI-Minimap-Ping-Expand">
					<Size x="32" y="32"/>
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Animations>
			<AnimationGroup parentKey="Ping" looping="REPEAT">
				<Rotation targetKey="$parent.$parent.rotatingRing" degrees="-180" duration="0.75" order="1"/>
				<Scale targetKey="$parent.$parent.expandingRing" scaleX="1.75" scaleY="1.75" duration="0.75" order="1"/>
				<Scripts>
					<OnPlay function="WorldMapPing_OnPlay"/>
					<OnLoop function="WorldMapPing_OnLoop"/>
					<OnStop function="WorldMapPing_OnStop"/>
				</Scripts>
			</AnimationGroup>
		</Animations>
	</Frame>
The only way to more or less replicate this in lua is to create an animation group for the region itself, apparently, and then attach the animation to that animation group. This would mean having several animation groups, one for each region.

Is there any lua API to replicate the XML functionality?

Reason I'm asking this is because I'm trying to more or less restore the old world map player arrow. I managed to scale the thing down again and I can edit individual animations, but I'm trying to assign the scale animation to rotatingRing instead of expandingRing (which I'll hide).

Last edited by Haleth : 03-22-13 at 06:47 PM.
  Reply With Quote