Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Pointer tracking glows
Wherever you go,
it follows
Learn more
Pointer tracking glows
Activate by,
getting closer
Learn more
css
:root { --bg: hsl(246 44% 7%); --border: hsl(280 10% 50% / 1); --card: hsl(237 36% 10%); --color: hsl(240 18% 80%); --border-width: 2px; --border-radius: 12px; --gradient: conic-gradient(from 180deg at 50% 70%,hsla(0,0%,98%,1) 0deg,#eec32d 72.0000010728836deg,#ec4b4b 144.0000021457672deg,#709ab9 216.00000858306885deg,#4dffbf 288.0000042915344deg,hsla(0,0%,98%,1) 1turn); } *, *:after, *:before { box-sizing: border-box; } @property --start { syntax: '
'; inherits: true; initial-value: 0; } body { background: var(--bg); display: grid; place-items: center; min-height: 100vh; font-family: "Geist Sans", "SF Pro Text", "SF Pro Icons", "AOS Icons", "Helvetica Neue", Helvetica, Arial, sans-serif, system-ui; font-weight: 70; color: var(--color); } .container { --spread: 60; display: flex; flex-wrap: wrap; flex-direction: var(--direction); gap: calc(var(--gap) * 1px); margin: 0 auto; justify-content: center; place-items: center; position: relative; padding: 2rem; touch-action: none; } article { --active: 0.15; --start: 0; height: 100%; background: var(--card); padding: 2rem; aspect-ratio: 330 / 400; border-radius: var(--border-radius); min-width: 280px; max-width: 280px; display: flex; flex-direction: column; gap: 0.25rem; position: relative; } article:is(:hover, :focus-visible) { z-index: 2; } .glows { pointer-events: none; position: absolute; inset: 0; filter: blur(calc(var(--blur) * 1px)); } .glows::after, .glows::before { --alpha: 0; content: ""; background: var(--gradient); background-attachment: fixed; position: absolute; inset: -5px; border: 10px solid transparent; border-radius: var(--border-radius); mask: linear-gradient(#0000, #0000), conic-gradient(from calc((var(--start) - (var(--spread) * 0.5)) * 1deg), #000 0deg, #fff, #0000 calc(var(--spread) * 1deg)); mask-composite: intersect; mask-clip: padding-box, border-box; opacity: var(--active); transition: opacity 1s; } article::before { position: absolute; inset: 0; border: var(--border-width) solid transparent; content: ""; border-radius: var(--border-radius); pointer-events: none; background: var(--border); background-attachment: fixed; border-radius: var(--border-radius); mask: linear-gradient(#0000, #0000), conic-gradient( from calc(((var(--start) + (var(--spread) * 0.25)) - (var(--spread) * 1.5)) * 1deg), hsl(0 0% 100% / 0.15) 0deg, white, hsl(0 0% 100% / 0.15) calc(var(--spread) * 2.5deg)); mask-clip: padding-box, border-box; mask-composite: intersect; opacity: var(--active); transition: opacity 1s; } article::after { --bg-size: 100%; content: ""; pointer-events: none; position: absolute; background: var(--gradient); background-attachment: fixed; border-radius: var(--border-radius); opacity: var(--active, 0); transition: opacity 1s; --alpha: 0; inset: 0; border: var(--border-width) solid transparent; mask: linear-gradient(#0000, #0000), conic-gradient(from calc(((var(--start) + (var(--spread) * 0.25)) - (var(--spread) * 0.5)) * 1deg), #0000 0deg, #fff, #0000 calc(var(--spread) * 0.5deg)); filter: brightness(1.5); mask-clip: padding-box, border-box; mask-composite: intersect; } .badge { border: 2px solid var(--border); align-self: start; border-radius: 100px; padding: 0.5rem 0.7rem; font-size: 0.675rem; display: flex; align-items: center; gap: 0.25rem; font-weight: 50; } a { color: var(--color); text-decoration: none; opacity: 0.5; display: inline-block; align-self: start; transition: opacity 0.2s; } a:is(:hover, :focus-visible) { opacity: 1; } article h2 { margin: 0; padding: 1rem 0; font-weight: 100; font-size: 1.5rem; } .header { position: relative; flex: 1; display: flex; align-items: center; } .header svg { --count: 4; width: 106px; } .header svg:nth-of-type(2), .header svg:nth-of-type(3), .header svg:nth-of-type(4) { position: absolute; z-index: calc(var(--count) - var(--index)); translate: calc(var(--index) * 30%) 0; opacity: calc(var(--count) / (2 * (var(--index) * 10))); } .header svg:nth-of-type(2) { --index: 1; } .header svg:nth-of-type(3) { --index: 2; } .header svg:nth-of-type(4) { --index: 3; } .badge svg { width: 16px; } .dg.ac { z-index: 99999 !important; }
JavaScript
const CONTAINER = document.querySelector('.container') const CARDS = document.querySelectorAll('article') const CONFIG = { proximity: 40, spread: 80, blur: 20, gap: 32, vertical: false, opacity: 0, } const PROXIMITY = 10 const UPDATE = (event) => { // get the angle based on the center point of the card and pointer position for (const CARD of CARDS) { // Check the card against the proximity and then start updating const CARD_BOUNDS = CARD.getBoundingClientRect() // Get distance between pointer and outerbounds of card if ( event?.x > CARD_BOUNDS.left - CONFIG.proximity && event?.x < CARD_BOUNDS.left + CARD_BOUNDS.width + CONFIG.proximity && event?.y > CARD_BOUNDS.top - CONFIG.proximity && event?.y < CARD_BOUNDS.top + CARD_BOUNDS.height + CONFIG.proximity) { // If within proximity set the active opacity CARD.style.setProperty('--active', 1) } else { CARD.style.setProperty('--active', CONFIG.opacity) } const CARD_CENTER = [ CARD_BOUNDS.left + CARD_BOUNDS.width * 0.5, CARD_BOUNDS.top + CARD_BOUNDS.height * 0.5 ] let ANGLE = Math.atan2(event?.y - CARD_CENTER[1], event?.x - CARD_CENTER[0]) * 180 / Math.PI ANGLE = ANGLE < 0 ? ANGLE + 360 : ANGLE; CARD.style.setProperty('--start', ANGLE + 90) } } document.body.addEventListener('pointermove', UPDATE) const RESTYLE = () => { CONTAINER.style.setProperty('--gap', CONFIG.gap) CONTAINER.style.setProperty('--blur', CONFIG.blur) CONTAINER.style.setProperty('--spread', CONFIG.spread) CONTAINER.style.setProperty('--direction', CONFIG.vertical ? 'column' : 'row') } RESTYLE() UPDATE()
粒子
时间
文字
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号