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

What is Framer? Join the Community
Return to index
Keyur Jain
Posted Jul 27 - Read on Facebook

Hello All! I got into framer a couple of days ago, and its been super fun to work with. Stumbled up an issue with functions and if condition today and wondering if anyone had some advice. Here's some description:

the goal of this prototype are two things:
a. the circular button 'changes state' when the alignment pointers are under the light square
b. on pressing the button, the light square should light up

the issue I am having is to have the button press event happen only when the previous conditions are met, and ignore clicks other wise.

any thoughts how to solve them. and I'd really appreciate some tips, if other improvements can be done other wise! Danke!


Jordan Robert Dobson

Probably want to remove the onClick from inside of the onMove. It gets added every move. So you could have millions of onClick event handlers.

Keyur Jain

Thank Jordan
I agree, but I havent yet learned how i could go about bringing the value of pointer.x outside the onMove function.. any pointers for that?

Peter Gr

Maybe you could structure it this way:

button.onClick ->
- if pointerA is in the right place (is that a slider?)
-- if pointerB is in the right place
--- light up the square

Jordan Robert Dobson

Here's a way you can separate out your checks and work with states a little better:

Jordan Robert Dobson

👆 Is that helpful at all Keyur Jain?

Read the entire post on Facebook