cambios postproduccion

This commit is contained in:
2026-09-21 11:08:17 -03:00
parent e36ec1e8ca
commit 3b38b9b760
20 changed files with 128 additions and 123 deletions
+33 -31
View File
@@ -1,19 +1,21 @@
/**
* Envío AJAX del formulario de contacto + modal de éxito.
* Envío de formulario de contacto con Formspree + modal de éxito.
*/
(function () {
'use strict';
const form = document.getElementById('form-contacto');
const modal = document.getElementById('modal-contacto');
const form = document.getElementById('form-contacto');
const modal = document.getElementById('modal-contacto');
const btnCerrar = modal ? modal.querySelector('.modal-cerrar') : null;
const btnEnviar = form ? form.querySelector('button[type="submit"]') : null;
if (!form || !modal) return;
const FORMSPREE_URL = 'https://formspree.io/f/xkjgjzpn';
let redirectTimer = null;
// ── Helpers ────────────────────────────────────────────────────────
// ── Helpers ───────────────────────────────────────────────────────
function abrirModal(mensaje) {
const texto = modal.querySelector('.modal-mensaje');
if (texto && mensaje) texto.textContent = mensaje;
@@ -21,7 +23,7 @@
modal.setAttribute('aria-hidden', 'false');
document.body.style.overflow = 'hidden';
}
function cerrarModal(redirigir = false) {
modal.classList.remove('is-visible');
modal.setAttribute('aria-hidden', 'true');
@@ -29,67 +31,67 @@
if (redirectTimer) clearTimeout(redirectTimer);
if (redirigir) window.location.href = 'index.html';
}
function mostrarError(mensaje) {
// Reutilizamos el modal con estética distinta
modal.classList.add('is-error');
abrirModal(mensaje);
}
// ── Cerrar modal ───────────────────────────────────────────────────
if (btnCerrar) {
btnCerrar.addEventListener('click', () => cerrarModal(true));
}
modal.addEventListener('click', (e) => {
if (e.target === modal) cerrarModal(true);
});
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && modal.classList.contains('is-visible')) {
cerrarModal(true);
}
});
// ── Submit ─────────────────────────────────────────────────────────
form.addEventListener('submit', async (e) => {
e.preventDefault();
// Validación nativa HTML5
if (!form.checkValidity()) {
form.reportValidity();
return;
}
// Estado de carga
const textoOriginal = btnEnviar ? btnEnviar.innerHTML : '';
if (btnEnviar) {
btnEnviar.disabled = true;
btnEnviar.innerHTML = 'Enviando…';
}
try {
const data = new FormData(form);
const res = await fetch('enviar.php', {
const res = await fetch(FORMSPREE_URL, {
method: 'POST',
body: data,
headers: { 'X-Requested-With': 'XMLHttpRequest' },
headers: {
'Accept': 'application/json'
}
});
const json = await res.json().catch(() => ({
status: 'error',
message: 'Respuesta inválida del servidor.',
}));
if (json.status === 'success') {
if (res.ok) {
modal.classList.remove('is-error');
abrirModal(json.message || '¡Gracias! Te contactaremos en breve.');
abrirModal('¡Mensaje enviado! Te contactaremos en menos de 48 horas hábiles.');
form.reset();
const delay = Number(json.delay) || 4000;
// Redirección automática después de 4 segundos
redirectTimer = setTimeout(() => {
window.location.href = json.redirect || 'index.html';
}, delay);
window.location.href = 'index.html';
}, 4000);
} else {
mostrarError(json.message || 'No pudimos enviar tu mensaje.');
const json = await res.json().catch(() => ({}));
mostrarError(json.error || 'No pudimos enviar tu mensaje. Intentá nuevamente.');
}
} catch (err) {
mostrarError('Hubo un problema de conexión. Probá nuevamente.');
+26 -26
View File
@@ -1,6 +1,6 @@
"use strict";
// ===== CONFIGURACIÓN DEL EFECTO (Idéntica a fluid - copia.js) =====
// ===== CONFIGURACIÓN DEL EFECTO (Parámetros calibrados de fluid - copia.js) =====
const config = {
TEXTURE_DOWNSAMPLE: 1,
DENSITY_DISSIPATION: 0.975,
@@ -16,15 +16,15 @@ function getBrandColors() {
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
if (isDark) {
return [
[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)
[0.850, 0.080, 0.380], // Carmesí / Fucsia vivo de marca
[0.050, 0.450, 0.550], // Teal profundo
[0.650, 0.200, 0.450] // Plum medio
];
} else {
return [
[0.729, 0.071, 0.302], // Bordo de marca (#BA124D)
[0.000, 0.247, 0.322], // Teal de marca (#003F52)
[0.780, 0.280, 0.420] // Carmesí (#C7476B)
[0.550, 0.150, 0.280] // Plum suave
];
}
}
@@ -35,7 +35,7 @@ let targetColor = brandColors[1];
let transitionProgress = 0;
const transitionSpeed = 0.008;
// Observador para detectar el switch de tema en tiempo real
// Observador para detectar cambios en data-theme
const themeObserver = new MutationObserver(() => {
brandColors = getBrandColors();
currentColor = brandColors[0];
@@ -66,7 +66,7 @@ let pointers = [];
function getWebGLContext(canvas) {
let params = {
alpha: true, // Transparente para respetar el fondo CSS
premultipliedAlpha: false, // Clave para composición limpia sobre el fondo
premultipliedAlpha: false, // Clave para evitar bordes oscuros o quemados
depth: false,
stencil: false,
antialias: false
@@ -120,7 +120,7 @@ function pointerPrototype() {
}
pointers.push(new pointerPrototype());
// ===== SHADERS BASE =====
// ===== SHADERS =====
let GLProgram = (function () {
function GLProgram(vertexShader, fragmentShader) {
if (!(this instanceof GLProgram)) throw new TypeError("Cannot call a class as a function");
@@ -160,7 +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
// SHADER DE VISUALIZACIÓN: compatible con GLSL ES 1.0 y libre de blanqueo
let displayShader = compileShader(
gl.FRAGMENT_SHADER,
`precision highp float;
@@ -171,22 +171,25 @@ let displayShader = compileShader(
void main () {
vec4 c = texture2D(uTexture, vUv);
float density = max(c.r, max(c.g, c.b));
float len = length(c.rgb);
if (density < 0.001) {
gl_FragColor = vec4(0.0);
// Sintaxis 100% compatible con WebGL 1 y 2 (4 componentes)
if (len < 0.001) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
return;
}
// Normalización cromática: conserva el matiz puro de la marca y previene el blanco
vec3 pureColor = c.rgb / len;
if (uIsDark > 0.5) {
// 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);
// MODO OSCURO: color rico con presencia viva sin deslumbrar
float alpha = clamp(len * 1.8, 0.0, 0.80);
gl_FragColor = vec4(pureColor, alpha);
} else {
// 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);
// MODO CLARO: tinte traslúcido tipo acuarela
float alpha = clamp(len * 1.2, 0.0, 0.38);
gl_FragColor = vec4(pureColor, alpha);
}
}`
);
@@ -211,7 +214,6 @@ 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); }"
@@ -316,12 +318,13 @@ function splat(x, y, dx, dy, color) {
velocity.swap();
gl.uniform1i(splatProgram.uniforms.uTarget, density.first[2]);
gl.uniform3f(splatProgram.uniforms.color, color[0] * 0.35, color[1] * 0.35, color[2] * 0.35);
// Inyección equilibrada
gl.uniform3f(splatProgram.uniforms.color, color[0] * 0.28, color[1] * 0.28, color[2] * 0.28);
blit(density.second[1]);
density.swap();
}
// ===== RESIZE SIN DESFASES =====
// ===== RESIZE =====
function resizeCanvas() {
if (canvas.width !== canvas.clientWidth || canvas.height !== canvas.clientHeight) {
canvas.width = canvas.clientWidth;
@@ -345,7 +348,7 @@ function isMouseOverTextElement(target) {
return false;
}
// ===== CONTROL DE MOUSE CENTRADO Y SIMÉTRICO =====
// ===== CAPTURA DE MOUSE SIMÉTRICA Y CENTRADA =====
let isFirstMove = true;
document.addEventListener("mousemove", function (e) {
@@ -353,7 +356,6 @@ document.addEventListener("mousemove", function (e) {
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;
@@ -381,7 +383,6 @@ document.addEventListener("mousemove", function (e) {
pointers[0].color = colorArr;
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;
@@ -513,7 +514,6 @@ function update() {
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);