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

What is Framer? Join the Community
Return to index
Johannes Eckert
Posted Aug 13 - Read on Facebook

I am trying to use visibility in states. Just setting the layer's transparency to 0 still makes it capture events. It would be great if the object could also disappear completly. This works on fade-out, but the fadeIn doesn't work.
it looks like boolean attributes are applied at the end of a state change, but when setting them to true (at least for visibility), it would be nice to execute before. I know that I could work around with stateWillChange and stateDidChange, but it would be easier if framer does that for me.
Also, pixate does it this way: When an object is set to 0%, no events are captured. It's clever, but probably not good if you want to use a layer inside a hack.

6 Comments

Chad Lonberger

Not sure how others would approach this, but I think this encapsulates what you mentioned fairly well (and with minimal impact to your existing project). You'll notice the event fired when you click on the red box is disabled after the state switches. Simply add the top snippet to your framer project and call "hardSwitch".

http://share.framerjs.com/kgu4001e2162/

Koen Bok

I could add magic like when visibility is 0, it ignores event unless you change it explicitly.

Chad Lonberger

+1 for this w/ ability to change explicitly ...can't think of any use-cases where I want a layer, or its children, to respond to events if visibility is 0 (other than possibly drag events). Would definitely include touch events also.

Noah Levin

The only time I want that is when I'm drawing big hit targets for touching and dragging. But I wouldn't mind explicitly special casing those. I think Chris Lee has already filed an open issue on github about this at one point

Juan J. Ramirez

Hey! Sorry to revive this conversation, but did this happen? Disabling events on "opacity: 0"? --> Koen Bok

Koen Bok

No. We decided to stick to what browsers do by default over adding more magic here.

Read the entire post on Facebook