can an animation be blended between two frames?

can an animation be blended between two frames?

I need to be able to pause an animation at a precise frame or fraction of the way through the animation. I have been able to do this, for example to pause the animation 20% of the way through I do something like,

framefrac = 0.20;

animation["someanim"].enabled = true;
animation["someanim"].weight = 1.0f;				
animation["someanim"].time = framefrac*animation["someanim"].length;
animation["someanim"].speed = 0; //to make the animation pause

What I also need to do is blend between two frames and pause the result. How would I, for example show a frame which is blended between 20% of the way through “someanim” and 70% of the way through “someotheranim”

Thanks in advance for your help (am new to Unity)


Time and weight are 2 completely different things in the Unity animation system.
While time is obvious, think of weight as how much of this do I want.

If you have 2 animations, weighted at 0.2 and 0.8, then one animation will have 20% influence on the bones, while the other one will have 80% influence.
Weights should always add up to 1 (or things start breaking)

If you want 2 animations, “blended” at 30:70 and at certain times:

var animation1:String;
var animation2:String;

var animation1Time:float;
var animation2Time:float;

var animation1Weighting:float;
var animation2Weighting:float;

function Start() {
    //Enable animations
    animation[animation1].enabled = true;
    animation[animation2].enabled = true;
    //Pause animations
    animation[animation1].speed = 0;
    animation[animation2].speed = 0;
    //Set the time of the animations
    animation[animation1].time = animation1Time;
    animation[animation2].time = animation2Time;

    //Set weighting of the animations
    //Since you seem to like percentages, I normalized the values as well
    //Just in case you use 20:70
    var magnitude:float = (animation2Weighting + animation1Weighting);
    animation[animation1].weight = animation1Weighting/magnitude;
    animation[animation2].weight = animation2Weighting/magnitude;

Hope this helps,