← Volver
🧪
Laboratorio de Ideas
p5.js · Python · MiauBot
📝
✦ p5.js
🐍 Python
🟦 Bloques
Gato Espacial
▶ Ejecutar
⏹ Detener
📤
💾
⬇️
📂
🗑️
// 🐱 Gato Espacial — mueve el ratón para guiar al gato let estrellas = [], cx, cy; function setup() { createCanvas(windowWidth, windowHeight); cx = width / 2; cy = height / 2; for (let i = 0; i < 180; i++) estrellas.push({ x: random(width), y: random(height), r: random(0.5, 2.5), vel: random(0.2, 1.2) }); } function draw() { background(5, 3, 18); noStroke(); for (let e of estrellas) { fill(255, 255, 200, map(e.vel, 0.2, 1.2, 60, 220)); circle(e.x, e.y, e.r * 2); e.x -= e.vel; if (e.x < 0) { e.x = width; e.y = random(height); } } cx = lerp(cx, mouseX, 0.08); cy = lerp(cy, mouseY, 0.08); drawCat(cx, cy); } function drawCat(x, y) { fill(150, 90, 200); noStroke(); ellipse(x, y + 30, 80, 62); noFill(); stroke(150, 90, 200); strokeWeight(6); bezier(x + 35, y + 45, x + 65, y + 50, x + 72, y + 25, x + 58, y + 15); fill(150, 90, 200); noStroke(); ellipse(x, y - 20, 68, 62); triangle(x-25,y-44, x-38,y-72, x-8,y-46); triangle(x+25,y-44, x+38,y-72, x+8,y-46); fill(220, 140, 230); triangle(x-22,y-46, x-32,y-66, x-10,y-48); triangle(x+22,y-46, x+32,y-66, x+10,y-48); fill(100, 210, 120); noStroke(); ellipse(x-15,y-20,15,15); ellipse(x+15,y-20,15,15); fill(20); ellipse(x-15,y-20,8,8); ellipse(x+15,y-20,8,8); fill(255); ellipse(x-12,y-23,4,4); ellipse(x+18,y-23,4,4); fill(255, 150, 180); noStroke(); triangle(x-3,y-10, x+3,y-10, x,y-6); stroke(255, 255, 255, 160); strokeWeight(1); line(x-26,y-8, x-6,y-8); line(x-26,y-3, x-6,y-3); line(x+26,y-8, x+6,y-8); line(x+26,y-3, x+6,y-3); } function windowResized() { resizeCanvas(windowWidth, windowHeight); cx = width/2; cy = height/2; }
⟨/⟩ Ver JS generado
💾 Ideas guardadas
0
▾
🎨 Vista Previa
En espera
⛶
▶ Pulsa Ejecutar para ver tu sketch
🐱 MiauBot Coder
👁 Leyendo código
🐾