Displaying a custom animation at the click location on Windows 10 in response to an event
Solution 1
I have an AutoHotkey script that generates this effect, although I haven't tested it on Windows 10 yet--I assume it will work there also. I wanted the same functionality for showing automated mouse-click events. I have posted my full source code here for you to try/use/modify and see if it works for you.
The script generates the animation from scratch (vs. showing an SVG or GIF file), by means of drawing concentric circles out from the point that was clicked on. This allows adjustment of the concentric rings, color selection, fade rate, size, thickness, etc. Those variables are currently hard-coded but are grouped together if you'd like to play with the appearance of the animation. It is not quite as polished as the SVG you show because the circles drawn aren't anti-aliased, but the effect is the same.
Getting the script to run requires some basic knowledge of getting AutoHotkey up and running as well as downloading the GDIP library and dropping it in the same folder as the script. Leave a comment if you have any issues trying it out.
Solution 2
Here is another simple AHK script.
- Doesn't require any external libraries.
- Works smoothly on Windows 10.
- Can easily edit ripple parameters within script.
Original author: https://www.autohotkey.com/boards/viewtopic.php?t=8963
#NoEnv
CoordMode Mouse, Screen
Setup()
~LButton::ShowRipple(LeftClickRippleColor)
~RButton::ShowRipple(RightClickRippleColor)
~LControl Up::ShowRipple(MouseIdleRippleColor)
Setup()
{
Global
RippleWinSize := 50
RippleStep := 2
RippleMinSize := 5
RippleMaxSize := RippleWinSize - 20
RippleAlphaMax := 0xff
RippleAlphaStep := RippleAlphaMax // ((RippleMaxSize - RippleMinSize) / (RippleStep*1.0))
RippleVisible := False
LeftClickRippleColor := 0xff0000
RightClickRippleColor := 0x0000ff
MouseIdleRippleColor := 0x008000
DllCall("LoadLibrary", Str, "gdiplus.dll")
VarSetCapacity(buf, 16, 0)
NumPut(1, buf)
DllCall("gdiplus\GdiplusStartup", UIntP, pToken, UInt, &buf, UInt, 0)
Gui Ripple: -Caption +LastFound +AlwaysOnTop +ToolWindow +Owner +E0x80000
Gui Ripple: Show, NA, RippleWin
hRippleWin := WinExist("RippleWin")
hRippleDC := DllCall("GetDC", UInt, 0)
VarSetCapacity(buf, 40, 0)
NumPut(40, buf, 0)
NumPut(RippleWinSize, buf, 4)
NumPut(RippleWinSize, buf, 8)
NumPut(1, buf, 12, "ushort")
NumPut(32, buf, 14, "ushort")
NumPut(0, buf, 16)
hRippleBmp := DllCall("CreateDIBSection", UInt, hRippleDC, UInt, &buf, UInt, 0, UIntP, ppvBits, UInt, 0, UInt, 0)
DllCall("ReleaseDC", UInt, 0, UInt, hRippleDC)
hRippleDC := DllCall("CreateCompatibleDC", UInt, 0)
DllCall("SelectObject", UInt, hRippleDC, UInt, hRippleBmp)
DllCall("gdiplus\GdipCreateFromHDC", UInt, hRippleDC, UIntP, pRippleGraphics)
DllCall("gdiplus\GdipSetSmoothingMode", UInt, pRippleGraphics, Int, 4)
MouseGetPos _lastX, _lastY
SetTimer MouseIdleTimer, 5000
Return
MouseIdleTimer:
MouseGetPos _x, _y
if (_x == _lastX and _y == _lastY)
ShowRipple(MouseIdleRippleColor, _interval:=40)
else
_lastX := _x, _lastY := _y
Return
}
ShowRipple(_color, _interval:=20)
{
Global
if (RippleVisible)
Return
RippleColor := _color
RippleDiameter := RippleMinSize
RippleAlpha := RippleAlphaMax
RippleVisible := True
MouseGetPos _pointerX, _pointerY
SetTimer RippleTimer, % _interval
Return
RippleTimer:
DllCall("gdiplus\GdipGraphicsClear", UInt, pRippleGraphics, Int, 0)
if ((RippleDiameter += RippleStep) < RippleMaxSize) {
DllCall("gdiplus\GdipCreatePen1", Int, ((RippleAlpha -= RippleAlphaStep) << 24) | RippleColor, float, 3, Int, 2, UIntP, pRipplePen)
DllCall("gdiplus\GdipDrawEllipse", UInt, pRippleGraphics, UInt, pRipplePen, float, 1, float, 1, float, RippleDiameter - 1, float, RippleDiameter - 1)
DllCall("gdiplus\GdipDeletePen", UInt, pRipplePen)
}
else {
RippleVisible := False
SetTimer RippleTimer, Off
}
VarSetCapacity(buf, 8)
NumPut(_pointerX - RippleDiameter // 2, buf, 0)
NumPut(_pointerY - RippleDiameter // 2, buf, 4)
DllCall("UpdateLayeredWindow", UInt, hRippleWin, UInt, 0, UInt, &buf, Int64p, (RippleDiameter + 5) | (RippleDiameter + 5) << 32, UInt, hRippleDC, Int64p, 0, UInt, 0, UIntP, 0x1FF0000, UInt, 2)
Return
}
Related videos on Youtube
Qaher
Updated on September 18, 2022Comments
-
Qaher almost 2 years
There are plenty of programs regarding the alternation of the cursor appearance, especially for the Mac OS in which one can change the look of the cursor, on for example mouse events, with beautiful animations and figures. I was looking for an identical replacement of the Mouseposé app for Windows 10, but I was not fortunate enough, so far. If you do know of such an app, then please acquaint with me with. However, I've found some that work pretty good (but not as desired) for Windows, like the CursorFX and the SpotOn TheMouse; the former looks appropriate, but it's not visually compatible with the icons of Windows 10 and so does the latter, but it suffers from a low quality.
What I want to ask is apart from the aforementioned apps. Some scripts could be written for hot keys in Windows, but according to the answer given in this post, something alike the following will be produced as a result:
As you can see, the Ctrl key is replaced with the mouse buttons and creates a functionality alike the aforementioned apps. But this default Windows 10 animation is so ugly, monstrous, very quick and inappropriate.
I want to create a situation, if possible, through the AutoHotKey script in which the following gorgeous SVG animation to appear when the mouse button clicks. How do I do this? Thanks for all your helps.
The animated SVG (Spinning-Circles.SVG) file (you can play it by opening it in a browser other than IE) The animation I want to have at the click location in Windows 10.
-
Qaher about 7 yearsCan you provide an example that works fine in windows 10?
-
AnnanFay over 5 years@Qaher Does the provided code not work for you?
-
Qaher over 5 years@Annan Yes it's working. You need first to download
Gdip_All.ahk
from this link dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk and rename it toGDIP.ahk
, put this file in the same directory with the source code you want to run! I tested these files on Windows 10, it's working but it is ugly as well and it's not anti-aliased or smooth, it's very fast and bad! -
AnnanFay over 5 years@Qaher Good to hear it's working. It was working for me also on Windows 10. Your previous comment made it sound as if it wasn't working for you which is why I asked.
-
Qaher about 5 yearsThanks for your answer, the smoothness is perfectly suitable, but unfortunately when you double-click anywhere, the animation don't restart until the first one completely done!
-
Mathieu CAROFF over 4 yearsIt works but for some reason it seems to interfere with Inkscape. It appears to cancel click (between 20% and 80% of them, depending on the time)
-
dereks almost 3 years@Qaher have you found a better solution?