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

What is Framer? Join the Community
Return to index
Giovanni Caruso
Posted Nov 28 - Read on Facebook

Hi, guys! I'm playing with custom class but something isn't working as expected. I've extended the layer class to compose the main UI of the prototype and used the Utils.modulate() to update the position of a children layer ("moveY" is the custom property I've created).
I've printed the value and everything seems ok to me, but layers aren't moving at all. Here is the code: http://share.framerjs.com/alawzg74iju9/

2 Comments

Monir Abu Hilal

In the "whClass.coffee" file, the "moveY" value was read only once when the "Balloon" class is constructed.

There was no way to monitor the "moveY" value change to update the "y" property of the "homeImage" layer, so that's why the image was not moving.

By defining "moveY" as a Property, you will be able create a property setter method that notifies/emits a "moveY" property change event, then in the class constructor you can listen to the on "change:moveY" event and update the "homeImage.y" property accordingly.

Check out the fix here:
http://share.framerjs.com/a1of5tw37n2g/

I added comments in the "whClass.coffee" to show the code changes.

Now you just need to tweak the calculations. :)

Giovanni Caruso

Hey Monir, thank you so much for the help. I'll dig into to the code you've fixed for me. That was my very first play with custom classes in Framer. I definitely have to spend more time on this to improve my understanding of the whole concept :D Thank you again!

Read the entire post on Facebook