cambios php
This commit is contained in:
+2
-2
@@ -27,7 +27,7 @@
|
||||
modal.setAttribute('aria-hidden', 'true');
|
||||
document.body.style.overflow = '';
|
||||
if (redirectTimer) clearTimeout(redirectTimer);
|
||||
if (redirigir) window.location.href = 'inicio.html';
|
||||
if (redirigir) window.location.href = 'index.html';
|
||||
}
|
||||
|
||||
function mostrarError(mensaje) {
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
const delay = Number(json.delay) || 4000;
|
||||
redirectTimer = setTimeout(() => {
|
||||
window.location.href = json.redirect || 'inicio.html';
|
||||
window.location.href = json.redirect || 'index.html';
|
||||
}, delay);
|
||||
} else {
|
||||
mostrarError(json.message || 'No pudimos enviar tu mensaje.');
|
||||
|
||||
+84
-110
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
// ===== CONFIGURACIÓN DEL EFECTO =====
|
||||
// ===== CONFIGURACIÓN DEL EFECTO (Idéntica a fluid - copia.js) =====
|
||||
const config = {
|
||||
TEXTURE_DOWNSAMPLE: 1,
|
||||
DENSITY_DISSIPATION: 0.975,
|
||||
@@ -11,22 +11,20 @@ const config = {
|
||||
SPLAT_RADIUS: 0.003
|
||||
};
|
||||
|
||||
// ===== COLORES DE MARCA (Modo Claro / Oscuro) =====
|
||||
// ===== COLORES DE MARCA SEGÚN EL TEMA =====
|
||||
function getBrandColors() {
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
if (isDark) {
|
||||
// Tonos luminiscentes y vibrantes para contrastar sobre #110916
|
||||
return [
|
||||
[0.920, 0.120, 0.420], // Carmesí brillante (#EA1E6B)
|
||||
[0.050, 0.680, 0.780], // Teal cian luminoso (#0DAEC7)
|
||||
[0.850, 0.550, 0.700] // Rosa suave (#D98CB3)
|
||||
[0.920, 0.120, 0.420], // Carmesí / Fucsia luminoso (#EA1E6B)
|
||||
[0.080, 0.650, 0.780], // Teal cian luminoso (#14A6C7)
|
||||
[0.850, 0.500, 0.720] // Rosa suave (#D980B8)
|
||||
];
|
||||
} else {
|
||||
// Tonos puros y elegantes para teñir el fondo claro sin ensuciarlo
|
||||
return [
|
||||
[0.729, 0.071, 0.302], // Bordo de marca (#BA124D)
|
||||
[0.000, 0.320, 0.420], // Teal medio (#00526B)
|
||||
[0.780, 0.280, 0.400] // Rosa carmesí (#C74766)
|
||||
[0.000, 0.247, 0.322], // Teal de marca (#003F52)
|
||||
[0.780, 0.280, 0.420] // Carmesí (#C7476B)
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -37,8 +35,7 @@ let targetColor = brandColors[1];
|
||||
let transitionProgress = 0;
|
||||
const transitionSpeed = 0.008;
|
||||
|
||||
// Observar cambios de tema: actualiza paleta y reinicia transición de color.
|
||||
// El fondo CSS cambia automáticamente (el canvas es transparente, el fondo del <html> se ve a través).
|
||||
// Observador para detectar el switch de tema en tiempo real
|
||||
const themeObserver = new MutationObserver(() => {
|
||||
brandColors = getBrandColors();
|
||||
currentColor = brandColors[0];
|
||||
@@ -59,18 +56,17 @@ function lerpColor(colorA, colorB, t) {
|
||||
let canvas = document.getElementById("fluidCanvas");
|
||||
if (!canvas) {
|
||||
console.error("ERROR: No se encontró el canvas con id 'fluidCanvas'");
|
||||
} else {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
}
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
|
||||
// ===== CONTEXTO WEBGL =====
|
||||
// ===== CONTEXTO WEBGL TRANSPARENTE =====
|
||||
let pointers = [];
|
||||
|
||||
function getWebGLContext(canvas) {
|
||||
let params = {
|
||||
alpha: true, // Canvas transparente: el fondo CSS se ve a través
|
||||
premultipliedAlpha: false, // CLAVE: colores sin premultiplicar para composición correcta
|
||||
alpha: true, // Transparente para respetar el fondo CSS
|
||||
premultipliedAlpha: false, // Clave para composición limpia sobre el fondo
|
||||
depth: false,
|
||||
stencil: false,
|
||||
antialias: false
|
||||
@@ -79,22 +75,21 @@ function getWebGLContext(canvas) {
|
||||
let isWebGL2 = !!gl;
|
||||
if (!isWebGL2)
|
||||
gl = canvas.getContext("webgl", params) || canvas.getContext("experimental-webgl", params);
|
||||
|
||||
|
||||
let halfFloat = gl.getExtension("OES_texture_half_float");
|
||||
let support_linear_float = gl.getExtension("OES_texture_half_float_linear");
|
||||
if (isWebGL2) {
|
||||
gl.getExtension("EXT_color_buffer_float");
|
||||
support_linear_float = gl.getExtension("OES_texture_float_linear");
|
||||
}
|
||||
|
||||
// ✅ CLAVE: Fondo transparente para que se vea el color del body
|
||||
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
|
||||
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
let internalFormat = isWebGL2 ? gl.RGBA16F : gl.RGBA;
|
||||
let internalFormatRG = isWebGL2 ? gl.RG16F : gl.RGBA;
|
||||
let formatRG = isWebGL2 ? gl.RG : gl.RGBA;
|
||||
let texType = isWebGL2 ? gl.HALF_FLOAT : halfFloat.HALF_FLOAT_OES;
|
||||
|
||||
|
||||
return {
|
||||
gl: gl,
|
||||
ext: {
|
||||
@@ -125,7 +120,7 @@ function pointerPrototype() {
|
||||
}
|
||||
pointers.push(new pointerPrototype());
|
||||
|
||||
// ===== SHADERS =====
|
||||
// ===== SHADERS BASE =====
|
||||
let GLProgram = (function () {
|
||||
function GLProgram(vertexShader, fragmentShader) {
|
||||
if (!(this instanceof GLProgram)) throw new TypeError("Cannot call a class as a function");
|
||||
@@ -165,6 +160,7 @@ let clearShader = compileShader(
|
||||
"precision highp float; precision mediump sampler2D; varying vec2 vUv; uniform sampler2D uTexture; uniform float value; void main () { gl_FragColor = value * texture2D(uTexture, vUv); }"
|
||||
);
|
||||
|
||||
// SHADER DE VISUALIZACIÓN ADAPTATIVO AL FONDO Y TEMA
|
||||
let displayShader = compileShader(
|
||||
gl.FRAGMENT_SHADER,
|
||||
`precision highp float;
|
||||
@@ -175,24 +171,22 @@ let displayShader = compileShader(
|
||||
|
||||
void main () {
|
||||
vec4 c = texture2D(uTexture, vUv);
|
||||
float maxC = max(c.r, max(c.g, c.b));
|
||||
if (maxC < 0.001) {
|
||||
float density = max(c.r, max(c.g, c.b));
|
||||
|
||||
if (density < 0.001) {
|
||||
gl_FragColor = vec4(0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Normalizamos el tono cromático para conservar la saturación original
|
||||
vec3 nColor = c.rgb / maxC;
|
||||
|
||||
if (uIsDark > 0.5) {
|
||||
// MODO OSCURO: fluido con mayor presencia y brillo
|
||||
float alpha = clamp(maxC * 2.5, 0.0, 0.70);
|
||||
vec3 glow = clamp(nColor * 1.2, 0.0, 1.0);
|
||||
gl_FragColor = vec4(glow, alpha);
|
||||
// MODO OSCURO: Núcleo luminoso y bordes de humo orgánico
|
||||
float alpha = clamp(density * 2.2, 0.0, 0.90);
|
||||
vec3 rgb = c.rgb * (1.15 + density * 1.3);
|
||||
gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
|
||||
} else {
|
||||
// MODO CLARO: tinte traslúcido suave que no satura el fondo sage-light
|
||||
float alpha = clamp(maxC * 1.5, 0.0, 0.35);
|
||||
gl_FragColor = vec4(nColor, alpha);
|
||||
// MODO CLARO: Tinte de acuarela suave que no ensucia el fondo claro
|
||||
float alpha = clamp(density * 1.35, 0.0, 0.45);
|
||||
gl_FragColor = vec4(c.rgb, alpha);
|
||||
}
|
||||
}`
|
||||
);
|
||||
@@ -217,6 +211,7 @@ let divergenceShader = compileShader(
|
||||
"precision highp float; precision mediump sampler2D; varying vec2 vUv; varying vec2 vL; varying vec2 vR; varying vec2 vT; varying vec2 vB; uniform sampler2D uVelocity; vec2 sampleVelocity (in vec2 uv) { vec2 multiplier = vec2(1.0, 1.0); if (uv.x < 0.0) { uv.x = 0.0; multiplier.x = -1.0; } if (uv.x > 1.0) { uv.x = 1.0; multiplier.x = -1.0; } if (uv.y < 0.0) { uv.y = 0.0; multiplier.y = -1.0; } if (uv.y > 1.0) { uv.y = 1.0; multiplier.y = -1.0; } return multiplier * texture2D(uVelocity, uv).xy; } void main () { float L = sampleVelocity(vL).x; float R = sampleVelocity(vR).x; float T = sampleVelocity(vT).y; float B = sampleVelocity(vB).y; float div = 0.5 * (R - L + T - B); gl_FragColor = vec4(div, 0.0, 0.0, 1.0); }"
|
||||
);
|
||||
|
||||
// RESTAURACIÓN EXACTA DE LA FÍSICA DE COPIA (Sin inversión de ejes)
|
||||
let curlShader = compileShader(
|
||||
gl.FRAGMENT_SHADER,
|
||||
"precision highp float; precision mediump sampler2D; varying vec2 vUv; varying vec2 vL; varying vec2 vR; varying vec2 vT; varying vec2 vB; uniform sampler2D uVelocity; void main () { float L = texture2D(uVelocity, vL).y; float R = texture2D(uVelocity, vR).y; float T = texture2D(uVelocity, vT).x; float B = texture2D(uVelocity, vB).x; float vorticity = R - L - T + B; gl_FragColor = vec4(vorticity, 0.0, 0.0, 1.0); }"
|
||||
@@ -321,18 +316,16 @@ function splat(x, y, dx, dy, color) {
|
||||
velocity.swap();
|
||||
|
||||
gl.uniform1i(splatProgram.uniforms.uTarget, density.first[2]);
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
const densityIntensity = isDark ? 0.65 : 0.45;
|
||||
gl.uniform3f(splatProgram.uniforms.color, color[0] * densityIntensity, color[1] * densityIntensity, color[2] * densityIntensity);
|
||||
gl.uniform3f(splatProgram.uniforms.color, color[0] * 0.35, color[1] * 0.35, color[2] * 0.35);
|
||||
blit(density.second[1]);
|
||||
density.swap();
|
||||
}
|
||||
|
||||
// ===== RESIZE =====
|
||||
// ===== RESIZE SIN DESFASES =====
|
||||
function resizeCanvas() {
|
||||
if (canvas.width !== window.innerWidth || canvas.height !== window.innerHeight) {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
if (canvas.width !== canvas.clientWidth || canvas.height !== canvas.clientHeight) {
|
||||
canvas.width = canvas.clientWidth;
|
||||
canvas.height = canvas.clientHeight;
|
||||
initFramebuffers();
|
||||
}
|
||||
}
|
||||
@@ -343,7 +336,8 @@ let count = 0;
|
||||
// ===== DETECTAR ELEMENTOS DE TEXTO =====
|
||||
function isMouseOverTextElement(target) {
|
||||
const textSelectors = [
|
||||
'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'span', 'button', '.btn', '.card-content', '.hero-content'
|
||||
'p', '.hero-content p', 'h1', 'h2', 'h3', 'h4', 'h5', '.hero-content h1',
|
||||
'.hero-content h2', '.eyebrow', 'a', 'button', '.btn', '.servicio-item', '.plan-card'
|
||||
];
|
||||
for (const selector of textSelectors) {
|
||||
if (target.closest(selector)) return true;
|
||||
@@ -351,10 +345,24 @@ function isMouseOverTextElement(target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===== EVENTOS CON COLORES DE MARCA =====
|
||||
// ===== CONTROL DE MOUSE CENTRADO Y SIMÉTRICO =====
|
||||
let isFirstMove = true;
|
||||
|
||||
document.addEventListener("mousemove", function (e) {
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const currentX = e.clientX - rect.left;
|
||||
const currentY = e.clientY - rect.top;
|
||||
|
||||
// Evita el salto o raya diagonal al entrar por primera vez
|
||||
if (isFirstMove) {
|
||||
pointers[0].x = currentX;
|
||||
pointers[0].y = currentY;
|
||||
isFirstMove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const overText = isMouseOverTextElement(e.target);
|
||||
|
||||
|
||||
count++;
|
||||
if (count > 1) {
|
||||
transitionProgress += transitionSpeed;
|
||||
@@ -371,15 +379,20 @@ document.addEventListener("mousemove", function (e) {
|
||||
|
||||
pointers[0].down = true;
|
||||
pointers[0].color = colorArr;
|
||||
pointers[0].moved = pointers[0].down;
|
||||
|
||||
// ✅ CLAVE: Reducir la fuerza del fluido sobre texto para no dificultar la lectura
|
||||
const multiplier = overText ? 4.0 : 10.0;
|
||||
|
||||
pointers[0].dx = (e.clientX - pointers[0].x) * multiplier;
|
||||
pointers[0].dy = (e.clientY - pointers[0].y) * multiplier;
|
||||
pointers[0].x = e.clientX;
|
||||
pointers[0].y = e.clientY;
|
||||
pointers[0].moved = true;
|
||||
|
||||
// Multiplicador simétrico de fluid - copia.js (10.0 en fondo, 8.0 en texto)
|
||||
const multiplier = overText ? 8.0 : 10.0;
|
||||
|
||||
pointers[0].dx = (currentX - pointers[0].x) * multiplier;
|
||||
pointers[0].dy = (currentY - pointers[0].y) * multiplier;
|
||||
pointers[0].x = currentX;
|
||||
pointers[0].y = currentY;
|
||||
});
|
||||
|
||||
window.addEventListener("mouseleave", function () {
|
||||
isFirstMove = true;
|
||||
pointers[0].moved = false;
|
||||
});
|
||||
|
||||
canvas.addEventListener("touchmove", function (e) {
|
||||
@@ -398,20 +411,24 @@ canvas.addEventListener("touchmove", function (e) {
|
||||
colorArr = lerpColor(currentColor, targetColor, transitionProgress);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
for (let i = 0, len = touches.length; i < len; i++) {
|
||||
if (i >= pointers.length) pointers.push(new pointerPrototype());
|
||||
let pointer = pointers[i];
|
||||
let touchX = touches[i].clientX - rect.left;
|
||||
let touchY = touches[i].clientY - rect.top;
|
||||
|
||||
pointer.id = touches[i].identifier;
|
||||
pointer.down = true;
|
||||
pointer.color = colorArr;
|
||||
pointer.moved = true;
|
||||
pointer.dx = (touches[i].pageX - pointer.x) * 10.0;
|
||||
pointer.dy = (touches[i].pageY - pointer.y) * 10.0;
|
||||
pointer.x = touches[i].pageX;
|
||||
pointer.y = touches[i].pageY;
|
||||
pointer.dx = (touchX - pointer.x) * 10.0;
|
||||
pointer.dy = (touchY - pointer.y) * 10.0;
|
||||
pointer.x = touchX;
|
||||
pointer.y = touchY;
|
||||
}
|
||||
}, { passive: false });
|
||||
}, false);
|
||||
|
||||
// ===== LOOP PRINCIPAL =====
|
||||
let lastTime = Date.now();
|
||||
@@ -495,10 +512,13 @@ function update() {
|
||||
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
|
||||
displayProgram.bind();
|
||||
gl.uniform1i(displayProgram.uniforms.uTexture, density.first[2]);
|
||||
|
||||
// Informar al shader si estamos en modo oscuro
|
||||
const isDarkTheme = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
if (displayProgram.uniforms.uIsDark !== undefined) {
|
||||
gl.uniform1f(displayProgram.uniforms.uIsDark, isDarkTheme ? 1.0 : 0.0);
|
||||
}
|
||||
|
||||
blit(null);
|
||||
|
||||
requestAnimationFrame(update);
|
||||
@@ -506,55 +526,9 @@ function update() {
|
||||
|
||||
update();
|
||||
|
||||
|
||||
/* captura del movimiento del mouse*/
|
||||
let isFirstMove = true;
|
||||
|
||||
document.addEventListener("mousemove", function (e) {
|
||||
if (isFirstMove) {
|
||||
pointers[0].x = e.clientX;
|
||||
pointers[0].y = e.clientY;
|
||||
isFirstMove = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const overText = isMouseOverTextElement(e.target);
|
||||
|
||||
count++;
|
||||
if (count > 1) {
|
||||
transitionProgress += transitionSpeed;
|
||||
if (transitionProgress >= 1) {
|
||||
transitionProgress = 0;
|
||||
let currentIndex = brandColors.indexOf(currentColor);
|
||||
let nextIndex = (currentIndex + 1) % brandColors.length;
|
||||
currentColor = targetColor;
|
||||
targetColor = brandColors[nextIndex];
|
||||
}
|
||||
colorArr = lerpColor(currentColor, targetColor, transitionProgress);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
pointers[0].down = true;
|
||||
pointers[0].color = colorArr;
|
||||
pointers[0].moved = true;
|
||||
|
||||
// Fuerza balanceada sobre el texto y sobre el fondo
|
||||
const multiplier = overText ? 4.0 : 8.0;
|
||||
|
||||
pointers[0].dx = (e.clientX - pointers[0].x) * multiplier;
|
||||
pointers[0].dy = (e.clientY - pointers[0].y) * multiplier;
|
||||
pointers[0].x = e.clientX;
|
||||
pointers[0].y = e.clientY;
|
||||
});
|
||||
|
||||
window.addEventListener("mouseleave", function () {
|
||||
isFirstMove = true;
|
||||
pointers[0].moved = false;
|
||||
});
|
||||
|
||||
// ===== REDIMENSIONAR AL CAMBIAR TAMAÑO DE VENTANA =====
|
||||
// ===== REDIMENSIONAR =====
|
||||
window.addEventListener("resize", function() {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
canvas.width = canvas.clientWidth;
|
||||
canvas.height = canvas.clientHeight;
|
||||
initFramebuffers();
|
||||
});
|
||||
Reference in New Issue
Block a user