write me p5.js script which draw a mouse
- User
write me p5.js script which draw a mouse
- Assistant
Here is a simple p5.js script that draws a mouse-like shape and follows the mouse cursor on the canvas:
// Create the setup function function setup() { createCanvas(800, 800); // Create a canvas of 800x800 pixels } // Create the draw function function draw() { background(220); // Set the background color to light gray // Draw the mouse body fill(100); // Set the fill color to gray ellipse(mouseX, mouseY, 100, 50); // Draw an ellipse at the mouse position with a size of 100x50 pixels // Draw the mouse head fill(100); // Set the fill color to gray ellipse(mouseX + 40, mouseY - 15, 60, 60); // Draw an ellipse slightly to the right and up from the mouse position with a size of 60x60 pixels // Draw the mouse eyes fill(255); // Set the fill color to white ellipse(mouseX + 30, mouseY - 25, 20, 20); // Draw the left eye ellipse(mouseX + 45, mouseY - 25, 20, 20); // Draw the right eye // Draw the mouse pupils fill(0); // Set the fill color to black ellipse(mouseX + 30, mouseY - 25, 10, 10); // Draw the left pupil ellipse(mouseX + 45, mouseY - 25, 10, 10); // Draw the right pupil // Draw the mouse ears fill(100); // Set the fill color to gray ellipse(mouseX + 10, mouseY - 15, 30, 40); // Draw the left ear ellipse(mouseX + 70, mouseY - 15, 30, 40); // Draw the right ear // Draw the mouse tail stroke(100); // Set the stroke color to gray strokeWeight(8); // Set the stroke weight to 8 pixels line(mouseX - 40, mouseY, mouseX - 40, mouseY + 100); // Draw the tail from the back of the mouse extending downward noStroke(); // Reset the stroke to no stroke } - User
write me p5.js script which visualize video with animation face
- Assistant
To create a p5.js script that visualizes a video with an animated face, you'll first need a video file, which you can host online or include in your project. For this example, I'll use a sample video from the p5.js website.
let video; let faceSize = 20; function setup() { createCanvas(640, 360); video = createVideo(['https://p5js.org/assets/examples/lucky_color.mov']); // Use any video URL video.hide(); } function draw() { image(video, 0, 0, width, height); // Display the video on the canvas faceSize += random(-1, 1); // Add animation to the face size faceSize = constrain(faceSize, 10, 50); // Find the center of the video const centerX = width / 2; const centerY = height / 2; // Draw the animated face drawFace(centerX, centerY); } function drawFace(x, y) { // Draw the face circle fill(255, 0, 0, 120); circle(x, y, faceSize * 2); // Draw the eyes fill(255); circle(x - faceSize / 2, y - faceSize / 2, faceSize / 2); circle(x + faceSize / 2, y - faceSize / 2, faceSize / 2); // Draw the pupils fill(0); circle(x - faceSize / 2, y - faceSize / 2, faceSize / 4); circle(x + faceSize / 2, y - faceSize / 2, faceSize / 4); // Draw the mouth stroke(255); strokeWeight(3); arc(x, y + faceSize / 3, faceSize, faceSize / 2, 0, PI); noStroke(); } function mouseClicked() { video.loop(); // Toggle the video between playing and pausing } - User
write me js script which visualize video with animation face
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.