What format are you using for your engine? Component entity? Inheritance Tree?
For my engine I solve the game state/ loop problem using systems that update components which could be attached to entities...
So for animation.. I have an animation component that can be attached to entities - this component contains a pointer to the actual animation data (each set of animation data can contain a number of animations (run, walk, jump etc) and for each animation there is a map of hashed bone string names to the bone channel data)
This animation component allows you to set the current animation, or animations if blending is enabled.. then the update function of that component checks if an "animate" flag is true and if it is it fills a vector of bone transforms based on the time passed in the update function.. the component also has a flag that tells whether the animation should loop or not... if looping is set to true then as long as animate is true it will keep filling the vector with new final bone transforms.. if looping is false it will set the animate flag to false once the animation has reached its duration
The "AnimationSystem" is then in charge of setting all the necessary variables in the animation components based on scripting/input etc and also in charge of updating the components...
How does an animation component know how long it should play if its not set to loop? Well what I do... is in the AnimationData that the animation component points to I store the duration of the animation in ticks, and then I store the speed of the animation in ticks per second. Then in each bone channel, I store each keyframe quaternion/scaling vector/translating vector with its tick value...
To get a specific bone transform first I get the current "tick" value by doing
currenTick = currentTime*ticksPerSecond
And now you have a tick value that will likely be between two of your bone channel keys... so you use this tick value to do your interpolation between the keys
And you can also test this tick value to see if it is over the animation's duration in ticks... if the animation shouldn't be looping you can check this and set the "animate" flag to false if the currentTick value is > durationInTicks (I actually use the AnimationSystem to do this check and change the value)
Why use ticks? because you can then slow down and speed up an animation (and the duration will change accordingly) simply by changing the "ticksPerSecond" variable and thats it.. a lot easier than storing absolute time values for duration and bone keys etc..
Then handle all animation switching in the AnimationSystem which can switch entitie's animations based on input or based on anything you need really... If you want a button to play cast a spell animation you might check the InputComponent and see if it says to cast a spell... Then you might have an InputSytem that sets the InputComponent values based key presses and rules (ie maybe the player can only cast a spell when it has a target selected) etc...
This works really well for the component type of system...
I'm not sure if this was what you were having a hard time with or not but I hope it helped somehow!