You can achieve this by calling Framer.CurrentContext.reset()
and rebuilding your prototype.
To make this easy, write all your setup code inside a function that you call after resetting the context. Remember to also call the setup()
function for the initial setup.
Example:
setup = ->
# Everything should go inside the setup() function
layerA = new Layer
backgroundColor: 'green'
layerA.animate
properties:
x: Align.right
resetButton = new Layer
x: Align.center
y: Align.bottom
backgroundColor: 'red'
resetButton.onClick ->
Framer.CurrentContext.reset()
#Call setup() again to recreate all layers
setup()
# Initial setup call
setup()
Full prototype here: http://share.framerjs.com/9fl1g7icvnax/