Use conventions to name your Sketch layers and Framer Navigation will add navigation to your Framer.js prototype automagically.
- Open your Framer Studio project folder (e.g. "myapp.framer")
- Add framer-navigation.js to the
framersubfolder. - Open
index.htmland add<script src="framer/framer-navigation.js"></script>after the line<script src="framer/init.js"></script>. - In Framer Studio, after importing your layers, call initialize:
layers = Framer.Importer.load "..."
Framer.Navigation.initialize layers
Note: Framer Navigation assumes screen layers (or artboards) are given a name ending in 'Screen'.
Clicking on a layer with a name ending 'Goto [X]' will slide in layer [X]. For example, clicking 'Button Goto Cart Screen' will slide in 'Cart Screen'.
Clicking on a layer with the name 'Back Button' will slide back in the previous screen. (A history stack is kept so you can go back repeatedly).
Clicking on a layer with the name 'Hamburger' will slide in a layer named 'Hamburger Drawer'. Clicking outside of the hamburger drawer will close it.
The above behaviours are built from the functions everyLayer and onClickSlideTo, and you can use them directly to build your own custom behaviour. See the Framer.Navigation.setup[...] functions for examples.
- Add an issue, or email chris@penrosestudio.com