Là một công cụ xử lý ảnh, tholman/cursor-effects đã đạt 4.0k sao trên GitHub, ngôn ngữ JavaScript. Old-school cursor effects for your browser built with modern JavaScript
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
"Knowing the codes" used to be all the rage, I want to bring a few back.
A repo of the old effects that inspired creativity and the desire to learn at least a little code around the world. Modernised so they're a little more efficient, and just as annoying (and twice as fun) as they were before. Have a play here.
The current effects are:
Rainbow Cursor
Emoji Rain
Elastic Emoji
Ghost Following
Trailing Cursor
Text Flag Cursor
Following Dot
Bubbles Particles
Snowflake Particles
Fairy Dust
Clock Cursor
Character Cursor
How to Set Up Locally/Develop
First the packages request (this is only rollup, which code compilation) with npm install
npm run watch This will compile the src in the dist folder that index.html is looking for and update it when changes are made. You can then go to index.html in the web browser of your choice.
How to Use
You need to include the following script tag in your webpage (see next section if you want to use this package via npm). And then, once the script is loaded you'll be able to add the effects to the page
Alternatively you can use a type="module" script on newer browsers with a import statement, if you are using the esm module you will import the cursor specific to your needs, rather than having to use the cursoreffects.x style.
<script type="module">
import { fairyDustCursor } from "https://unpkg.com/cursor-effects@latest/dist/esm.js";
new fairyDustCursor();
</script>
And then create a new instance of its type in your JavaScript. The script will create the canvas that is used, so nothing else is really needed.
window.addEventListener("load", (event) => {
new cursoreffects.ghostCursor();
});
You can also target specific elements, to have the canvas appear inside those, for example:
const targetElement = document.querySelector("#ghost");
new cursoreffects.ghostCursor({ element: targetElement });
To remove the effect, you can call destroy on it.
// Create
let cursorEffect = new ghostCursor();
// Destroy
cursorEffect.destroy();
or you can use NPM
npm install cursor-effects
import { emojiCursor } from "cursor-effects";
new emojiCursor({ emoji: ["🔥", "🐬", "🦆"] });
Specific Customization
A few of these have custom options as well (if you are interested in more options, opening an issue or PR is the way to go).
ghostCursor
You can change the cursor image in ghostCursor
new cursoreffects.ghostCursor(
{image:"https://www.cursor.cc/cursor/820/63/cursor.png"}
);
});
rainbowCursor
You can change the colors, size and length in rainbowCursor
new cursoreffects.rainbowCursor({
length: 3,
colors: ["red", "blue"],
size: 4,
});
springyEmojiCursor
You can change the emoji in springyEmojiCursor's emoji with the emoji a single string emoji.
new cursoreffects.springyEmojiCursor({ emoji: "🤷♂️" });
bubbleCursor
You can change the fill and stroke/border of the bubbles in bubbleCursor with the fillColor & strokeColor options
new cursoreffects.bubbleCursor({
fillColor: "#f771b4",
strokeColor: "#e6f1f7",
});
fairyDustCursor
You can customize the fairyDustCursor by using the fairySymbol option to change the emoji, and the colors option (an array) to define its trail colors.
new cursoreffects.fairyDustCursor({
colors: ["#ff0000", "#00ff00", "#0000ff"],
fairySymbol: "★",
});
emojiCursor
You can change the emoji in emojiCursor's emoji with the emoji option (a list of emoji),
and delay between emoji with the delay option (defaults to 16)
new cursoreffects.emojiCursor({ emoji: ["🔥", "🐬", "🦆"], delay: 25 });
textFlag
You can change the textFlag's text with the text option (String),
and color of the text with the color option (hex)
new textFlag({ text: "test", color: ["#FF6800"] });
Accessibility
The cursor won't display if the user's system accessibility settings have prefers-reduced-motion enabled.
trailingCursor
You can change the number of trail steps in trailingCursor with the particles option (a number), the rate of the trail with the rate option (a number between 0 and 1, default is 0.4), and the trailing cursor image with the baseImageSrc option (a URL or base64 string)
new cursoreffects.trailingCursor({
particles: 15,
rate: 0.8,
baseImageSrc: "data:image/png;base64,iVB...",
});
You can change the color of the following dot in followingDotCursor with the color option (hex)
new cursoreffects.followingDotCursor({ color: ["#323232a6"] });
characterCursor
Consider this cursor as an extension of the snowflake cursor, but instead of the snowflake emoji you can specify a list of characters and colors to use as well as defining how the character's velocity, rotation and scaling should change over the characters lifespan. For example to produce the same effect you see in the demo page, you would use this. (It will also do this by default, but this is a great way to experiement and play around with the effect)
Note that none of these behavior changing options are required but in that case it will use similar physics to the snowflake and use the asterisk character instead.
License
MIT af, but if you're using the scripts a GitHub sponsorship or shouting me a coffee would always be appreciated :)
tholman/cursor-effects thuộc nhóm Image Tools trên TopGit, cùng 4 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về tholman/cursor-effects ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/tholman/cursor-effects là nguồn chính thức.
tholman/cursor-effects có bao nhiêu sao?
tholman/cursor-effects có 4.0k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/tholman/cursor-effects. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
tholman/cursor-effects có những chủ đề gì?
GitHub topics của tholman/cursor-effects: "90s", "canvas", "javascript", "library". TopGit xếp repo vào nhóm Image Tools.
tholman/cursor-effects còn đang phát triển không?
Commit gần nhất trên tholman/cursor-effects là 5 tháng trước (theo timestamp GitHub). Repo có 273 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
tholman/cursor-effects viết bằng ngôn ngữ gì?
tholman/cursor-effects chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao tholman/cursor-effects được xếp vào nhóm Image Tools?
TopGit xếp tholman/cursor-effects vào nhóm Image Tools dựa trên GitHub topics và mô tả của repo (gắn thẻ: "90s", "canvas", "javascript"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về cursor-effects?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về cursor-effects.