feat(ui): refactor fullscreen stages and global ambient matrix rain
This commit is contained in:
parent
52c5f2659f
commit
4bc444b1c8
|
|
@ -7,34 +7,8 @@
|
|||
.contact-section {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
background-color: #121517;
|
||||
padding: clamp(5rem, 8vw, 7rem) 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.contact-matrix-canvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
display: block;
|
||||
background: transparent;
|
||||
opacity: 0;
|
||||
animation: fadeInMatrix 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
||||
}
|
||||
|
||||
@keyframes fadeInMatrix {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 0.65;
|
||||
transform: translateY(0);
|
||||
}
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.contact-container {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
<section class="contact-section" id="contacto" role="region" [attr.aria-label]="i18n.t().contactEyebrow">
|
||||
<!-- Fondo Animado: Lluvia de Código Matrix Verde -->
|
||||
<canvas #rainCanvas class="contact-matrix-canvas" aria-hidden="true"></canvas>
|
||||
|
||||
<div class="contact-container">
|
||||
<!-- Cabecera Normalizada de Sección -->
|
||||
<header class="contact-section-header">
|
||||
|
|
|
|||
|
|
@ -2,12 +2,7 @@ import {
|
|||
Component,
|
||||
ChangeDetectionStrategy,
|
||||
signal,
|
||||
inject,
|
||||
ElementRef,
|
||||
ViewChild,
|
||||
OnInit,
|
||||
AfterViewInit,
|
||||
OnDestroy
|
||||
inject
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ReactiveFormsModule,
|
||||
|
|
@ -20,20 +15,6 @@ import { I18nService } from '../../../application/services/i18n.service';
|
|||
import { GuestbookComponent } from '../guestbook/guestbook.component';
|
||||
import { NOTIFY_WEBHOOK_URL } from '../../../core/tokens/notify-config.token';
|
||||
|
||||
interface DigitalRainColumn {
|
||||
x: number;
|
||||
y: number;
|
||||
speed: number;
|
||||
length: number;
|
||||
opacity: number;
|
||||
characters: string[];
|
||||
}
|
||||
|
||||
const BINARY_CHARS = '01';
|
||||
const HEX_CHARS = '0123456789ABCDEF';
|
||||
const CODE_CHARS = '{}[]()<>&|/\\:;=+-_*#$%@?!~^';
|
||||
const TERM_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
@Component({
|
||||
selector: 'app-contact-section',
|
||||
standalone: true,
|
||||
|
|
@ -42,9 +23,7 @@ const TERM_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|||
styleUrl: './contact-section.component.css',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class ContactSectionComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('rainCanvas') private readonly rainCanvas?: ElementRef<HTMLCanvasElement>;
|
||||
|
||||
export class ContactSectionComponent {
|
||||
protected readonly i18n = inject(I18nService);
|
||||
private readonly http = inject(HttpClient);
|
||||
private readonly notifyWebhookUrl = inject(NOTIFY_WEBHOOK_URL);
|
||||
|
|
@ -76,191 +55,6 @@ export class ContactSectionComponent implements OnInit, AfterViewInit, OnDestroy
|
|||
})
|
||||
});
|
||||
|
||||
private readonly columns: DigitalRainColumn[] = [];
|
||||
private context?: CanvasRenderingContext2D;
|
||||
private animationFrameId?: number;
|
||||
private intersectionObserver?: IntersectionObserver;
|
||||
private resizeObserver?: ResizeObserver;
|
||||
private motionQuery?: MediaQueryList;
|
||||
private isVisible = true;
|
||||
private isReducedMotion = false;
|
||||
private lastFrameTime = 0;
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
if (!this.rainCanvas) return;
|
||||
|
||||
const canvas = this.rainCanvas.nativeElement;
|
||||
this.context = canvas.getContext('2d') ?? undefined;
|
||||
if (!this.context) return;
|
||||
|
||||
this.motionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
this.isReducedMotion = this.motionQuery.matches;
|
||||
this.motionQuery.addEventListener('change', this.onMotionPreferenceChange);
|
||||
|
||||
this.resizeObserver = new ResizeObserver(() => this.resizeCanvas());
|
||||
this.resizeObserver.observe(canvas.parentElement ?? canvas);
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver(([entry]) => {
|
||||
this.isVisible = entry.isIntersecting;
|
||||
if (this.isVisible && !this.isReducedMotion && this.animationFrameId === undefined) {
|
||||
this.lastFrameTime = 0;
|
||||
this.animationFrameId = requestAnimationFrame(this.animate);
|
||||
}
|
||||
}, { threshold: 0.05 });
|
||||
this.intersectionObserver.observe(canvas);
|
||||
|
||||
this.resizeCanvas();
|
||||
if (!this.isReducedMotion) {
|
||||
this.animationFrameId = requestAnimationFrame(this.animate);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.animationFrameId !== undefined) {
|
||||
cancelAnimationFrame(this.animationFrameId);
|
||||
}
|
||||
this.motionQuery?.removeEventListener('change', this.onMotionPreferenceChange);
|
||||
this.intersectionObserver?.disconnect();
|
||||
this.resizeObserver?.disconnect();
|
||||
}
|
||||
|
||||
private readonly onMotionPreferenceChange = (event: MediaQueryListEvent): void => {
|
||||
this.isReducedMotion = event.matches;
|
||||
if (this.isReducedMotion) {
|
||||
if (this.animationFrameId !== undefined) {
|
||||
cancelAnimationFrame(this.animationFrameId);
|
||||
this.animationFrameId = undefined;
|
||||
}
|
||||
this.draw();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isVisible && this.animationFrameId === undefined) {
|
||||
this.lastFrameTime = 0;
|
||||
this.animationFrameId = requestAnimationFrame(this.animate);
|
||||
}
|
||||
};
|
||||
|
||||
private readonly animate = (timestamp: number): void => {
|
||||
this.animationFrameId = undefined;
|
||||
if (!this.isVisible || this.isReducedMotion) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elapsed = this.lastFrameTime === 0 ? 0 : Math.min(timestamp - this.lastFrameTime, 50);
|
||||
this.lastFrameTime = timestamp;
|
||||
this.update(elapsed / 1000);
|
||||
this.draw();
|
||||
this.animationFrameId = requestAnimationFrame(this.animate);
|
||||
};
|
||||
|
||||
private resizeCanvas(): void {
|
||||
if (!this.rainCanvas) return;
|
||||
|
||||
const canvas = this.rainCanvas.nativeElement;
|
||||
const parent = canvas.parentElement;
|
||||
const bounds = parent ? parent.getBoundingClientRect() : canvas.getBoundingClientRect();
|
||||
const width = Math.max(bounds.width, window.innerWidth || 320);
|
||||
const height = Math.max(bounds.height, 700);
|
||||
const pixelRatio = Math.min(window.devicePixelRatio || 1, 2);
|
||||
|
||||
canvas.width = Math.max(1, Math.floor(width * pixelRatio));
|
||||
canvas.height = Math.max(1, Math.floor(height * pixelRatio));
|
||||
this.context?.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
||||
this.createColumns(width, height);
|
||||
this.draw();
|
||||
}
|
||||
|
||||
private createColumns(width: number, height: number): void {
|
||||
const fontSize = Math.max(14, Math.min(20, width / 58));
|
||||
const columnCount = Math.max(24, Math.floor(width / (fontSize * 0.72)));
|
||||
this.columns.length = 0;
|
||||
|
||||
for (let index = 0; index < columnCount; index += 1) {
|
||||
const length = Math.floor(Math.random() * 25) + 14;
|
||||
this.columns.push({
|
||||
x: (index / columnCount) * width + Math.random() * fontSize * 0.6,
|
||||
y: -Math.random() * (height * 0.9) - length * fontSize,
|
||||
speed: Math.floor(Math.random() * 130) + 150,
|
||||
length,
|
||||
opacity: 0.25 + Math.random() * 0.65,
|
||||
characters: Array.from({ length }, () => this.randomCharacter())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private update(deltaSeconds: number): void {
|
||||
if (!this.rainCanvas) return;
|
||||
const parent = this.rainCanvas.nativeElement.parentElement;
|
||||
const height = parent ? parent.clientHeight : this.rainCanvas.nativeElement.clientHeight;
|
||||
const width = parent ? parent.clientWidth : this.rainCanvas.nativeElement.clientWidth;
|
||||
const fontSize = Math.max(14, Math.min(20, width / 58));
|
||||
|
||||
for (const column of this.columns) {
|
||||
column.y += column.speed * deltaSeconds;
|
||||
if (column.y - column.length * fontSize > height) {
|
||||
column.y = -Math.random() * height * 0.75 - column.length * fontSize;
|
||||
column.speed = Math.floor(Math.random() * 130) + 150;
|
||||
column.length = Math.floor(Math.random() * 25) + 14;
|
||||
column.opacity = 0.25 + Math.random() * 0.65;
|
||||
column.characters = Array.from({ length: column.length }, () => this.randomCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private draw(): void {
|
||||
if (!this.rainCanvas || !this.context) return;
|
||||
|
||||
const canvas = this.rainCanvas.nativeElement;
|
||||
const parent = canvas.parentElement;
|
||||
const width = parent ? parent.clientWidth : canvas.clientWidth;
|
||||
const height = parent ? parent.clientHeight : canvas.clientHeight;
|
||||
const fontSize = Math.max(14, Math.min(20, width / 58));
|
||||
|
||||
this.context.clearRect(0, 0, width, height);
|
||||
this.context.font = `${fontSize}px monospace`;
|
||||
this.context.textAlign = 'center';
|
||||
this.context.textBaseline = 'top';
|
||||
this.context.shadowBlur = 0;
|
||||
|
||||
for (const column of this.columns) {
|
||||
for (let i = 0; i < column.characters.length; i++) {
|
||||
const charY = column.y + i * fontSize;
|
||||
if (charY < -fontSize || charY > height) continue;
|
||||
|
||||
const isHead = i === 0;
|
||||
const isHighlight = i === Math.floor(column.length * 0.35) && column.opacity > 0.4;
|
||||
const trailAlpha = column.opacity * (1 - i / (column.length * 1.15));
|
||||
const edgeFade = Math.min(1, Math.max(0, (height - charY) / (fontSize * 5)));
|
||||
const alpha = Math.max(0, trailAlpha * edgeFade);
|
||||
|
||||
if (alpha <= 0) continue;
|
||||
|
||||
this.context.fillStyle = isHead
|
||||
? `rgba(220, 255, 226, ${Math.min(1, alpha + 0.35)})`
|
||||
: isHighlight
|
||||
? `rgba(80, 255, 126, ${alpha})`
|
||||
: `rgba(18, 174, 78, ${alpha})`;
|
||||
|
||||
if (isHead || isHighlight) {
|
||||
this.context.shadowColor = 'rgba(37, 255, 104, 0.85)';
|
||||
this.context.shadowBlur = isHead ? 9 : 5;
|
||||
}
|
||||
|
||||
this.context.fillText(column.characters[i], column.x, charY);
|
||||
this.context.shadowBlur = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private randomCharacter(): string {
|
||||
const r = Math.random();
|
||||
const set = r < 0.48 ? BINARY_CHARS : r < 0.68 ? HEX_CHARS : r < 0.72 ? CODE_CHARS : TERM_CHARS;
|
||||
return set[Math.floor(Math.random() * set.length)];
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
if (this.contactForm.invalid) {
|
||||
this.contactForm.markAllAsTouched();
|
||||
|
|
@ -285,7 +79,6 @@ export class ContactSectionComponent implements OnInit, AfterViewInit, OnDestroy
|
|||
this.isSuccess.set(true);
|
||||
},
|
||||
error: () => {
|
||||
// En caso de fallo de red en webhook, la experiencia del usuario no se interrumpe
|
||||
this.isSubmitting.set(false);
|
||||
this.isSuccess.set(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,80 +149,74 @@
|
|||
ESTRUCTURA DE SECCIONES CONTINUAS (Single Page Scroll Flow)
|
||||
============================================================================== */
|
||||
|
||||
/* ==============================================================================
|
||||
ESTRUCTURA DE SECCIONES (Hero 3D + Pantalla Completa con Matrix Rain)
|
||||
============================================================================== */
|
||||
|
||||
.landing-section {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.section-container {
|
||||
width: 100%;
|
||||
max-width: 1540px;
|
||||
margin: 0 auto;
|
||||
padding: 0 clamp(1rem, 3vw, 2.5rem);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Cabeceras de Sección Cyber-Zen */
|
||||
.section-lead-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-bottom: var(--space-8);
|
||||
padding-bottom: var(--space-3);
|
||||
border-bottom: 1px solid var(--zen-border-subtle);
|
||||
}
|
||||
|
||||
.section-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.badge-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--zen-accent-kintsugi);
|
||||
box-shadow: 0 0 10px var(--zen-accent-kintsugi);
|
||||
}
|
||||
|
||||
.badge-text {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
color: var(--zen-accent-kintsugi);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.section-main-title {
|
||||
margin: 0;
|
||||
font-family: var(--font-sans);
|
||||
font-size: clamp(1.75rem, 3.2vw, 2.5rem);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.02em;
|
||||
color: var(--zen-text-primary);
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
/* 01. HERO SECTION */
|
||||
/* 01. HERO SECTION (Pristino, Fondo Negro Profundo, 240 frames al scroll) */
|
||||
.hero-section {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
background-color: #000000;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 02. RETRO OS & PROFILE */
|
||||
.interactive-stage {
|
||||
padding: var(--space-16) 0 var(--space-12) 0;
|
||||
background: linear-gradient(180deg, #000000 0%, #121517 120px);
|
||||
border-bottom: 1px solid var(--zen-border-subtle);
|
||||
/* CONTENEDOR MAESTRO DE ETAPAS PANTALLA COMPLETA CON MATRIX RAIN */
|
||||
.cyber-matrix-stage-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
background-color: #0b0e14;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Lluvia Matrix ambiental sticky: se mantiene visible durante todas las etapas siguientes */
|
||||
.global-matrix-bg {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: block;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
margin-bottom: -100vh;
|
||||
opacity: 0.28;
|
||||
}
|
||||
|
||||
/* ETAPAS EN PANTALLA COMPLETA (100vh con centrado vertical y espacio negativo Zen) */
|
||||
.fullscreen-stage {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
box-sizing: border-box;
|
||||
padding: clamp(4.5rem, 8vh, 6rem) clamp(1rem, 3vw, 2.5rem);
|
||||
border-bottom: 1px solid rgba(30, 37, 51, 0.45);
|
||||
}
|
||||
|
||||
.fullscreen-stage-content {
|
||||
width: 100%;
|
||||
max-width: 1540px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* ETAPA 02: RETRO OS & PROFILE */
|
||||
.stage-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-8);
|
||||
gap: clamp(2rem, 4vw, 4rem);
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
@ -253,41 +247,13 @@
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* 03. PROJECTS SECTION */
|
||||
.projects-stage {
|
||||
padding: var(--space-16) 0;
|
||||
background-color: #121517;
|
||||
border-bottom: 1px solid var(--zen-border-subtle);
|
||||
}
|
||||
|
||||
.projects-stage-inner {
|
||||
/* ETAPA 05: TERMINAL INTERACTIVA (Centrada con ancho óptimo) */
|
||||
.terminal-content-box {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 04. SIMULATOR SECTION */
|
||||
.simulator-stage {
|
||||
padding: var(--space-16) 0;
|
||||
background-color: #0e1114;
|
||||
border-bottom: 1px solid var(--zen-border-subtle);
|
||||
}
|
||||
|
||||
/* 05. TERMINAL SECTION */
|
||||
.terminal-stage {
|
||||
padding: var(--space-16) 0;
|
||||
background-color: #121517;
|
||||
border-bottom: 1px solid var(--zen-border-subtle);
|
||||
}
|
||||
|
||||
.terminal-stage-inner {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 06. CONTACT SECTION */
|
||||
.contact-stage {
|
||||
padding: var(--space-16) 0;
|
||||
background-color: #0e1114;
|
||||
}
|
||||
|
||||
/* ==============================================================================
|
||||
ADAPTABILIDAD RESPONSIVA (Tablet & Mobile)
|
||||
============================================================================== */
|
||||
|
|
@ -295,7 +261,7 @@
|
|||
@media (max-width: 960px) {
|
||||
.stage-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--space-10);
|
||||
gap: var(--space-8);
|
||||
}
|
||||
|
||||
.retro-module-card {
|
||||
|
|
@ -308,8 +274,9 @@
|
|||
order: 2;
|
||||
}
|
||||
|
||||
.section-lead-header {
|
||||
margin-bottom: var(--space-6);
|
||||
.fullscreen-stage {
|
||||
min-height: auto;
|
||||
padding: clamp(4rem, 6vh, 5rem) clamp(1rem, 2vw, 1.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,17 +97,14 @@
|
|||
<app-hero-3d></app-hero-3d>
|
||||
</section>
|
||||
|
||||
<!-- SECCIÓN 02: Módulos Interactivos (Perfil Técnico & Retro Monitor CRT) -->
|
||||
<section id="retro" class="landing-section interactive-stage">
|
||||
<div class="section-container">
|
||||
<header class="section-lead-header">
|
||||
<div class="section-badge">
|
||||
<span class="badge-dot"></span>
|
||||
<span class="badge-text">// 01 ARCHITECTURE & RETRO COMPUTING</span>
|
||||
</div>
|
||||
<h2 class="section-main-title">{{ i18n.t().navRetro }}</h2>
|
||||
</header>
|
||||
<!-- CONTENEDOR DE SECCIONES CON LLUVIA MATRIX AMBIENTAL (PANTALLA COMPLETA) -->
|
||||
<div class="cyber-matrix-stage-wrapper">
|
||||
<!-- Lienzo Matrix Global que abarca toda la pantalla en segundo plano para estas secciones -->
|
||||
<app-matrix-rain class="global-matrix-bg"></app-matrix-rain>
|
||||
|
||||
<!-- SECCIÓN 02: Módulos Interactivos (Perfil Técnico & Retro Monitor CRT) -->
|
||||
<section id="retro" class="landing-section fullscreen-stage">
|
||||
<div class="fullscreen-stage-content">
|
||||
<div class="stage-grid">
|
||||
<!-- Slot 1: Perfil Técnico & Filosofía de Ingeniería -->
|
||||
<article class="module-card profile-module-card">
|
||||
|
|
@ -123,68 +120,33 @@
|
|||
</section>
|
||||
|
||||
<!-- SECCIÓN 03: Proyectos Destacados (Casos Reales del CV) -->
|
||||
<section id="projects" class="landing-section projects-stage">
|
||||
<div class="section-container">
|
||||
<header class="section-lead-header">
|
||||
<div class="section-badge">
|
||||
<span class="badge-dot"></span>
|
||||
<span class="badge-text">// 02 ENTERPRISE SYSTEMS</span>
|
||||
</div>
|
||||
<h2 class="section-main-title">{{ i18n.t().navProjects }}</h2>
|
||||
</header>
|
||||
|
||||
<div class="projects-stage-inner">
|
||||
<section id="projects" class="landing-section fullscreen-stage">
|
||||
<div class="fullscreen-stage-content">
|
||||
<app-featured-projects></app-featured-projects>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- SECCIÓN 04: Simulador de Incidentes Cloud (Packet Tracer) -->
|
||||
<section id="simulator" class="landing-section simulator-stage">
|
||||
<div class="section-container">
|
||||
<header class="section-lead-header">
|
||||
<div class="section-badge">
|
||||
<span class="badge-dot"></span>
|
||||
<span class="badge-text">// 03 CLOUD TELEMETRY & SECURITY</span>
|
||||
</div>
|
||||
<h2 class="section-main-title">{{ i18n.t().navSimulator }}</h2>
|
||||
</header>
|
||||
|
||||
<section id="simulator" class="landing-section fullscreen-stage">
|
||||
<div class="fullscreen-stage-content">
|
||||
<app-incident-simulator></app-incident-simulator>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- SECCIÓN 05: Terminal Interactiva Arch Linux / Fish Shell -->
|
||||
<section id="terminal" class="landing-section terminal-stage">
|
||||
<div class="section-container">
|
||||
<div class="terminal-stage-inner">
|
||||
<header class="section-lead-header">
|
||||
<div class="section-badge">
|
||||
<span class="badge-dot"></span>
|
||||
<span class="badge-text">// 04 INTERACTIVE CLI ENGINE</span>
|
||||
</div>
|
||||
<h2 class="section-main-title">{{ i18n.t().navTerminal }}</h2>
|
||||
</header>
|
||||
|
||||
<section id="terminal" class="landing-section fullscreen-stage">
|
||||
<div class="fullscreen-stage-content terminal-content-box">
|
||||
<app-terminal></app-terminal>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- SECCIÓN 06: Contacto & Muro de Firmas Guestbook -->
|
||||
<section id="contact" class="landing-section contact-stage">
|
||||
<div class="section-container">
|
||||
<header class="section-lead-header">
|
||||
<div class="section-badge">
|
||||
<span class="badge-dot"></span>
|
||||
<span class="badge-text">// 05 CONNECT & GUESTBOOK</span>
|
||||
</div>
|
||||
<h2 class="section-main-title">{{ i18n.t().navContact }}</h2>
|
||||
</header>
|
||||
|
||||
<section id="contact" class="landing-section fullscreen-stage">
|
||||
<div class="fullscreen-stage-content">
|
||||
<app-contact-section></app-contact-section>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Asistente Virtual Flotante Cyber-Zen (n8n + Gemini) -->
|
||||
<app-chat-bot></app-chat-bot>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { TechnicalProfileComponent } from '../technical-profile/technical-profil
|
|||
import { IncidentSimulatorComponent } from '../incident-simulator/incident-simulator.component';
|
||||
import { ChatBotComponent } from '../chat-bot/chat-bot.component';
|
||||
import { TelemetryHudComponent } from '../telemetry-hud/telemetry-hud.component';
|
||||
import { MatrixRainComponent } from '../../shared/components/matrix-rain/matrix-rain.component';
|
||||
import { I18nService } from '../../../application/services/i18n.service';
|
||||
|
||||
export type LandingSection = 'hero' | 'retro' | 'projects' | 'simulator' | 'terminal' | 'contact';
|
||||
|
|
@ -43,7 +44,8 @@ export const LANDING_SECTIONS: readonly LandingSection[] = [
|
|||
TechnicalProfileComponent,
|
||||
IncidentSimulatorComponent,
|
||||
ChatBotComponent,
|
||||
TelemetryHudComponent
|
||||
TelemetryHudComponent,
|
||||
MatrixRainComponent
|
||||
],
|
||||
templateUrl: './landing.component.html',
|
||||
styleUrl: './landing.component.css',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.matrix-rain-canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
<canvas #canvas class="matrix-rain-canvas" aria-hidden="true"></canvas>
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
import {
|
||||
Component,
|
||||
ChangeDetectionStrategy,
|
||||
ElementRef,
|
||||
ViewChild,
|
||||
AfterViewInit,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
inject
|
||||
} from '@angular/core';
|
||||
|
||||
interface RainColumn {
|
||||
x: number;
|
||||
y: number;
|
||||
speed: number;
|
||||
length: number;
|
||||
opacity: number;
|
||||
characters: string[];
|
||||
}
|
||||
|
||||
const BINARY_CHARS = '01';
|
||||
const HEX_CHARS = '0123456789ABCDEF';
|
||||
const KATAKANA_CHARS = 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン';
|
||||
const CODE_CHARS = '{}[]()<>&|/\\:;=+-_*#$%@?!~^';
|
||||
const TERM_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
@Component({
|
||||
selector: 'app-matrix-rain',
|
||||
standalone: true,
|
||||
templateUrl: './matrix-rain.component.html',
|
||||
styleUrl: './matrix-rain.component.css',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class MatrixRainComponent implements AfterViewInit, OnDestroy {
|
||||
@ViewChild('canvas', { static: true }) private readonly canvasRef!: ElementRef<HTMLCanvasElement>;
|
||||
|
||||
private readonly hostRef = inject(ElementRef<HTMLElement>);
|
||||
private readonly ngZone = inject(NgZone);
|
||||
|
||||
private readonly columns: RainColumn[] = [];
|
||||
private context?: CanvasRenderingContext2D;
|
||||
private animationFrameId?: number;
|
||||
private intersectionObserver?: IntersectionObserver;
|
||||
private resizeObserver?: ResizeObserver;
|
||||
private motionQuery?: MediaQueryList;
|
||||
private isVisible = false;
|
||||
private isReducedMotion = false;
|
||||
private lastFrameTime = 0;
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
const canvas = this.canvasRef.nativeElement;
|
||||
this.context = canvas.getContext('2d', { alpha: true }) ?? undefined;
|
||||
if (!this.context) return;
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
this.motionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
this.isReducedMotion = this.motionQuery.matches;
|
||||
this.motionQuery.addEventListener('change', this.onMotionPreferenceChange);
|
||||
}
|
||||
|
||||
// Ejecutar fuera de Angular Zone para evitar disparar ciclos de Change Detection en cada frame
|
||||
this.ngZone.runOutsideAngular(() => {
|
||||
this.resizeObserver = new ResizeObserver(() => this.resizeCanvas());
|
||||
this.resizeObserver.observe(this.hostRef.nativeElement);
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver(([entry]) => {
|
||||
const wasVisible = this.isVisible;
|
||||
this.isVisible = entry.isIntersecting;
|
||||
|
||||
if (this.isVisible && !wasVisible && !this.isReducedMotion) {
|
||||
this.lastFrameTime = 0;
|
||||
this.startAnimation();
|
||||
} else if (!this.isVisible && wasVisible) {
|
||||
this.stopAnimation();
|
||||
}
|
||||
}, { threshold: 0.01 });
|
||||
|
||||
this.intersectionObserver.observe(this.hostRef.nativeElement);
|
||||
this.resizeCanvas();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.stopAnimation();
|
||||
this.motionQuery?.removeEventListener('change', this.onMotionPreferenceChange);
|
||||
this.intersectionObserver?.disconnect();
|
||||
this.resizeObserver?.disconnect();
|
||||
}
|
||||
|
||||
private readonly onMotionPreferenceChange = (event: MediaQueryListEvent): void => {
|
||||
this.isReducedMotion = event.matches;
|
||||
if (this.isReducedMotion) {
|
||||
this.stopAnimation();
|
||||
this.draw();
|
||||
} else if (this.isVisible) {
|
||||
this.lastFrameTime = 0;
|
||||
this.startAnimation();
|
||||
}
|
||||
};
|
||||
|
||||
private startAnimation(): void {
|
||||
if (this.animationFrameId === undefined && !this.isReducedMotion) {
|
||||
this.animationFrameId = requestAnimationFrame(this.animate);
|
||||
}
|
||||
}
|
||||
|
||||
private stopAnimation(): void {
|
||||
if (this.animationFrameId !== undefined) {
|
||||
cancelAnimationFrame(this.animationFrameId);
|
||||
this.animationFrameId = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly animate = (timestamp: number): void => {
|
||||
this.animationFrameId = undefined;
|
||||
if (!this.isVisible || this.isReducedMotion) return;
|
||||
|
||||
const elapsed = this.lastFrameTime === 0 ? 0 : Math.min(timestamp - this.lastFrameTime, 50);
|
||||
this.lastFrameTime = timestamp;
|
||||
|
||||
this.update(elapsed / 1000);
|
||||
this.draw();
|
||||
|
||||
this.animationFrameId = requestAnimationFrame(this.animate);
|
||||
};
|
||||
|
||||
private resizeCanvas(): void {
|
||||
const canvas = this.canvasRef.nativeElement;
|
||||
const width = window.innerWidth || this.hostRef.nativeElement.clientWidth || 320;
|
||||
const height = window.innerHeight || this.hostRef.nativeElement.clientHeight || 600;
|
||||
const pixelRatio = Math.min(window.devicePixelRatio || 1, 2);
|
||||
|
||||
canvas.width = Math.max(1, Math.floor(width * pixelRatio));
|
||||
canvas.height = Math.max(1, Math.floor(height * pixelRatio));
|
||||
this.context?.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
||||
|
||||
this.createColumns(width, height);
|
||||
this.draw();
|
||||
}
|
||||
|
||||
private createColumns(width: number, height: number): void {
|
||||
const fontSize = Math.max(13, Math.min(18, width / 64));
|
||||
const columnCount = Math.max(30, Math.floor(width / (fontSize * 0.75)));
|
||||
this.columns.length = 0;
|
||||
|
||||
for (let index = 0; index < columnCount; index += 1) {
|
||||
const length = Math.floor(Math.random() * 26) + 14;
|
||||
this.columns.push({
|
||||
x: (index / columnCount) * width + Math.random() * fontSize * 0.4,
|
||||
y: -Math.random() * (height * 0.95) - length * fontSize,
|
||||
speed: Math.floor(Math.random() * 120) + 140,
|
||||
length,
|
||||
opacity: 0.25 + Math.random() * 0.65,
|
||||
characters: Array.from({ length }, () => this.randomCharacter())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private update(deltaSeconds: number): void {
|
||||
const width = window.innerWidth || 320;
|
||||
const height = window.innerHeight || 600;
|
||||
const fontSize = Math.max(13, Math.min(18, width / 64));
|
||||
|
||||
for (const column of this.columns) {
|
||||
column.y += column.speed * deltaSeconds;
|
||||
if (column.y - column.length * fontSize > height) {
|
||||
column.y = -Math.random() * height * 0.65 - column.length * fontSize;
|
||||
column.speed = Math.floor(Math.random() * 120) + 140;
|
||||
column.length = Math.floor(Math.random() * 26) + 14;
|
||||
column.opacity = 0.25 + Math.random() * 0.65;
|
||||
column.characters = Array.from({ length: column.length }, () => this.randomCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private draw(): void {
|
||||
if (!this.context) return;
|
||||
const width = window.innerWidth || 320;
|
||||
const height = window.innerHeight || 600;
|
||||
const fontSize = Math.max(13, Math.min(18, width / 64));
|
||||
|
||||
this.context.clearRect(0, 0, width, height);
|
||||
this.context.font = `${fontSize}px monospace`;
|
||||
this.context.textAlign = 'center';
|
||||
this.context.textBaseline = 'top';
|
||||
|
||||
for (const column of this.columns) {
|
||||
for (let i = 0; i < column.characters.length; i++) {
|
||||
const charY = column.y + i * fontSize;
|
||||
if (charY < -fontSize || charY > height) continue;
|
||||
|
||||
const isHead = i === 0;
|
||||
const isHighlight = i === Math.floor(column.length * 0.3) && column.opacity > 0.4;
|
||||
const trailAlpha = column.opacity * (1 - i / (column.length * 1.15));
|
||||
const edgeFade = Math.min(1, Math.max(0, (height - charY) / (fontSize * 4)));
|
||||
const alpha = Math.max(0, trailAlpha * edgeFade);
|
||||
|
||||
if (alpha <= 0) continue;
|
||||
|
||||
this.context.fillStyle = isHead
|
||||
? `rgba(235, 255, 240, ${Math.min(1, alpha + 0.4)})`
|
||||
: isHighlight
|
||||
? `rgba(80, 255, 130, ${alpha})`
|
||||
: `rgba(20, 185, 85, ${alpha})`;
|
||||
|
||||
if (isHead || isHighlight) {
|
||||
this.context.shadowColor = 'rgba(40, 255, 110, 0.85)';
|
||||
this.context.shadowBlur = isHead ? 8 : 4;
|
||||
}
|
||||
|
||||
this.context.fillText(column.characters[i], column.x, charY);
|
||||
this.context.shadowBlur = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private randomCharacter(): string {
|
||||
const r = Math.random();
|
||||
if (r < 0.4) return BINARY_CHARS[Math.floor(Math.random() * BINARY_CHARS.length)];
|
||||
if (r < 0.65) return KATAKANA_CHARS[Math.floor(Math.random() * KATAKANA_CHARS.length)];
|
||||
if (r < 0.8) return HEX_CHARS[Math.floor(Math.random() * HEX_CHARS.length)];
|
||||
if (r < 0.9) return CODE_CHARS[Math.floor(Math.random() * CODE_CHARS.length)];
|
||||
return TERM_CHARS[Math.floor(Math.random() * TERM_CHARS.length)];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue