 handleAnimation = ->
   if not isPlaying then return false
 
-  lastModel = executeCode()
-
-  editors.modelEditor.setValue(JSON.stringify(lastModel.data, null, 4))
+  currentModel = executeCode()
+  currentFrame++
+
+  editors.modelEditor.setValue(JSON.stringify(currentModel.data, null, MODEL_FORMATTING_INDENTATION))
   # The new contect will be selected by default
   editors.modelEditor.selection.clearSelection() 
 


spinner = new Spinner(SPINNER_OPTS)

lastModel = new GE.Model()
currentFrame = 0
currentModelData = null
currentAssets = null

  catch error
    return showMessage(MessageType.Error, "<strong>Model error.</strong> #{error}")

  currentModel.atVersion(currentFrame).data = currentModelData

  try
    currentActions = eval(editors.actionsEditor.getValue())
  catch error
