Initial commit xmarticaims
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
/* Spotlight overlay. Clicks pass through to the page. */
|
||||
|
||||
.spotlight-cursor {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
pointer-events: none;
|
||||
transition: opacity 120ms ease;
|
||||
}
|
||||
|
||||
.spotlight-cursor.is-hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* The ambient background stylesheet gives <main> its own stacking context.
|
||||
Release it on WordPress pages so text can sit above this fixed overlay while
|
||||
section backgrounds remain below it. */
|
||||
body.page > main,
|
||||
body.page > footer {
|
||||
z-index: auto;
|
||||
}
|
||||
|
||||
/* Keep readable page content above the light while the transparent space
|
||||
around it still lets the spotlight illuminate backgrounds and media. */
|
||||
body.page #primary :where(h1, h2, h3, h4, h5, h6, p, a, button, label, li, dt, dd, figcaption, blockquote, legend, summary, small, strong, em, b, span, input, textarea, select),
|
||||
body.page > footer :where(h1, h2, h3, h4, h5, h6, p, a, button, label, li, dt, dd, figcaption, blockquote, legend, summary, small, strong, em, b, span, input, textarea, select) {
|
||||
position: relative;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
/* The FAQ control is a positioned UI element, not inline text. Preserve its
|
||||
right-aligned placement while keeping it above the spotlight. */
|
||||
body.page #primary .home-faq .home-faq__toggle-icon {
|
||||
position: absolute;
|
||||
z-index: 22;
|
||||
}
|
||||
|
||||
/* Internal consulting templates use isolated artwork and positioned wrappers.
|
||||
Flatten the artwork context, then raise cards and FAQ controls above the
|
||||
spotlight without lifting the dark section backgrounds themselves. */
|
||||
body.page:not(.front-page) .consulting-intro {
|
||||
isolation: auto;
|
||||
}
|
||||
|
||||
body.page:not(.front-page) .consulting-intro > [aria-hidden="true"] {
|
||||
z-index: 0 !important;
|
||||
}
|
||||
|
||||
body.page:not(.front-page) :where(.consulting-deliverables__card, .consulting-team__level) {
|
||||
position: relative;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
body.page:not(.front-page) .consulting-faq > div {
|
||||
z-index: 21 !important;
|
||||
}
|
||||
|
||||
/* Tailwind's `isolate`, the hero copy layers and sticky positioning create
|
||||
nested stacking contexts. Flatten/raise those specific contexts so their
|
||||
text is not tinted when the spotlight passes underneath. */
|
||||
body.front-page .home-hero {
|
||||
isolation: auto;
|
||||
}
|
||||
|
||||
body.front-page .home-hero__background {
|
||||
z-index: 0 !important;
|
||||
}
|
||||
|
||||
body.front-page .home-hero__copy {
|
||||
isolation: auto;
|
||||
}
|
||||
|
||||
body.front-page .home-hero__copy > :not(.home-hero__copy-glow),
|
||||
body.front-page .home-hero__metrics {
|
||||
position: relative;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
body.front-page #soluciones > div > .sticky {
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
body.front-page #soluciones .practice-card-list {
|
||||
position: relative;
|
||||
z-index: 21;
|
||||
}
|
||||
|
||||
body.front-page #soluciones [data-practice-card-tilt] {
|
||||
z-index: 21 !important;
|
||||
}
|
||||
|
||||
body.front-page #soluciones [data-practice-card-tilt]:hover,
|
||||
body.front-page #soluciones [data-practice-card-tilt].is-tilting {
|
||||
z-index: 23 !important;
|
||||
}
|
||||
|
||||
.spotlight-cursor canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* Spotlight cursor from Cursify.
|
||||
https://cursify.ui-layouts.com/components/spotlight-cursor */
|
||||
(function () {
|
||||
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
var spotlightSize = 250;
|
||||
var fadeSpeed = 0.95;
|
||||
var pulseSpeed = 3200;
|
||||
|
||||
var root = document.createElement('div');
|
||||
root.className = 'spotlight-cursor';
|
||||
root.setAttribute('aria-hidden', 'true');
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
root.appendChild(canvas);
|
||||
document.body.appendChild(root);
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
var spotlightPos = { x: window.innerWidth / 2, y: window.innerHeight / 2 };
|
||||
var targetPos = { x: spotlightPos.x, y: spotlightPos.y };
|
||||
var lastVisibilityCheck = 0;
|
||||
|
||||
function resizeCanvas() {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
}
|
||||
|
||||
function lerp(start, end, factor) {
|
||||
return start + (end - start) * factor;
|
||||
}
|
||||
|
||||
function handleMouseMove(event) {
|
||||
targetPos.x = event.clientX;
|
||||
targetPos.y = event.clientY;
|
||||
updateSpotlightVisibility(event.target);
|
||||
}
|
||||
|
||||
function updateSpotlightVisibility(target) {
|
||||
var excludedSelector = '#tecnologias, .consulting-why, .bg-white, [data-spotlight-exclude]';
|
||||
var isOverExcludedSection = target instanceof Element && Boolean(target.closest(excludedSelector));
|
||||
|
||||
root.classList.toggle('is-hidden', isOverExcludedSection);
|
||||
}
|
||||
|
||||
function updateSpotlightVisibilityAtCursor() {
|
||||
updateSpotlightVisibility(document.elementFromPoint(targetPos.x, targetPos.y));
|
||||
}
|
||||
|
||||
function render(timestamp) {
|
||||
if (timestamp - lastVisibilityCheck >= 120) {
|
||||
updateSpotlightVisibilityAtCursor();
|
||||
lastVisibilityCheck = timestamp;
|
||||
}
|
||||
|
||||
spotlightPos.x = lerp(spotlightPos.x, targetPos.x, fadeSpeed);
|
||||
spotlightPos.y = lerp(spotlightPos.y, targetPos.y, fadeSpeed);
|
||||
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
var pulseScale = 1 + 0.04 * Math.sin((Date.now() / pulseSpeed) * Math.PI * 2);
|
||||
var currentSpotlightSize = spotlightSize * pulseScale;
|
||||
var glowGradient = ctx.createRadialGradient(
|
||||
spotlightPos.x,
|
||||
spotlightPos.y,
|
||||
0,
|
||||
spotlightPos.x,
|
||||
spotlightPos.y,
|
||||
currentSpotlightSize * 1.25
|
||||
);
|
||||
|
||||
glowGradient.addColorStop(0, 'rgba(255, 205, 17, 0.62)');
|
||||
glowGradient.addColorStop(0.24, 'rgba(255, 198, 0, 0.5)');
|
||||
glowGradient.addColorStop(0.5, 'rgba(220, 163, 0, 0.34)');
|
||||
glowGradient.addColorStop(0.74, 'rgba(154, 113, 0, 0.17)');
|
||||
glowGradient.addColorStop(1, 'rgba(110, 80, 0, 0)');
|
||||
ctx.fillStyle = glowGradient;
|
||||
ctx.beginPath();
|
||||
ctx.arc(spotlightPos.x, spotlightPos.y, currentSpotlightSize * 1.25, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
|
||||
window.requestAnimationFrame(render);
|
||||
}
|
||||
|
||||
resizeCanvas();
|
||||
window.addEventListener('resize', resizeCanvas);
|
||||
window.addEventListener('scroll', updateSpotlightVisibilityAtCursor, { passive: true });
|
||||
document.addEventListener('mousemove', handleMouseMove);
|
||||
window.requestAnimationFrame(render);
|
||||
}());
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Spotlight cursor from Cursify.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_spotlight_cursor_assets() {
|
||||
$dir = get_template_directory() . '/parts/spotlight-cursor';
|
||||
$uri = get_template_directory_uri() . '/parts/spotlight-cursor';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-spotlight-cursor',
|
||||
$uri . '/spotlight-cursor.css',
|
||||
array(),
|
||||
filemtime( $dir . '/spotlight-cursor.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-spotlight-cursor',
|
||||
$uri . '/spotlight-cursor.js',
|
||||
array(),
|
||||
filemtime( $dir . '/spotlight-cursor.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_spotlight_cursor_assets' );
|
||||
Reference in New Issue
Block a user