WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Inheriting AnimationGroups? (https://www.wowinterface.com/forums/showthread.php?t=52395)

Mayron 06-23-15 08:05 AM

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 :)

Resike 06-23-15 10:43 AM

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

Mayron 06-23-15 11:07 AM

Quote:

Originally Posted by Resike (Post 309289)
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.

Resike 06-23-15 01:31 PM

What kinda animation do you exactly want to create?

Mayron 06-24-15 08:38 AM

Quote:

Originally Posted by Resike (Post 309299)
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.


All times are GMT -6. The time now is 08:15 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI