tisho / framer-templates

Presentation templates for your Framer.js prototypes.
191 stars 8 forks source link

Framer Presentation Templates

Features

Usage

  1. Download a template file from templates/ that matches your needs and place it in your prototype's main directory. Here's the list of all currently available templates:

  2. Open your index.html in a text editor and link to the template using a <script> tag. The template should be included after the framer.js script:

    <script src="https://github.com/tisho/framer-templates/raw/master/framer/framer.js"></script>
    <script src="https://github.com/tisho/framer-templates/raw/master/framer/framerps.js"></script>
    <script src="https://github.com/tisho/framer-templates/raw/master/app.js"></script>
    
    <!-- Link to the template script: -->
    <script src="https://github.com/tisho/framer-templates/raw/master/iphone-5s-white.js"></script>
  3. Load index.html in a browser. You should see your prototype appear inside the presentation template.

Usage with Framer Studio

  1. Download one of the templates and place it in the folder of your project, under framer/.

  2. Put this at the top of your script:

    Utils.domLoadScriptSync('framer/iphone-5c-blue-landscape.js')
  3. Choose the Fullscreen option in the Preview pane, so you don't get the "phone in a phone" effect.

Installing with Bower

You can use bower to install and keep the templates up to date:

bower install framer-templates

All of the available templates will be installed to bower_components/framer-templates/templates.

A Note on Compatibility

The presentation templates are fully compatible with Framer 3. You can still download the old, Framer 2 compatible version of the templates from here: Download Framer 2 Templates.

If you're upgrading from a Framer 2 template, everything should work as expected by just replacing the template file. If you've used the config.template = { ... } syntax to customize the appearance of your template, you should change it to Framer.Config.template = { ... }.

Setting the Background Image

The default background image is a plain off-white color, but if that's not to your tastes, you can use your own by specifying it as a template option before you load the template:

<script>FramerTemplateConfig = { backgroundImage: '[url to your background image]' };</script>
<script src="https://github.com/tisho/framer-templates/raw/master/iphone-5s-white.js"></script>

"Add to Homescreen" Prompt

The templates have built-in capability for reminding users that view your prototype inside a mobile browser to add it to their homescreen for a more app-like experience. This feature is off by default, but you can turn it on like this:

<script>FramerTemplateConfig = { shouldShowAddToHomescreenPrompt: true };</script>
<script src="https://github.com/tisho/framer-templates/raw/master/iphone-5s-white.js"></script>

Tips

Building Your Own Template

All templates use the same basic code, but vary in configuration, depending on which device you want to use to present your prototype. Here's what the configuration file for the white iPhone template looks like:

{
  "backgroundImage": "",
  "shouldShowAddToHomescreenPrompt": false,
  "deviceWidth": 385,
  "deviceHeight": 805,
  "screenWidth": 320,
  "screenHeight": 568,
  "contentWidth": 640,
  "contentHeight": 1136,
  "cursorWidth": 32,
  "promptAnchorTop": 704,
  "promptAnchorLeft": 320,
  "addToHomescreenPromptImage": "images/addtohomescreen-prompt-iphone.png",
  "deviceImage": "images/iphone-5s-white.png",
  "cursorImage1x": "",
  "cursorImage2x": ""
}

Let's go over the different attributes:

Note: All image paths are automatically converted to data URIs, so that the template is self-contained.

To create your own template, copy one of the config-*.json files, edit the configuration values in there and then run:

npm install
cake build

You should see something like this:

clean Cleaning out templates directory...
build Using src/config-ipad-mini-black.json to generate templates/ipad-mini-black.js
build Using src/config-ipad-mini-white.json to generate templates/ipad-mini-white.js
build Using src/config-iphone-5c-blue.json to generate templates/iphone-5c-blue.js
build Using src/config-iphone-5c-green.json to generate templates/iphone-5c-green.js
build Using src/config-iphone-5c-red.json to generate templates/iphone-5c-red.js
build Using src/config-iphone-5c-white.json to generate templates/iphone-5c-white.js
build Using src/config-iphone-5c-yellow.json to generate templates/iphone-5c-yellow.js
build Using src/config-iphone-5s-black.json to generate templates/iphone-5s-black.js
build Using src/config-iphone-5s-gold.json to generate templates/iphone-5s-gold.js
build Using src/config-iphone-5s-white.json to generate templates/iphone-5s-white.js
build Using src/config-nexus-5.json to generate templates/nexus-5.js

All done. Have a nice day!

The newly generated template will appear under the templates/ directory.

Thanks & Acknowledgements