Meta Description" name="description" />
<!DOCTYPE html>
<html lang="es">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<style>
body { margin: 0; padding: 0; overflow: hidden; background-color: #000; }
canvas { display: block; }
</style>
</head>
<body>
<script>
let particles = [];
let numPetals = 20; // Más pétalos para mayor detalle
let petalColors = [
'#FF00FF', // Rosa neón
'#00FFFF', // Cyan neón
'#FFFF00', // Amarillo neón
'#00FF64', // Verde neón
'#FF6400', // Naranja neón
'#6400FF' // Púrpura neón
];
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
// Inicializar partículas para el efecto de "chispas" o energía
for (let i = 0; i < 200; i++) {
particles.push(new Particle());
}
}
function draw() {
background(0, 0, 0, 50); // Fondo negro semi-transparente para un efecto de estela
translate(width / 2, height / 2);
// Efecto de movimiento sutil para la flor principal
let oscillation = sin(frameCount * 0.5) * 5; // Movimiento suave
rotate(oscillation * 0.1); // Rotación sutil
scale(1 + sin(frameCount * 0.05) * 0.01); // Pulso sutil
// --- Dibujo de la flor principal ---
for (let i = 0; i < numPetals; i++) {
let currentColor = color(petalColors[i % petalColors.length]);
// Establecer el color del brillo (shadow)
drawingContext.shadowBlur = 30; // Más intenso
drawingContext.shadowColor = currentColor.toString(); // Utiliza el color del pétalo para el brillo
stroke(currentColor);
strokeWeight(1.5); // Líneas más finas
noFill();
push();
rotate(i * (360 / numPetals) + frameCount * 0.1); // Rotación constante de pétalos
// Dibujo del pétalo con más puntos de control para detalle
beginShape();
curveVertex(0, 0); // Ancla
curveVertex(0, 0); // Ancla
curveVertex(30, -100 + oscillation * 0.5); // Ligeramente más complejo
curveVertex(80 + oscillation, -180);
curveVertex(150, -200 + oscillation * 0.5);
curveVertex(220 - oscillation, -180);
curveVertex(250, -100 + oscillation * 0.5);
curveVertex(150, -50); // Un punto más para dar forma
curveVertex(0, 0); // Cierra en el centro
curveVertex(0, 0); // Ancla
endShape();
pop();
}
// --- Centro de la flor ---
drawingContext.shadowBlur = 50; // Brillo más grande para el centro
drawingContext.shadowColor = 'rgba(255, 255, 255, 0.8)'; // Blanco brillante
fill(255, 255, 255, 180); // Blanco semi-transparente
noStroke();
ellipse(0, 0, 50 + sin(frameCount * 0.2) * 5, 50 + sin(frameCount * 0.2) * 5); // Pulso en el centro
// --- Partículas de energía/chispas ---
for (let p of particles) {
p.update();
p.display();
}
}
// Clase para las partículas
class Particle {
constructor() {
this.pos = createVector(0, 0);
this.vel = p5.Vector.random2D().mult(random(0.5, 3));
this.acc = createVector();
this.lifespan = 255;
this.color = color(random(petalColors));
this.size = random(1, 4);
this.maxSpeed = random(2, 5);
}
update() {
this.vel.add(this.acc);
this.vel.limit(this.maxSpeed); // Limitar velocidad
this.pos.add(this.vel);
this.acc.mult(0); // Resetear aceleración
this.lifespan -= random(1, 5); // Desvanecimiento
if (this.lifespan < 0) {
this.reset();
}
}
display() {
push();
drawingContext.shadowBlur = 15;
drawingContext.shadowColor = this.color.toString();
noStroke();
fill(this.color, this.lifespan);
ellipse(this.pos.x, this.pos.y, this.size);
pop();
}
reset() {
this.pos = createVector(0, 0);
this.vel = p5.Vector.random2D().mult(random(0.5, 3));
this.lifespan = 255;
this.color = color(random(petalColors));
this.size = random(1, 4);
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
</script>
</body>
</html>2
2
468KB
4160KB
714.0ms
732.0ms
714.0ms