Skip to content

Connecting Two Prototypes Using Framer Studio & Firebase

An account of how I connected two Framer prototypes using Framer Studio & Firebase to create a virtual light bulb and switch.

Mac OS X screen showing two Framer prototypes and a separate Google Chrome browser window for the Firebase database used in the prototypes.

Overview

I recently worked on a UX project where we prototyped a big-screen app for a UK TV channel. To provide a realistic user experience, the prototype was controlled via a TV remote (and not a mouse).

Although this prototype wasn’t built using Framer, it did inspire me to see if I could test my Framer skills and develop a simple, ‘connected’ prototype.

Framer Studio & Firebase

I scoured Medium, and as you would expect, a few people had tried something similar. Several articles demonstrated how you could use Firebase with Framer to bring your prototypes to life with ‘real data’.

More interestingly, you could also use it to maintain state. This was exactly what I needed to bring my prototype to life.

Prototype Functionality

My project consisted of two simple Framer prototypes. The first, a light switch and the second, the light bulb itself. The light can be toggled on/off remotely by the switch.

Framer Studio interface showing the code view, layer inspector and device preview for the light switch prototype.

Framer Studio interface showing the code view, layer inspector and device preview for the light bulb prototype.

Logic

I downloaded Marc Krenn’s Firebase module and I connected both Framer prototypes to Firebase.

Firebase interface in Google Chrome showing the realtime database and it's data fields.

I then stored the current state of the light (off=0, on=1) in Firebase. This allowed Framer to monitor the current state and ‘remember’ whether the light is on or off.

For both prototypes, I set up single layers with two states. Each has its own image to represent on/off.

For a bit of fun I also downloaded the Framer AudioPlayer Module by Benjamin den Boer and searched for some light switch/bulb sounds that would be triggered when the state changed.

When the user presses the light switch it animates the layer state, plays the appropriate sound and then sends the inverse value back to Firebase and the light bulb ‘reacts’ and turns itself on/off.

Prototype Video Walk-through

Framer London Meetup

In the spirit of learning and sharing, I recently walked the Framer London Meetup group through my connected prototypes.

Presenting my Framer Firebase prototypes at a recent Framer London Meetup at UsTwo, London

Photo by Rhys Merritt

Concluding Thoughts

Although this is an overly simple use case. It demonstrates how you can connect two prototypes using Framer and Firebase to maintain state. I had fun creating it and learned a little more about CoffeeScript and Framer along the way.

Feel free to download the Framer source code and reuse in your project.


Also published on Medium.


Share This Article

If you enjoyed this blog article, then let others know about it by sharing it.