This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Kevin Cannon
Posted Apr 27 - Read on Facebook

Is there a way to create objects/classes in Framer? E.g. Have 3 buttons which are instances of a button object?

9 Comments

Mike Feldstein
Kevin Cannon

Thanks. Has anyone got an example of connecting that to Framer for the visual side?

Jordan Robert Dobson

Class Button extends Layer

contstructor:(@options) ->
super @options

@myInstanceVar = {}

myButton = new Button

Jordan Robert Dobson

Hope that helps get you started. 😁

Kevin Cannon

Thanks for the help guys. I've made some progress, but having some trouble with the scope of click events. See the pressed function.

Jordan - I tried extending the Layer class, but that broke it entirely.

http://share.framerjs.com/lf6m4e8tb70t/

Any ideas?

Mike Feldstein

It's a binding problem, "this" in javascript (and coffeescript) is a very confusing thing. Learn about it, but in the meantime just turn all your -> into =>

Kevin Cannon

Mike Feldstein - That's great. It's really a step up for me. Appreciate the help!

Jordan Robert Dobson

Thanks for pointing that out. It's an important one.

Read the entire post on Facebook