Skip to content

Instantly share code, notes, and snippets.

@andrewliebchen
Last active December 8, 2017 23:36
Show Gist options
  • Save andrewliebchen/7dceed3328f2f16c8ab38868ea665ffa to your computer and use it in GitHub Desktop.
Save andrewliebchen/7dceed3328f2f16c8ab38868ea665ffa to your computer and use it in GitHub Desktop.
FramerJS FlowComponent router
class Router extends FlowComponent
constructor: (props) ->
@_props = props || {}
super _.defaults props,
name: 'Provider'
@define 'current',
get: -> @_props.current
set: (current) ->
print current
if @flow and current then @showNext current
pages = []
pageNames = ['page 1', 'page 2', 'page 3', 'page 4']
router = new Router
for i in pageNames
@page = new Layer
html: i
backgroundColor: Utils.randomColor()
height: Screen.height
width: Screen.width
pages.push @page
router.props =
pages: pages
current: pages[0]
router.current = pages[3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment