Additional code for keyframe interpolation