ent_blend (STRING* scene, var anim_percent, var blend_percent);

Interpolates the my model entities' frame or skeleton between two animation scenes. The source scene is the current skeleton position or the current my.frame parameter, which is set by ent_animate.

Parameters:

scene Target animation scene name, without the trailing number; STRING* or char*
anim_percent Percentage within the target scene, 0..100
blend_percent Blending percentage between previous and new scene, 0..100

Modifies:

my.frame New source frame plus interpolation factor (sprites or vertex scenes only)
my.next_frame New target frame (vertex scenes only)

Speed:

Medium (for vertex frames).
Slow (for bones frames).

Remarks:

Edition:

 C   P  for bones scenes only. Vertex scenes can be blended with all editions.

Algorithm:

//emulation by C-Script, vertex scenes only
ent_blend (name, anim_percent, blend_percent)
{ 
  var oldframe; 
  oldframe = my.frame; 
  if (frc (oldframe) > 0.5) { 
    if (my.next_frame)
      { oldframe = my.next_frame; } 
    else 
      { oldframe += 1; } 
  } 
  ent_cycle (name, anim_percent); 
  my.next_frame = int (my.frame); 
  my.frame = int (oldframe) + blend_percent*0.01; 
}

Example:

//Sets the entity to a vertex frame within 50% of the walk cycle,
//and then blends over to the first frame of the stand cycle.
ent_cycle("walk",50);
ent_blend("stand",0,25);
//The result of this code is a frame mixed from 75% of the middle 
//of the "walk" cycle and 25% of first frame of the "stand" cycle.

See also:

ent_animate