Initial commit xmarticaims
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
/* Animated background from trivelta: drifting orbs, particle canvas, grain. */
|
||||
|
||||
.ambient-bg {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body > header,
|
||||
body > main,
|
||||
body > footer {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.ambient-bg__canvas {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.ambient-bg__orbs {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ambient-bg__orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(100px);
|
||||
}
|
||||
|
||||
.ambient-bg__orb--a {
|
||||
top: -260px;
|
||||
left: -180px;
|
||||
width: 680px;
|
||||
height: 680px;
|
||||
background: radial-gradient(circle, #0a4fd1, transparent 70%);
|
||||
opacity: 0.55;
|
||||
animation: ambient-drift-1 22s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.ambient-bg__orb--b {
|
||||
top: 30%;
|
||||
right: -240px;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: radial-gradient(circle, #1f7ae5, transparent 70%);
|
||||
opacity: 0.34;
|
||||
animation: ambient-drift-2 26s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.ambient-bg__orb--c {
|
||||
bottom: -220px;
|
||||
left: 34%;
|
||||
width: 560px;
|
||||
height: 560px;
|
||||
background: radial-gradient(circle, #4fb8ff, transparent 70%);
|
||||
opacity: 0.22;
|
||||
animation: ambient-drift-3 30s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.ambient-bg__grain {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
opacity: 0.04;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
@keyframes ambient-drift-1 {
|
||||
0%,
|
||||
100% { transform: translate(0, 0); }
|
||||
50% { transform: translate(80px, 60px); }
|
||||
}
|
||||
|
||||
@keyframes ambient-drift-2 {
|
||||
0%,
|
||||
100% { transform: translate(0, 0); }
|
||||
50% { transform: translate(-90px, 40px); }
|
||||
}
|
||||
|
||||
@keyframes ambient-drift-3 {
|
||||
0%,
|
||||
100% { transform: translate(0, 0); }
|
||||
50% { transform: translate(60px, -70px); }
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.ambient-bg__canvas,
|
||||
.ambient-bg__orbs {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ambient-bg__orb {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.ambient-bg__canvas {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/* Animated background from trivelta: aurora orbs plus a particle constellation. */
|
||||
(function () {
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
var root = document.createElement('div');
|
||||
root.className = 'ambient-bg';
|
||||
root.setAttribute('aria-hidden', 'true');
|
||||
root.innerHTML = '<canvas class="ambient-bg__canvas"></canvas>'
|
||||
+ '<div class="ambient-bg__orbs">'
|
||||
+ '<div class="ambient-bg__orb ambient-bg__orb--a"></div>'
|
||||
+ '<div class="ambient-bg__orb ambient-bg__orb--b"></div>'
|
||||
+ '<div class="ambient-bg__orb ambient-bg__orb--c"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="ambient-bg__grain"></div>';
|
||||
document.body.insertBefore(root, document.body.firstChild);
|
||||
|
||||
var canvas = root.querySelector('.ambient-bg__canvas');
|
||||
|
||||
if (reduceMotion || window.innerWidth < 900) {
|
||||
canvas.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
var width = 0;
|
||||
var height = 0;
|
||||
var dpr = 1;
|
||||
var points = [];
|
||||
|
||||
function resize() {
|
||||
dpr = Math.min(window.devicePixelRatio || 1, 2);
|
||||
width = canvas.width = window.innerWidth * dpr;
|
||||
height = canvas.height = window.innerHeight * dpr;
|
||||
canvas.style.width = window.innerWidth + 'px';
|
||||
canvas.style.height = window.innerHeight + 'px';
|
||||
|
||||
var count = Math.min(70, Math.floor(window.innerWidth / 22));
|
||||
points = [];
|
||||
|
||||
for (var i = 0; i < count; i++) {
|
||||
points.push({
|
||||
x: Math.random() * width,
|
||||
y: Math.random() * height,
|
||||
vx: (Math.random() - 0.5) * 0.12 * dpr,
|
||||
vy: (Math.random() - 0.5) * 0.12 * dpr
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function loop() {
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var point = points[i];
|
||||
point.x += point.vx;
|
||||
point.y += point.vy;
|
||||
if (point.x < 0 || point.x > width) point.vx *= -1;
|
||||
if (point.y < 0 || point.y > height) point.vy *= -1;
|
||||
}
|
||||
|
||||
for (var a = 0; a < points.length; a++) {
|
||||
for (var b = a + 1; b < points.length; b++) {
|
||||
var dx = points[a].x - points[b].x;
|
||||
var dy = points[a].y - points[b].y;
|
||||
var distance = Math.hypot(dx, dy);
|
||||
var maxDistance = 150 * dpr;
|
||||
|
||||
if (distance < maxDistance) {
|
||||
ctx.strokeStyle = 'rgba(79, 184, 255, ' + (0.16 * (1 - distance / maxDistance)) + ')';
|
||||
ctx.lineWidth = dpr;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(points[a].x, points[a].y);
|
||||
ctx.lineTo(points[b].x, points[b].y);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
ctx.fillStyle = 'rgba(120, 170, 255, 0.5)';
|
||||
ctx.beginPath();
|
||||
ctx.arc(points[a].x, points[a].y, 1.4 * dpr, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(loop);
|
||||
}
|
||||
|
||||
resize();
|
||||
window.addEventListener('resize', resize);
|
||||
window.requestAnimationFrame(loop);
|
||||
}());
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Animated background from trivelta.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_animated_background_assets() {
|
||||
$dir = get_template_directory() . '/parts/animated-background';
|
||||
$uri = get_template_directory_uri() . '/parts/animated-background';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-animated-background',
|
||||
$uri . '/animated-background.css',
|
||||
array(),
|
||||
filemtime( $dir . '/animated-background.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-animated-background',
|
||||
$uri . '/animated-background.js',
|
||||
array(),
|
||||
filemtime( $dir . '/animated-background.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_animated_background_assets' );
|
||||
@@ -0,0 +1,19 @@
|
||||
/* Full-viewport fluid trail. Clicks pass through to the page. */
|
||||
|
||||
.fluid-cursor {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.fluid-cursor canvas {
|
||||
display: block;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
pointer-events: none;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Fluid cursor from Cursify.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_fluid_cursor_assets() {
|
||||
$dir = get_template_directory() . '/parts/fluid-cursor';
|
||||
$uri = get_template_directory_uri() . '/parts/fluid-cursor';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-fluid-cursor',
|
||||
$uri . '/fluid-cursor.css',
|
||||
array(),
|
||||
filemtime( $dir . '/fluid-cursor.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-fluid-cursor',
|
||||
$uri . '/fluid-cursor.js',
|
||||
array(),
|
||||
filemtime( $dir . '/fluid-cursor.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_fluid_cursor_assets' );
|
||||
@@ -0,0 +1,55 @@
|
||||
/* Enter starts hidden and transitions in after the first paint.
|
||||
A CSS animation would finish during head scripts (Tailwind CDN) before anything is visible. */
|
||||
|
||||
body {
|
||||
opacity: 0;
|
||||
transform: translateY(30px) scale(0.99);
|
||||
filter: blur(7px);
|
||||
transition:
|
||||
opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
|
||||
transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
|
||||
filter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
|
||||
}
|
||||
|
||||
body.is-entered {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
body.is-leaving {
|
||||
opacity: 0;
|
||||
transform: translateY(-22px) scale(0.985);
|
||||
filter: blur(5px);
|
||||
transition:
|
||||
opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
filter 0.4s;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
body {
|
||||
transform: translateY(16px);
|
||||
filter: none;
|
||||
}
|
||||
|
||||
body.is-leaving {
|
||||
filter: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
body {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
filter: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
body.is-leaving {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
filter: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/* Cinematic page transition (from trivelta-html).
|
||||
WordPress prints internal links as absolute URLs, so same-origin navigations
|
||||
are included. External, in-page, admin, and modified clicks are left alone. */
|
||||
(function () {
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
var leaveMs = 360;
|
||||
|
||||
function playEnter() {
|
||||
if (reduceMotion) {
|
||||
document.body.classList.add('is-entered');
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
requestAnimationFrame(function () {
|
||||
document.body.classList.add('is-entered');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (/(?:^|[?&])(ct_builder|oxygen_iframe|ct_inner)=/.test(window.location.search)) {
|
||||
document.body.classList.add('is-entered');
|
||||
return;
|
||||
}
|
||||
|
||||
playEnter();
|
||||
|
||||
function shouldSkip(anchor, event) {
|
||||
if (!anchor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.defaultPrevented || event.button) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((anchor.target && anchor.target !== '_self') || anchor.hasAttribute('download')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var href = anchor.getAttribute('href');
|
||||
|
||||
if (!href || href.charAt(0) === '#' || /^(mailto:|tel:|javascript:)/i.test(href)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var url;
|
||||
|
||||
try {
|
||||
url = new URL(anchor.href, window.location.href);
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.origin !== window.location.origin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname.indexOf('/wp-admin') !== -1 || /\/wp-(login|comments-post)\.php$/.test(url.pathname)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (/\.(pdf|zip|rar|7z|docx?|xlsx?|pptx?|jpe?g|png|gif|webp|svg|mp[34]|wav)(\?|$)/i.test(url.pathname)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname === window.location.pathname && url.search === window.location.search) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function go(url) {
|
||||
if (document.body.classList.contains('is-leaving')) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.classList.add('is-leaving');
|
||||
window.setTimeout(function () {
|
||||
window.location.href = url;
|
||||
}, reduceMotion ? 0 : leaveMs);
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
var anchor = event.target.closest ? event.target.closest('a') : null;
|
||||
|
||||
if (shouldSkip(anchor, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
go(anchor.href);
|
||||
});
|
||||
|
||||
window.addEventListener('pageshow', function () {
|
||||
document.body.classList.remove('is-leaving');
|
||||
});
|
||||
}());
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Cinematic page transition.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_page_transition_assets() {
|
||||
$dir = get_template_directory() . '/parts/page-transition';
|
||||
$uri = get_template_directory_uri() . '/parts/page-transition';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-page-transition',
|
||||
$uri . '/page-transition.css',
|
||||
array(),
|
||||
filemtime( $dir . '/page-transition.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-page-transition',
|
||||
$uri . '/page-transition.js',
|
||||
array(),
|
||||
filemtime( $dir . '/page-transition.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
function alcastromol_page_transition_noscript() {
|
||||
echo '<noscript><style>body{opacity:1!important;transform:none!important;filter:none!important}</style></noscript>';
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_page_transition_assets' );
|
||||
add_action( 'wp_head', 'alcastromol_page_transition_noscript', 20 );
|
||||
@@ -0,0 +1,55 @@
|
||||
#tecnologias .platform-marquee__group {
|
||||
perspective: 900px;
|
||||
perspective-origin: center;
|
||||
}
|
||||
|
||||
#tecnologias .platform-marquee__card {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
transform-style: preserve-3d;
|
||||
transform-origin: center;
|
||||
backface-visibility: hidden;
|
||||
background:
|
||||
linear-gradient(#f8fdff, #f8fdff) padding-box,
|
||||
linear-gradient(135deg, #00acff 0%, rgba(79, 172, 217, 0.22) 35%, rgba(79, 172, 217, 0.3) 68%, #00acff 100%) border-box;
|
||||
box-shadow: 0 8px 24px rgba(18, 69, 100, 0.08);
|
||||
}
|
||||
|
||||
#tecnologias .platform-marquee__card.platform-card-tilt-ready {
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
#tecnologias .platform-marquee__card:hover,
|
||||
#tecnologias .platform-marquee__card.is-platform-tilting {
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
body.front-page #tecnologias.home-platforms--ims .platform-marquee__card {
|
||||
background:
|
||||
linear-gradient(#142035, #142035) padding-box,
|
||||
linear-gradient(135deg, #ffcd11 0%, rgba(255, 205, 17, 0.32) 42%, rgba(255, 255, 255, 0.7) 100%) border-box;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
|
||||
}
|
||||
|
||||
#tecnologias .platform-marquee__logo {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
transform: translateZ(18px);
|
||||
transition: transform 260ms ease;
|
||||
}
|
||||
|
||||
#tecnologias .platform-marquee__card:hover .platform-marquee__logo,
|
||||
#tecnologias .platform-marquee__card.is-platform-tilting .platform-marquee__logo {
|
||||
transform: translateZ(28px) scale(1.035);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse) {
|
||||
#tecnologias .platform-marquee__card {
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
#tecnologias .platform-marquee__logo {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { animate } from '../../assets/vendor/animejs/modules/animation/index.js';
|
||||
import { remove, set } from '../../assets/vendor/animejs/modules/utils/index.js';
|
||||
|
||||
const cards = document.querySelectorAll('#tecnologias .platform-marquee__card');
|
||||
const canTilt = window.matchMedia('(hover: hover) and (pointer: fine)').matches;
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
if (cards.length && canTilt && !reduceMotion) {
|
||||
cards.forEach((card) => {
|
||||
const maxRotation = 7;
|
||||
let bounds = null;
|
||||
let frame = 0;
|
||||
let pointerX = 0;
|
||||
let pointerY = 0;
|
||||
|
||||
set(card, { rotateX: 0, rotateY: 0, scale: 1 });
|
||||
card.classList.add('platform-card-tilt-ready');
|
||||
|
||||
const renderTilt = () => {
|
||||
frame = 0;
|
||||
|
||||
if (!bounds) {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedX = Math.max(-1, Math.min(1, ((pointerX - bounds.left) / bounds.width) * 2 - 1));
|
||||
const normalizedY = Math.max(-1, Math.min(1, ((pointerY - bounds.top) / bounds.height) * 2 - 1));
|
||||
|
||||
remove(card);
|
||||
animate(card, {
|
||||
rotateX: normalizedY * -maxRotation,
|
||||
rotateY: normalizedX * maxRotation,
|
||||
scale: 1.055,
|
||||
duration: 320,
|
||||
ease: 'out(3)',
|
||||
});
|
||||
};
|
||||
|
||||
card.addEventListener('pointerenter', (event) => {
|
||||
bounds = card.getBoundingClientRect();
|
||||
pointerX = event.clientX;
|
||||
pointerY = event.clientY;
|
||||
card.classList.add('is-platform-tilting');
|
||||
renderTilt();
|
||||
});
|
||||
|
||||
card.addEventListener('pointermove', (event) => {
|
||||
pointerX = event.clientX;
|
||||
pointerY = event.clientY;
|
||||
|
||||
if (!frame) {
|
||||
frame = window.requestAnimationFrame(renderTilt);
|
||||
}
|
||||
});
|
||||
|
||||
card.addEventListener('pointerleave', () => {
|
||||
if (frame) {
|
||||
window.cancelAnimationFrame(frame);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
bounds = null;
|
||||
card.classList.remove('is-platform-tilting');
|
||||
remove(card);
|
||||
animate(card, {
|
||||
rotateX: 0,
|
||||
rotateY: 0,
|
||||
scale: 1,
|
||||
duration: 620,
|
||||
ease: 'out(4)',
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Anime.js tilt interaction for the front-page platform cards.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function xmartica_platform_card_tilt_assets() {
|
||||
if ( ! is_front_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dir = get_template_directory() . '/parts/platform-card-tilt';
|
||||
$uri = get_template_directory_uri() . '/parts/platform-card-tilt';
|
||||
|
||||
wp_enqueue_style(
|
||||
'xmartica-platform-card-tilt',
|
||||
$uri . '/platform-card-tilt.css',
|
||||
array(),
|
||||
filemtime( $dir . '/platform-card-tilt.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'xmartica-platform-card-tilt',
|
||||
$uri . '/platform-card-tilt.js',
|
||||
array(),
|
||||
filemtime( $dir . '/platform-card-tilt.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'xmartica_platform_card_tilt_assets' );
|
||||
|
||||
function xmartica_platform_card_tilt_module_tag( $tag, $handle, $src ) {
|
||||
if ( 'xmartica-platform-card-tilt' !== $handle ) {
|
||||
return $tag;
|
||||
}
|
||||
|
||||
return '<script type="module" src="' . esc_url( $src ) . '"></script>';
|
||||
}
|
||||
add_filter( 'script_loader_tag', 'xmartica_platform_card_tilt_module_tag', 10, 3 );
|
||||
@@ -0,0 +1,95 @@
|
||||
#soluciones .practice-card-list {
|
||||
perspective: 1200px;
|
||||
perspective-origin: center;
|
||||
}
|
||||
|
||||
#soluciones .practice-card-link {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 3;
|
||||
display: block;
|
||||
border-radius: inherit;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Keep the full-card link above the text layers introduced by the spotlight. */
|
||||
body.front-page #primary #soluciones .practice-card-link {
|
||||
position: absolute;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
#soluciones .practice-card-link:focus-visible {
|
||||
outline: 2px solid #fff;
|
||||
outline-offset: -4px;
|
||||
}
|
||||
|
||||
#soluciones [data-practice-card-tilt]:focus-within {
|
||||
border-color: #fff;
|
||||
background-color: rgba(14, 27, 45, 0.2);
|
||||
-webkit-backdrop-filter: blur(18px) saturate(125%);
|
||||
backdrop-filter: blur(18px) saturate(125%);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||
0 18px 46px rgba(0, 172, 255, 0.16);
|
||||
}
|
||||
|
||||
#soluciones [data-practice-card-tilt] {
|
||||
position: relative;
|
||||
background-color: #0e1b2d;
|
||||
background-image: linear-gradient(121.587deg, rgba(79, 172, 217, 0.5) 3.4209%, rgba(0, 0, 0, 0.5) 122.06%);
|
||||
-webkit-backdrop-filter: blur(0) saturate(100%);
|
||||
backdrop-filter: blur(0) saturate(100%);
|
||||
box-shadow: none;
|
||||
transform-style: preserve-3d;
|
||||
transform-origin: center;
|
||||
backface-visibility: hidden;
|
||||
z-index: 1;
|
||||
transition:
|
||||
border-color 260ms ease,
|
||||
box-shadow 260ms ease,
|
||||
background-color 260ms ease,
|
||||
-webkit-backdrop-filter 260ms ease,
|
||||
backdrop-filter 260ms ease;
|
||||
}
|
||||
|
||||
body.front-page #soluciones.home-solutions--ims [data-practice-card-tilt] {
|
||||
border: 1px solid transparent;
|
||||
background:
|
||||
linear-gradient(121.587deg, rgba(16, 31, 51, 0.98) 3.4209%, rgba(8, 15, 26, 0.98) 122.06%) padding-box,
|
||||
linear-gradient(121.587deg, #ffcd11 3.4209%, #ffffff 122.06%) border-box;
|
||||
}
|
||||
|
||||
body.front-page #soluciones.home-solutions--ims [data-practice-card-tilt]:focus-within,
|
||||
body.front-page #soluciones.home-solutions--ims [data-practice-card-tilt]:hover,
|
||||
body.front-page #soluciones.home-solutions--ims [data-practice-card-tilt].is-tilting {
|
||||
border-color: transparent;
|
||||
background:
|
||||
linear-gradient(121.587deg, rgba(16, 31, 51, 0.9) 3.4209%, rgba(8, 15, 26, 0.9) 122.06%) padding-box,
|
||||
linear-gradient(121.587deg, #ffcd11 3.4209%, #ffffff 122.06%) border-box;
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.18),
|
||||
0 18px 46px rgba(255, 205, 17, 0.14);
|
||||
}
|
||||
|
||||
#soluciones [data-practice-card-tilt].practice-card-tilt-ready {
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
#soluciones [data-practice-card-tilt]:hover,
|
||||
#soluciones [data-practice-card-tilt].is-tilting {
|
||||
z-index: 3;
|
||||
border-color: #fff;
|
||||
background-color: rgba(14, 27, 45, 0.2);
|
||||
-webkit-backdrop-filter: blur(18px) saturate(125%);
|
||||
backdrop-filter: blur(18px) saturate(125%);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||
0 18px 46px rgba(0, 172, 255, 0.16);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse) {
|
||||
#soluciones [data-practice-card-tilt] {
|
||||
transform: none !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { animate } from '../../assets/vendor/animejs/modules/animation/index.js';
|
||||
import { remove, set } from '../../assets/vendor/animejs/modules/utils/index.js';
|
||||
|
||||
const cards = document.querySelectorAll('#soluciones [data-practice-card-tilt]');
|
||||
const canTilt = window.matchMedia('(hover: hover) and (pointer: fine)').matches;
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
if (cards.length && canTilt && !reduceMotion) {
|
||||
cards.forEach((card) => {
|
||||
const maxRotation = 6;
|
||||
let frame = 0;
|
||||
let pointerX = 0;
|
||||
let pointerY = 0;
|
||||
|
||||
set(card, { rotateX: 0, rotateY: 0, scale: 1 });
|
||||
card.classList.add('practice-card-tilt-ready');
|
||||
|
||||
const renderTilt = () => {
|
||||
frame = 0;
|
||||
const bounds = card.getBoundingClientRect();
|
||||
const normalizedX = ((pointerX - bounds.left) / bounds.width) * 2 - 1;
|
||||
const normalizedY = ((pointerY - bounds.top) / bounds.height) * 2 - 1;
|
||||
const rotateX = normalizedY * -maxRotation;
|
||||
const rotateY = normalizedX * maxRotation;
|
||||
|
||||
remove(card);
|
||||
animate(card, {
|
||||
rotateX,
|
||||
rotateY,
|
||||
scale: 1.018,
|
||||
duration: 360,
|
||||
ease: 'out(3)',
|
||||
});
|
||||
};
|
||||
|
||||
card.addEventListener('pointerenter', () => {
|
||||
card.classList.add('is-tilting');
|
||||
});
|
||||
|
||||
card.addEventListener('pointermove', (event) => {
|
||||
pointerX = event.clientX;
|
||||
pointerY = event.clientY;
|
||||
|
||||
if (!frame) {
|
||||
frame = window.requestAnimationFrame(renderTilt);
|
||||
}
|
||||
});
|
||||
|
||||
card.addEventListener('pointerleave', () => {
|
||||
if (frame) {
|
||||
window.cancelAnimationFrame(frame);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
card.classList.remove('is-tilting');
|
||||
remove(card);
|
||||
animate(card, {
|
||||
rotateX: 0,
|
||||
rotateY: 0,
|
||||
scale: 1,
|
||||
duration: 700,
|
||||
ease: 'out(4)',
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Anime.js pointer tilt for the front-page practice cards.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function xmartica_practice_card_tilt_assets() {
|
||||
if ( ! is_front_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dir = get_template_directory() . '/parts/practice-card-tilt';
|
||||
$uri = get_template_directory_uri() . '/parts/practice-card-tilt';
|
||||
|
||||
wp_enqueue_style(
|
||||
'xmartica-practice-card-tilt',
|
||||
$uri . '/practice-card-tilt.css',
|
||||
array(),
|
||||
filemtime( $dir . '/practice-card-tilt.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'xmartica-practice-card-tilt',
|
||||
$uri . '/practice-card-tilt.js',
|
||||
array(),
|
||||
filemtime( $dir . '/practice-card-tilt.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'xmartica_practice_card_tilt_assets' );
|
||||
|
||||
function xmartica_practice_card_tilt_module_tag( $tag, $handle, $src ) {
|
||||
if ( 'xmartica-practice-card-tilt' !== $handle ) {
|
||||
return $tag;
|
||||
}
|
||||
|
||||
return '<script type="module" src="' . esc_url( $src ) . '"></script>';
|
||||
}
|
||||
add_filter( 'script_loader_tag', 'xmartica_practice_card_tilt_module_tag', 10, 3 );
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Top scroll progress from trivelta (.tv-prog).
|
||||
Color: left #c9a24b, right #2f6bff. */
|
||||
|
||||
.scroll-progress {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10000;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
transform-origin: 0 50%;
|
||||
transform: scaleX(0);
|
||||
background: linear-gradient(90deg, #c9a24b, #2f6bff);
|
||||
opacity: 0.9;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.scroll-progress {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/* Top scroll progress from trivelta: the bar fills as the page scrolls. */
|
||||
(function () {
|
||||
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
var bar = document.createElement('div');
|
||||
bar.className = 'scroll-progress';
|
||||
bar.setAttribute('aria-hidden', 'true');
|
||||
document.body.appendChild(bar);
|
||||
|
||||
function onScroll() {
|
||||
var scrolled = window.scrollY || window.pageYOffset;
|
||||
var max = document.documentElement.scrollHeight - window.innerHeight;
|
||||
var progress = max > 0 ? Math.min(1, scrolled / max) : 0;
|
||||
|
||||
bar.style.transform = 'scaleX(' + progress + ')';
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', onScroll, { passive: true });
|
||||
window.addEventListener('resize', onScroll);
|
||||
onScroll();
|
||||
}());
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Top scroll progress bar from trivelta.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_scroll_progress_assets() {
|
||||
$dir = get_template_directory() . '/parts/scroll-progress';
|
||||
$uri = get_template_directory_uri() . '/parts/scroll-progress';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-scroll-progress',
|
||||
$uri . '/scroll-progress.css',
|
||||
array(),
|
||||
filemtime( $dir . '/scroll-progress.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-scroll-progress',
|
||||
$uri . '/scroll-progress.js',
|
||||
array(),
|
||||
filemtime( $dir . '/scroll-progress.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_scroll_progress_assets' );
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Lenis smooth scroll (from trivelta-html). Native smooth scroll fights Lenis. */
|
||||
|
||||
html.lenis,
|
||||
html.lenis body {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.lenis.lenis-smooth {
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
|
||||
.lenis.lenis-smooth [data-lenis-prevent] {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.lenis.lenis-stopped {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lenis.lenis-scrolling iframe {
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/* Lenis smooth scroll from trivelta-html: lerp 0.09, wheel only.
|
||||
Same-page hashes use absolute URLs in WordPress, so those scroll too. */
|
||||
(function () {
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
if (reduceMotion || !window.Lenis) {
|
||||
return;
|
||||
}
|
||||
|
||||
var lenis = new window.Lenis({
|
||||
lerp: 0.09,
|
||||
smoothWheel: true,
|
||||
smoothTouch: false
|
||||
});
|
||||
|
||||
function raf(time) {
|
||||
lenis.raf(time);
|
||||
window.requestAnimationFrame(raf);
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(raf);
|
||||
|
||||
function anchorOffset() {
|
||||
var header = document.querySelector('header');
|
||||
|
||||
if (!header) {
|
||||
return -70;
|
||||
}
|
||||
|
||||
var position = window.getComputedStyle(header).position;
|
||||
|
||||
if (position === 'fixed' || position === 'sticky') {
|
||||
return -Math.round(header.getBoundingClientRect().height);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
if (event.defaultPrevented || event.button) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
var anchor = event.target.closest ? event.target.closest('a') : null;
|
||||
|
||||
if (!anchor || (anchor.target && anchor.target !== '_self')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url;
|
||||
|
||||
try {
|
||||
url = new URL(anchor.href, window.location.href);
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!url.hash || url.hash === '#') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.origin !== window.location.origin || url.pathname !== window.location.pathname || url.search !== window.location.search) {
|
||||
return;
|
||||
}
|
||||
|
||||
var target = document.querySelector(url.hash);
|
||||
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
lenis.scrollTo(target, {
|
||||
offset: anchorOffset(),
|
||||
duration: 1.1
|
||||
});
|
||||
});
|
||||
}());
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Lenis smooth scroll, same setup as trivelta-html.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_smooth_scroll_assets() {
|
||||
$dir = get_template_directory() . '/parts/smooth-scroll';
|
||||
$uri = get_template_directory_uri() . '/parts/smooth-scroll';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-smooth-scroll',
|
||||
$uri . '/smooth-scroll.css',
|
||||
array(),
|
||||
filemtime( $dir . '/smooth-scroll.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'lenis',
|
||||
'https://cdn.jsdelivr.net/npm/lenis@1.1.14/dist/lenis.min.js',
|
||||
array(),
|
||||
'1.1.14',
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-smooth-scroll',
|
||||
$uri . '/smooth-scroll.js',
|
||||
array( 'lenis' ),
|
||||
filemtime( $dir . '/smooth-scroll.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_smooth_scroll_assets' );
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
[data-anime-scroll-title].anime-scroll-title-ready [data-word] {
|
||||
will-change: transform, opacity;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
/* splitText creates transformed word wrappers. Reapply the original title
|
||||
gradient to those wrappers so background-clip remains visible while moving. */
|
||||
[data-anime-scroll-title] [data-anime-title-gradient] [data-word] {
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
[data-anime-scroll-title] [data-anime-title-gradient-continuous] [data-word] {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
[data-anime-scroll-title] [data-word] {
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
import { animate } from '../../assets/vendor/animejs/modules/animation/index.js';
|
||||
import { splitText } from '../../assets/vendor/animejs/modules/text/index.js';
|
||||
import { remove, set, stagger } from '../../assets/vendor/animejs/modules/utils/index.js';
|
||||
|
||||
const titles = document.querySelectorAll('[data-anime-scroll-title]');
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
if (titles.length && !reduceMotion) {
|
||||
const initTitleAnimation = (title) => {
|
||||
const gradientSources = Array.from(title.querySelectorAll('[class*="bg-gradient-to-r"]')).map((element, index) => {
|
||||
element.setAttribute('data-anime-title-gradient', String(index));
|
||||
return {
|
||||
index,
|
||||
backgroundImage: window.getComputedStyle(element).backgroundImage,
|
||||
continuous: element.hasAttribute('data-anime-title-gradient-continuous'),
|
||||
};
|
||||
});
|
||||
|
||||
const split = splitText(title, {
|
||||
words: {
|
||||
wrap: 'clip',
|
||||
class: 'solutions-title-word',
|
||||
},
|
||||
accessible: true,
|
||||
});
|
||||
const words = split.words;
|
||||
|
||||
if (!words.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
title.classList.add('anime-scroll-title-ready');
|
||||
|
||||
const applyTitleGradients = () => {
|
||||
gradientSources.forEach((gradient) => {
|
||||
const gradientElement = Array.from(
|
||||
title.querySelectorAll(`[data-anime-title-gradient="${gradient.index}"]`)
|
||||
).find((element) => element.querySelector('[data-word]'));
|
||||
|
||||
if (!gradientElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const gradientRect = gradientElement.getBoundingClientRect();
|
||||
|
||||
gradientElement.querySelectorAll('[data-word]').forEach((word) => {
|
||||
word.style.backgroundImage = gradient.backgroundImage;
|
||||
|
||||
if (!gradient.continuous || gradientRect.width <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const wordRect = word.getBoundingClientRect();
|
||||
word.style.backgroundSize = `${gradientRect.width}px 100%`;
|
||||
word.style.backgroundPosition = `${gradientRect.left - wordRect.left}px 0`;
|
||||
word.style.backgroundRepeat = 'no-repeat';
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
applyTitleGradients();
|
||||
|
||||
if ('ResizeObserver' in window && gradientSources.some((gradient) => gradient.continuous)) {
|
||||
const gradientResizeObserver = new ResizeObserver(() => {
|
||||
window.requestAnimationFrame(applyTitleGradients);
|
||||
});
|
||||
gradientResizeObserver.observe(title);
|
||||
}
|
||||
|
||||
set(words, { opacity: 0, y: '110%' });
|
||||
|
||||
const reveal = (origin) => {
|
||||
remove(words);
|
||||
set(words, { opacity: 0, y: origin });
|
||||
animate(words, {
|
||||
opacity: [0, 1],
|
||||
y: [origin, '0%'],
|
||||
duration: 760,
|
||||
delay: stagger(65),
|
||||
ease: 'out(4)',
|
||||
});
|
||||
};
|
||||
|
||||
const conceal = (destination) => {
|
||||
remove(words);
|
||||
animate(words, {
|
||||
opacity: 0,
|
||||
y: destination,
|
||||
duration: 440,
|
||||
delay: stagger(34, { from: 'last' }),
|
||||
ease: 'in(3)',
|
||||
});
|
||||
};
|
||||
|
||||
let lastScrollPosition = window.scrollY;
|
||||
let isVisible = false;
|
||||
let introObserver = null;
|
||||
|
||||
const revealWhenReady = (origin) => {
|
||||
if (title.id !== 'home-hero-title' || !document.getElementById('xmartica-intro')) {
|
||||
reveal(origin);
|
||||
return;
|
||||
}
|
||||
|
||||
introObserver = new MutationObserver(() => {
|
||||
if (!document.getElementById('xmartica-intro')) {
|
||||
introObserver.disconnect();
|
||||
introObserver = null;
|
||||
if (isVisible) {
|
||||
reveal(origin);
|
||||
}
|
||||
}
|
||||
});
|
||||
introObserver.observe(document.body, { childList: true });
|
||||
};
|
||||
|
||||
const viewportObserver = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
const currentScrollPosition = window.scrollY;
|
||||
const isScrollingBackward = currentScrollPosition < lastScrollPosition;
|
||||
|
||||
if (entry.isIntersecting && !isVisible) {
|
||||
isVisible = true;
|
||||
revealWhenReady(isScrollingBackward ? '-110%' : '110%');
|
||||
} else if (!entry.isIntersecting && isVisible) {
|
||||
if (introObserver) {
|
||||
introObserver.disconnect();
|
||||
introObserver = null;
|
||||
}
|
||||
conceal(isScrollingBackward ? '110%' : '-110%');
|
||||
isVisible = false;
|
||||
}
|
||||
|
||||
lastScrollPosition = currentScrollPosition;
|
||||
});
|
||||
}, {
|
||||
threshold: 0.2,
|
||||
});
|
||||
|
||||
viewportObserver.observe(title);
|
||||
};
|
||||
|
||||
const initTitleAnimations = () => {
|
||||
titles.forEach(initTitleAnimation);
|
||||
};
|
||||
|
||||
if (document.fonts && document.fonts.ready) {
|
||||
document.fonts.ready.then(initTitleAnimations);
|
||||
} else {
|
||||
initTitleAnimations();
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Scroll-driven Anime.js animation for the front-page solutions title.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function xmartica_solutions_title_animation_assets() {
|
||||
if ( ! is_front_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dir = get_template_directory() . '/parts/solutions-title-animation';
|
||||
$uri = get_template_directory_uri() . '/parts/solutions-title-animation';
|
||||
|
||||
wp_enqueue_style(
|
||||
'xmartica-solutions-title-animation',
|
||||
$uri . '/solutions-title-animation.css',
|
||||
array(),
|
||||
filemtime( $dir . '/solutions-title-animation.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'xmartica-solutions-title-animation',
|
||||
$uri . '/solutions-title-animation.js',
|
||||
array(),
|
||||
filemtime( $dir . '/solutions-title-animation.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'xmartica_solutions_title_animation_assets' );
|
||||
|
||||
function xmartica_solutions_title_module_tag( $tag, $handle, $src ) {
|
||||
if ( 'xmartica-solutions-title-animation' !== $handle ) {
|
||||
return $tag;
|
||||
}
|
||||
|
||||
return '<script type="module" src="' . esc_url( $src ) . '"></script>';
|
||||
}
|
||||
add_filter( 'script_loader_tag', 'xmartica_solutions_title_module_tag', 10, 3 );
|
||||
@@ -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