Comments (3)
It really depends on the cursor icon and the "xhot/yhot" values that can be read from the shell...
https://github.com/jeffchannell/jiggle/blob/master/effects/ScalingEffect.js#L80
from jiggle.
Unfortunately, I do not completely understand the code, but if it helps, here are some calculations that might save you at least a little bit of time:
Original cursor:
(x0,y0) = position of top left corner
(xhot,yhot) = coordinates of tip counted from top left corner
Scaled cursor:
(x0',y0') = position of top left corner
(xhot',yhot') = coordinates of tip counted from top left corner
Then for the tips to coincide, we need:
x0'+xhot' = x0+xhot
So we should take:
x0' = x0+xhot-xhot'
If our scaling factor is r, then:
x0' = x0+ (1-r)*xhot
(Same for y0.)
There seems to be some conversion between center and corner position in your code, but I did not quite understand when you need which, but the conversion should follow from:
w,h = width, height
(xc,yc) = (x0+w/2,y0+h/2) = center of cursor image
from jiggle.
I've made some adjustments in the master branch for cursor positioning as I was revamping the animations to remove Tweener. Adding some modifiers to the X and Y offsets seems to get the fake cursor incredibly close for each supported size.
Feel free to make local
and test the changes!
from jiggle.
Related Issues (20)
- Add option to cancel jiggle on full screen? HOT 2
- Cursor color when jiggling is black no matter what.... HOT 1
- Gnome 40?
- Wayland support not working on GNOME 40 HOT 1
- Translation support
- does not work with trackpad HOT 3
- Doesnt work on Wayland HOT 4
- (Suggestion) Stop triggering a jiggle when the cursor is invisible HOT 1
- Gnome 41 support HOT 5
- Incompatible with gnome 41 HOT 9
- The cursor is not displayed in the open window HOT 1
- Hide cursor doesnt work on Gnome 42 HOT 1
- "The extension is incompatible with the current GNOME version" HOT 5
- Cursor is not hidden when shaking leading to two cursors displayed HOT 1
- Feature Request: Support custom cursors
- Failing to trigger on Gnome 42.5 / Wayland HOT 2
- Hold cursor size before shrinking
- Animations loops while shaking
- Could I trigger the highlight using the keyboard? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jiggle.