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

What is Framer? Join the Community
Return to index
John Anthony Evans
Posted Dec 05 - Read on Facebook

I'm looking to use the animator to animate an arbitrary property that framer doesn't understand. E.g.

myLayer.animate
properties: {angle:200}

How can I go about doing that?

6 Comments

Mike Feldstein

You may want to look into Object.defineProperty. I'm not sure if it will work with framers animator but its a way to define a property that runs a function when it is set.

John Anthony Evans

I found that, and I can use the @emit to broadcast that change, just struggling to decode how the animator part works...

Mike Feldstein

Non-standard properties may be filtered out, see https://github.com/koenbok/Framer/blob/master/framer/Animation.coffee#L193

Make sure angle has a starting value (of 0 or something)

John Anthony Evans

Got it to work. Well got something to work, not super happy with it. For reference it's here.

https://gist.github.com/johnanthonyevans/68379b4c2e97aa0eca28

Mike Feldstein

Something i like to do is to default properties to 0 (if that's the proper default) so in my getter i'll say "get: -> @_angle || 0"

John Anthony Evans

Ah yes. Thanks for the hint.

Read the entire post on Facebook