ent_blendframe (ENTITY* entity, ENTITY* anim, STRING* scene, var anim_percent, var blend_percent);

Interpolates a frame or skeleton between two animation scenes. The source scene is the current skeleton position or the current frame parameter, which is set by ent_animate. A7.84 LC

Parameters:

entity Entity to be interpolated.
anim Entity that contains the animation scene. For bones animation only; the skeleton of both entities must be identical.
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:

entity.frame new source frame plus interpolation factor.
entity.next_frame new target frame.

Speed:

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

Remarks:

Algorithm:

//vertex scenes only
ent_blend (ENTITY* entity, ENTITY* anim, STRING* name, var anim_percent, var blend_percent)
{ 
  var oldframe = entity.frame; 
  if (fraction(oldframe) > 0.5) { 
    if (entity.next_frame)
      oldframe = entity.next_frame; 
    else 
      oldframe += 1;
  } 
  ent_animatefrom(entity,source,name,anim_percent,0); 
  entity.next_frame = integer(entity.frame); 
  entity.frame = integer(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_animatefrom(me,me,"walk",50,ANM_CYCLE);
ent_blendframe(me,me,"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, frame, pose, ent_blendpose

► latest version online