ReactiveCocoaLayout icon indicating copy to clipboard operation
ReactiveCocoaLayout copied to clipboard

Automatically enable layer-backing during an animation

Open jspahrsummers opened this issue 11 years ago • 8 comments

Animations are noticeably smoother when a view is layer-backed.

RCL could automatically enable layer-backing on NSViews when any property managed by the framework (like rcl_frame) is animated as part of a signal chain, and then disable layer-backing for all such views once the animation completes.

jspahrsummers avatar Dec 23 '12 06:12 jspahrsummers

I have a small concern with this. If this was done with views containing text fields, they would change their appearance slightly during the transition, especially on 10.7. Will this be an option, or will it be enforced?

jwilling avatar Dec 23 '12 23:12 jwilling

It could be a variation of the -animate… methods, maybe. But it's also worth noting that animations are generally smooth enough to where any small visual differences would go unnoticed, while a choppy animation is quite noticeable.

jspahrsummers avatar Dec 24 '12 00:12 jspahrsummers

For implementation: it looks like a call to -display is necessary immediately after enabling wantsLayer if you want the animation to begin immediately afterward (and not after one run loop iteration).

jspahrsummers avatar Dec 25 '12 02:12 jspahrsummers

Yup, that is correct. I think we've all come across the email thread from @joshaber.

alanjrogers avatar Dec 25 '12 05:12 alanjrogers

@alanjrogers That's actually not what the @joshaber of old recommended, but what we do in GHfM today. I can only assume he recognized the error of his ways.

jspahrsummers avatar Dec 25 '12 05:12 jspahrsummers

ah I was thinking of a SO question answered by @joshaber . Although I can't find it now :(

alanjrogers avatar Dec 25 '12 05:12 alanjrogers

Something to consider is that in OSX 10.9, NSViews will be layer backed by default just like their iOS counterparts. (normally I'd post a source link here, but I can't find one at the moment. So take this comment as apocryphal, I suppose.)

zakdances avatar Oct 18 '13 09:10 zakdances

@zakdances As much as I wish that were the case, that's simply not true. That would break far too many apps to be viable. They did make layer-backed improvements under 10.9, but it's not the default.

jwilling avatar Oct 18 '13 16:10 jwilling