1. So I finally got my fadeout stuff working. But I found out that when I used IsPlaying() that it returned true after the frame completly fade out.

    Code snippets. Whole addon is 1100 lines.

     FadeOut:SetScript("OnFinished", function(self) self:GetRegionParent():Hide() end)
    

    Bd is a border frame, FadeOutTime is time in seconds. Set to 2 for testing.

       local Ag = Bd:CreateAnimationGroup()
       local FadeOut = Ag:CreateAnimation("Alpha")
       Ag:SetLooping("NONE")
       FadeOut:SetOrder(1)
    

    -- Set the fade time in seconds. FadeOut:SetDuration(UnitBars.FadeOutTime) Show/hide code

     local function HideUnitBar(UnitBarF, HideBar)
       local FadeOut = UnitBarF.FadeOut
       if HideBar and not UnitBarF.Hidden then
           print("hide ", UnitBarF.BarType)
         if UnitBars.FadeOutTime > 0 then
           -- Fade the unitbar out then hide it.
           FadeOut:SetChange(-1)
           FadeOut:Play()
           UnitBarF.Hidden = true
         else
           UnitBarF.Border:Hide()
         end
       else
      -- If we're in a vehicle and the hide in vehicle flag is set then don't show.
         if InVehicle and UnitBarF.UnitBar.HideInVehicle then
           return
         end
         if not HideBar and UnitBarF.Hidden then
           -- Show the unitbar then fade it in.
           print("show ", UnitBarF.BarType)
           if FadeOut:IsPlaying() then
             FadeOut:Stop()
             print("STOP ANIMATION")
           end
           UnitBarF.Hidden = false
           UnitBarF.Border:Show()
         end
       end
     end
    

    So for testing I pick a target and my target frames get shown. Then select no target they fade out perfectly. Then I pick a new target, and IsPlaying() returns true. WowWiki is helpful, but without seeing actual easy to understand code examples it takes guessing on some things. Things like if I create two animations they both play instead of being able to play one or the other. Stuff like that.

    Well the first thing is you're playing the animation itself instead of the animation group. Organize your animations into sequences (AnimationGroups) and then use the animation group interface to work with them. Also it's not clear to me from this code example what is being hidden and when. It's a bit difficult to diagnose out of context, not that I have time to go through 1100 lines of code either =).

    Well the first thing is you're playing the animation itself instead of the animation group. Organize your animations into sequences (AnimationGroups) and then use the animation group interface to work with them. Also it's not clear to me from this code example what is being hidden and when. It's a bit difficult to diagnose out of context, not that I have time to go through 1100 lines of code either =).

    Well its pretty simple. The mod can show 5 different bars.

     bar1 Health bar
     bar2 power bar
     targetbar1 health
     targetbar2 power
     mainpower. 
    

    Instead of hardcoding this to druid. I wrote the code to detect a form change on the class. So for druid mainpower is mana that only gets displayed if the powertype is not equal to mana.

    Anyway if you change a target the target bars get hidden, mainpower can hide/show as well. The idea behind checking if the animation was still playing was that if the fade animation started, but then the bar got shown before it completed. So you would want to know if its still playing to do a stop. I could of done a stop anyway but felt it was better practice to check first.

    So if you're suppose to use the animationgroup to play, why does the animation have play as well? So if I wanted to add fadein to this I would have to create a second animationgroup instead of a second animation?

    so something like this

     AGfadein = borderframe:CreateAnimationGroup()
     AGfadeout = borderframe:CreateAnimationGroup()
    
     fadein = AGfadein:CreateAnimation("ALPHA")
     fadeout = AGfadeout:CreateAnimation("ALPHA")
    

    instead of doing this

     AG = borderframe:CreateAnimationGroup()
     fadein = CreateAnimationGroup("ALPHA")
     fadeout = CreateAnimationGroup("ALPHA")
    

    I tried the second example and found that both animation play one after the other. Oh I see you would create a string of animations to do say a flash. Ok I think I just answered my own question on this one. Still not sure why animation would have play() when you can do it thru the AG:Play() instead.

    It's just a hypothesis, I'm just saying how I've normally used animations in the work I've done.

    Hi, I recently started using animations and had the same problem. IsPlaying() and other operations like the one for checking for far along the animation is would all return unexpected values.

    The solution (for me) was to specifically call :Stop() on the animation group within the OnFinished handler.

    I know that sounds stupid, and I don't know whether it's by design or not. All I know is that I would have expected that when the animation group finished it "resets" itself. But it doesn't seem to.

    Again, trying calling Stop yourself for the animation in the OnFinished handler.

    And yeah, play the animation groups not the animations :)