开发者

How to draw a highlight around mouse cursor

开发者 https://www.devze.com 2023-01-06 10:59 出处:网络
I\'d like to be able to display a quick animated \"flash\" around the mouse cursor (similar to the effect in some screen-recording applica开发者_如何学Gotions). What would be a good way to go about th

I'd like to be able to display a quick animated "flash" around the mouse cursor (similar to the effect in some screen-recording applica开发者_如何学Gotions). What would be a good way to go about this?

My current idea is to display a temporary, floating, transparent window window under the mouse position, animate it, then hide it. But I'm wondering if there are any better suggestions?


This idea is your best bet. While it's not exactly what you're looking for, my JLNDragEffectManager (morphing images while dragging) demonstrates one approach to the "borderless window following the mouse".

The difference is it looks like you're not interested merely in drag events, but rather "anywhere the mouse is." You can always get the current mouse location by asking NSEvent for the +mouseLocation (given in screen coordinates).


Another option is to use an animated mouse cursor. Then just use [NSCursor set].

I'm not sure how to create an animated cursor though.

When you drag an app from the dock it does the "poof" affect. I think Apple achieved this by creating a borderless window and playing an animation in that window.

0

上一篇:

:下一篇

精彩评论

暂无评论...
验证码 换一张
取 消