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

What is Framer? Join the Community
Return to index
Charles Shin
Posted Dec 07 - Read on Facebook

How can I add an event listener to a value change specifically for numbers? Say x = 20 and I have a button that changes x = 40. How would I capture that event? (Not for TextLayers, specifically integers)

9 Comments

Lukas Guschlbauer

layer.on „change:x“ ->

Oleksii Pishtar

create only function that changes your x so you can know when it changes?

Ian McClure

Layer.on “change:x”, ->
I think.

Charles Shin

but that's just catching the x-value change right? screenshot below to explain better:

Lukas Guschlbauer

Oh! So not the property „x“ but the change of the value of a variable called x 🤦‍♂️

Hm. So maybe really a function? Or a custom event emitter.

Charles Shin

Yea :/ "change:x" only applies to layers as well, not variables.

Aalok Trivedi

you can write a function to check if num is 0 or not and turn on visibility based on that. My code isn't the best, so I'm sure there's a cleaner way to do this https://screencast.com/t/QH5sVCju5f0

Charles Shin

thanks! :)

Alan Travis

https://m.facebook.com/groups/385961098197634?view=permalink&id=1327940190666382

That's what you're after there... The code snippet in Steve Ruiz Cyclops code will allow you to have custom events for any parameter...

Read the entire post on Facebook