 
 class NodeAnimation
   constructor: (@node, @destpos, @duration) ->
-    @origpos = {x: @node.x, y: @node.y}
+    @origpos = null
 
   setPosition: (time) ->
+    if @origpos == null
+      @origpos = {x: @node.x, y: @node.y}
+
     pos = lerp2d(time/@duration, @origpos, @destpos)
     @node.move(pos.x, pos.y)
 


    return new CollectionAnimation(anims, t)

  makeMove1Anim: ->

  sortNodes: (compare, t) ->
    anims = []
    anims.push(@makeLineupAnim(default_node_radius, .1, t))

    #oldnodes = @nodes.slice(0) # clone
    #newnodes = []
    #while oldnode.length > 0

    @animations = @animations.concat(anims)


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