Quantcast
Inheriting AnimationGroups? - WoWInterface
 
Thread Tools Display Modes
06-23-15, 08:05 AM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Inheriting AnimationGroups?

Hi,

I already posted this on mmo-champion but didn't get a reply (yet) but wish I posted it here instead:
http://www.mmo-champion.com/threads/...o-be-inherited

But basically I am wondering why method/function "Region:CreateAnimationGroup" has an "inheritsFrom" argument since I cannot seem to get it to work. I don't think you can create AnimationGroup virtual templates and to get around this I just created a virtual frame with the animation group attached it to and inherited that instead with the CreateFrame function.

http://wowprogramming.com/docs/widge...AnimationGroup
Lua Code:
  1. animationGroup = Region:CreateAnimationGroup(["name" [, "inheritsFrom"]])

But wanted to ask:

I don't understand how the CreateAnimationGroup's "inheritsFrom" parameter works because as far as I know you cannot inherit an AnimationGroup directly and have never seen anyone ever attempt to use this parameter like I have tried to do. Also there are no examples to learn from. How can you use this "inheritsFrom" parameter to inherit an AnimationGroup? If you can't then what is it used for?

Thank you for reading

Last edited by Mayron : 06-23-15 at 08:21 AM.
  Reply With Quote
06-23-15, 10:43 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Try to increment the place of the template argument, just like the CreateTexture one:

Lua Code:
  1. Frame:CreateTexture(["textureName"[, "layer"]][, "inheritsFrom"])

If thats not working then maybe it doesn't support templates which would be weird.

On the second tought you maybe need this one:

http://wowprogramming.com/docs/widge...reateAnimation

Last edited by Resike : 06-23-15 at 10:50 AM.
  Reply With Quote
06-23-15, 11:07 AM   #3
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Originally Posted by Resike View Post
Try to increment the place of the template argument, just like the CreateTexture one:

Lua Code:
  1. Frame:CreateTexture(["textureName"[, "layer"]][, "inheritsFrom"])

If thats not working then maybe it doesn't support templates which would be weird.

On the second tought you maybe need this one:

http://wowprogramming.com/docs/widge...reateAnimation
I'm glad I'm not the only one who finds that weird. The argument is in the right place and tried incrementing it to the 3rd argument but that didn't work either. It detects that I am trying to use a template but it cannot find my declared animation group "MY_FadeOutTemplate". I don't think animation groups use the "virtual" attribute but I tried it with and without but no luck.

Lua Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/">
  2.     <AnimationGroup name="MY_AnimationGroupTemplate" virtual="true">
  3.         <Alpha change="-1" smoothing="IN" duration="0.3" order="1" />
  4.         <Translation offsetX="0" offsetY="10" smoothing="OUT" duration="0.3" order="1" />
  5.         <Scripts>
  6.             <OnFinished>
  7.                 self:GetParent():Hide();
  8.             </OnFinished>
  9.         </Scripts>
  10.     </AnimationGroup>
  11. </Ui>

Lua Code:
  1. local f = CreateFrame("Frame", "TestingFrame", UIParent)
  2. f:SetSize(512, 512)
  3. f:SetPoint("LEFT", UIParent, "LEFT", 150, 100)
  4. f.closeAnim = f:CreateAnimationGroup(nil, "MY_AnimationGroupTemplate")

Code:
TestingFrame:CreateAnimationGroup(): Couldn't find inherited node "MY_AnimationGroupTemplate"
That's what I want to inherit as a test but I just can't get it to work with CreateAnimationGroup.

I will try using CreateAnimation but its a pain since there are 2 Animation types I want to use and seems a shame to have to keep creating separate Animation Groups.

Last edited by Mayron : 06-23-15 at 11:18 AM.
  Reply With Quote
06-23-15, 01:31 PM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
What kinda animation do you exactly want to create?
  Reply With Quote
06-24-15, 08:38 AM   #5
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Originally Posted by Resike View Post
What kinda animation do you exactly want to create?
An animation for a frame which when the close button is pressed it will move up vertically while fading out.
I have created it using the code already posted which works fine except I just couldn't create the Animation Group as a template to be reused with the CreateAnimationGroup function.

Last edited by Mayron : 06-24-15 at 08:41 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Inheriting AnimationGroups?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off