A question that regularly pops up in the Framer community is how to use Framer if you’re using a PC. Currently, Framer Studio is only available on a Mac but the Framer.js framework, that powers Framer Studio, is free and open source. That means if you’re using Windows, Linux or on a Mac but still on the fence about purchasing Framer Studio, you can still create Framer prototypes.
For most of us, we want to do as little configuration as possible — that’s where Atom comes in.Atom is a free, text editor from GitHub that’s modern and customizable to do almost anything without ever touching a config file.
Keep in mind is that Framer.js is written in JavaScript. Because Framer Studio uses theCoffeeScript programming language, which has a slightly different syntax that eventually gets compiled down to JavaScript, the majority of the Framer prototypes and examples you’ll see will be written in CoffeeScript. If you wanted to learn from any of these examples, you would need to first convert the code to JavaScript to run with Framer.js.
With a few simple steps, Atom takes care of that for us so we’ll be able to create Framer prototypes using CoffeeScript and preview them on our PC, Linux, or Mac machine. Let’s get started:
1. Download and install Atom
Go to the Atom website and look for the button to download. The button should be specific for your platform.
- If you’re on a Mac, you’ll download a zip file. Simply unzip it, move it to your Applications folder and run Atom
- If you’re on a PC, run the installer and then open Atom
- If you’re on Linux, download and install the Debian package or RPM package
2. Install Packages
When you launch Atom for the first time, you should see a welcome guide.
Click on the “Install a Package” button on the right pane and then Open Installer.
The Install Packages screen should appear. If the future, you can also access this Settings screen through Preferences and then the install tab.
Search for the “coffee-compile” package and install it. This allows you to save your CoffeeScript file in the editor and it will convert it to Javascript. You may notice there are a few different packages that come up in the search results that do the same thing – these should work as well but I haven’t tested all of them.
Search for the “atom-html-preview” package and install it. This allows you to get a live preview when you make changes to the code.
If you click the Packages tab, you should now see your 2 new installed packages under the Community Packages section.
3. Update Package Settings
If you installed the coffee-compile package, click the Settings button and check the “Compile on Save without Preview” option. This will automatically compile the file when you save and not show you the JavaScript.
4. Download the Framer.js Starter Template
You can download the template here or by going to the Get Started section of the Framer.js GitHub page and clicking the download link.
Once downloaded, unzip the file and open up the Framer folder.
Framer Generator is an application for Mac that comes bundled with Framer.js. It allows you to import layers directly out of Photoshop and Sketch files into your Framer projects . This feature is built into Framer Studio.
Let’s look at the files in the project folder in more detail:
- /framer/framer.js — This is the JavaScript file that powers the interactions and animations you are able to create for your prototypes. You shouldn’t be touching this file unless you want to replace it with a newer version.
- /framer/framer.js.map — This is a SourceMap file. It maps the code within a compressed file back to it’s original position in a source file to allow you to debug code for compressed file. You don’t need to worry about it and like the framer.js file, you don’t want to touch this file either.
- /images/background.png & /images/icon.png — The icon image is used in the default prototype and the background image is just a black background that is specified in the CSS.
- app.js — Here’s where you would write your JavaScript code for your prototypes. We’ll be writing CoffeeScript code that will generate this app.js file for us.
- index.html — Open this file in a WebKit browser — such as Google Chrome or Safari to view your prototype. If you look at it, it includes the framer.js and app.js file that we looked at earlier.
5. Open up the Project folder in Atom
Go to File – Add Project Folder and open up the Framer Project folder template.
6. Rename app.js to app.coffee
Right-click on the app.js file and then select rename.
Change the file extension from .js (JavaScript) to .coffee (CoffeeScript).
7. Write your CoffeeScript code
Delete the code that is in app.coffee since it’s in JavaScript. You can now write your CoffeeScript code in the file. If you’re not sure where to start, copy and paste the following example code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# Prototyping with Framer
# Create a background
new BackgroundLayer backgroundColor: “#151517”
# Create a layer with the Framer logo
logo = new Layer
width: 128
height: 128
image: “images/icon.png”
logo.center()
# Create additional states (the original state is ‘default’)
logo.states.add
second:
y: 200
scale: 1.5
rotation: 225
third:
y: 300
scale: 0.5
blur: 25
# Create a spring animation
logo.states.animationOptions =
curve: “spring(250,25,0)”
# Animate to the next state on click
logo.on Events.Click, ->
logo.states.next()
|
Save your file when you’re done writing your code and you should see an app.js file appear in your project folder.
8. Preview your Prototype
Click the index.html file in the sidebar and then go to Packages – Preview HTML – Enable Preview
You should now see your Framer prototype that you can interact with on your Windows machine.
Note that although there is a live preview, updating the app.coffee file doesn’t trigger a refresh. You’ll need to make your updates to app.coffee, save it to generate a new app.js, and then in your index.html file, make a change – such as adding a return to one line or deleting a blank line. The prototype will then refresh with your newest code.
Now that you’re able to use Framer on Windows, I can’t wait to see what prototypes you come up with. If Atom isn’t your style, you can also check out a Framer video I did as part of my Rapid Prototyping with Framer course for O’Reilly where I also show you how you can use Framer with another text editor, Brackets, as well as with online code editors like CodePen.
In my personal opinion, if you’re on a Mac and plan on using Framer past the trial period,Framer Studio is well worth the price for the amount of time you’ll save with features like easily creating new projects, instant visual feedback, inline error checking, code completion and much more.
Do you have any tips or additional questions for using Framer on Windows? Let me know with a comment below or share your thoughts with me on Twitter (@kennycheny).