Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Link.
Read More.
GO HERE! GO HERE! GO HERE! GO HERE!
css
* { box-sizing: border-box; margin: 0; padding: 0; } body { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background: #202020; overflow: hidden; } main { height: 200px; width: 300px; display: grid; grid-template-rows: repeat(2, 1fr); } main .links { display: flex; justify-content: center; align-items: center; } main .links .link { --color: rgba(255, 255, 255, 0.5); position: relative; font-size: 0.95rem; font-family: "Sainte Colombe"; text-decoration: none; color: var(--color); margin: 2rem; transition: color 300ms ease; } main .links .link::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; background: white; transform-origin: right; transform: scaleX(0); transition: transform 300ms ease; } main .links .link:hover { --color: rgb(255, 255, 255); } main .links .link:hover::after { transform-origin: left; transform: scaleX(1); } main .socials { display: flex; justify-content: center; align-items: center; } main .socials .social { --icon-size: 40px; width: var(--icon-size); height: var(--icon-size); display: flex; justify-content: center; align-items: center; border-radius: 0.5rem; margin: 1.5rem; color: #fff; background: var(--bg); box-shadow: 0 2.8px 2.2px rgba(0, 0, 0, 0.014), 0 6.7px 5.3px rgba(0, 0, 0, 0.02), 0 12.5px 10px rgba(0, 0, 0, 0.025), 0 22.3px 17.9px rgba(0, 0, 0, 0.03), 0 41.8px 33.4px rgba(0, 0, 0, 0.036), 0 100px 80px rgba(0, 0, 0, 0.05); } main .socials .social.codepen { --bg: #000; } main .socials .social.youtube { --bg: #c4302b; } main .socials .social.dribbble { --bg: #ea4c89; } main .socials .social.twitter { --bg: #00acee; } .cursor .cursor--small, .cursor .cursor--large, .cursor .cursor--text { position: fixed; left: 0; top: 0; transform: translate(-50%, -50%); border-radius: 50%; width: var(--cursor-size); height: var(--cursor-size); mix-blend-mode: difference; pointer-events: none; user-select: none; } .cursor .cursor--text { --cursor-size: fit-content; font-size: 0.75rem; color: #fff; opacity: 0; } .cursor .cursor--text .text { font-family: sans-serif; font-weight: bold; } .cursor .cursor--small { --cursor-size: 20px; background: #fff; } .cursor .cursor--large { --cursor-size: 60px; border: 2px solid #fff; }
JavaScript
console.clear(); const { gsap, CircleType } = window; const cursorOuter = document.querySelector(".cursor--large"); const cursorInner = document.querySelector(".cursor--small"); const cursorTextContainerEl = document.querySelector(".cursor--text"); const cursorTextEl = cursorTextContainerEl.querySelector(".text"); const hoverItems = document.querySelectorAll(".cursor-hover-item"); const hoverEffectDuration = 0.3; let isHovered = false; const cursorRotationDuration = 8; let circleType = new CircleType(cursorTextEl); circleType.radius(50); hoverItems.forEach((item) => { item.addEventListener("pointerenter", handlePointerEnter); item.addEventListener("pointerleave", handlePointerLeave); }); let mouse = { x: -100, y: -100, }; document.body.addEventListener("pointermove", updateCursorPosition); function updateCursorPosition(e) { mouse.x = e.pageX; mouse.y = e.pageY; } function updateCursor() { gsap.set([cursorInner, cursorTextContainerEl], { x: mouse.x, y: mouse.y, }); gsap.to(cursorOuter, { duration: 0.15, x: mouse.x, y: mouse.y, }); if (!isHovered) { gsap.to(cursorTextContainerEl, hoverEffectDuration, { opacity: 0, }); gsap.set(cursorTextContainerEl, { rotate: 0, }); } requestAnimationFrame(updateCursor); } updateCursor(); function handlePointerEnter(e) { isHovered = true; const target = e.currentTarget; const cursorTextRepeatTimes = target.getAttribute("data-cursor-text-repeat"); const cursorText = returnMultipleString( target.getAttribute("data-cursor-text"), cursorTextRepeatTimes ); gsap.fromTo( cursorTextContainerEl, { rotate: 0, }, { duration: cursorRotationDuration, rotate: 360, ease: "none", repeat: -1, } ); circleType.destroy(); cursorTextEl.innerHTML = cursorText; circleType = new CircleType(cursorTextEl); gsap.to(cursorInner, hoverEffectDuration, { scale: 2, }); gsap.fromTo( cursorTextContainerEl, hoverEffectDuration, { scale: 1.2, opacity: 0, }, { delay: hoverEffectDuration * 0.75, scale: 1, opacity: 1, } ); gsap.to(cursorOuter, hoverEffectDuration, { scale: 1.2, opacity: 0, }); } function handlePointerLeave() { isHovered = false; gsap.to([cursorInner, cursorOuter], hoverEffectDuration, { scale: 1, opacity: 1, }); } function returnMultipleString(string, count) { let s = ""; for (let i = 0; i < count; i++) { s += ` ${string} `; } return s; }
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>光标交互动画-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号