     name: 'sort by weight',
     action: (c, t) ->
       console.log('sort by weight')
-      c.sortNodes( ((n1, n2) -> n2.value - n1.value), t)
+      c.addAnimations(c.sortNodes( ((n1, n2) -> n2.value - n1.value), t))
   },
   {
     name: 'Shannon-Fano',

    len: (x: default_node_radius*4, y: default_node_radius*2)

  copyNodesFrom: (nc) ->
    @nodes = [
      new ShannonFanoNode(nc.nodes, @shape, @defaultBBoxAt((x:100,y:100)), "") ]



    @nodes = newnodes

    return anims

  addAnimations: (anims) ->
    @animations = @animations.concat(anims)

class HuffmanNodeCollection extends NodeCollection
  constructor: (shape) ->
