Animation blending

Am I right to write animation blending as something like this (pseudocode)?

class character:
      def __init__(self)
           load model
           load animation01
           load animation02


      def Animate(self, time)
           weight = time/anim_time

           model.setControlEffect('animation1', weight)
           model.setControlEffect('animation2', (1.0-weight))
           model.loop('animation1')
           model.loop('animation2')
           

This looks like the right idea to me.

David