Last active
December 8, 2017 23:36
-
-
Save andrewliebchen/7dceed3328f2f16c8ab38868ea665ffa to your computer and use it in GitHub Desktop.
FramerJS FlowComponent router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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