catsjuice / ipad-cursor Goto Github PK
View Code? Open in Web Editor NEW● Mouse effect of iPad in browser that can be used in any framework
Home Page: https://cursor.oooo.so
License: MIT License
● Mouse effect of iPad in browser that can be used in any framework
Home Page: https://cursor.oooo.so
License: MIT License
transform:
translate(calc(-50% + var(--cursor-translateX)), calc(-50% + var(--cursor-translateY)))
scale(var(--cursor-scale));
--cursor-translateX
and --cursor-translateX
are first set in onBlockMove()
, which will only be triggered when mouse is moving on a block. Therefore, these two CSS variables are undefined before the cursor enters a block, resulting in the transform
property being none
. Consequently, scale
will not work.
updateCursor
. But I've implemented the use of a MutationObserver
to listen for DOM changes and perform an updateCursor
. the cursor is subtly unresponsive for a few seconds before being moved normally.README
(EN)README
(ZH-CN)Just in case the elements lag on less capable devices,
add an optional config to apply will-change
for cursor
element and block
element.
enableWillChange
v-cursor
directiveIpadCursorProvider
, IpadCursor
Manually specifying whether the cursor is displayed as text seems a bit tricky. Can we automatically change the cursor by the cursor style of the element the cursor is pointing to?
It would probably be written like this:
// target is the dom element
const computedStyle = getComputedStyle(target);
const cursor = computedStyle.cursor;
if (cursor === 'text') {
...
}
I'm not sure if this will have performance issues...
Thanks for this repo!!
Recently, I wanna add this ipad-cursor
into my blog built by hexo (NexT theme). But I don't know how to do that :)
goals:
JsDoc
core
code into separate fileseffect on iPad OS:
Add a config item called enableLighting
(defaults to false
), add lighting effect when this config is true
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.