如何在鼠标光标周围绘制突出显示
我希望能够在鼠标光标周围显示快速的动画“闪光”(类似于某些屏幕录制应用程序中的效果)。解决这个问题的好方法是什么?
我当前的想法是在鼠标位置下显示一个临时的、浮动的、透明的窗口窗口,为其设置动画,然后隐藏它。但我想知道是否有更好的建议?
I'd like to be able to display a quick animated "flash" around the mouse cursor (similar to the effect in some screen-recording applications). 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个想法是你最好的选择。虽然这不完全是您要找的,但我的 JLNDragEffectManager (拖动时变形图像)演示了一种“跟随鼠标的无边框窗口”的方法。
不同之处在于,您似乎不仅仅对拖动事件感兴趣,而是对“鼠标所在的任何位置”感兴趣。您始终可以通过向 NSEvent 询问 +mouseLocation(以屏幕坐标给出)来获取当前鼠标位置。
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).
另一种选择是使用动画鼠标光标。然后只需使用[NSCursor set]即可。
但我不确定如何创建动画光标。
当您从扩展坞拖动应用程序时,它会产生“噗”的效果。我认为苹果通过创建一个无边框窗口并在该窗口中播放动画来实现这一目标。
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.