I add the code here if necessary HTML : Repetitions Repeat the pig First Part Second Part javascript use strict; let ctx; function setup() {
I add the code here if necessary
HTML:
Repetitions
Repeat the pig
javascript
"use strict";
let ctx;
function setup() {
let canvas = document.getElementById("myCanvas");
ctx = canvas.getContext("2d");
}
function drawPig(x,y) {
ctx.save();
ctx.translate(x,y);
ctx.fillStyle = "pink"
ctx.beginPath();
ctx.arc(25, 40, 15, 0, 2 * Math.PI);
ctx.fill();
ctx.beginPath();
ctx.arc(40, 25, 10, 0, 2 * Math.PI);
ctx.fill();
ctx.fillRect(45, 20, 10, 10);
ctx.beginPath();
ctx.arc(42, 18, 1.5, 0, 2 * Math.PI);
ctx.fill();
ctx.beginPath();
ctx.moveTo(35, 50);
ctx.lineTo(50, 60);
ctx.moveTo(35, 50);
ctx.lineTo(35, 62);
ctx.moveTo(15, 50);
ctx.lineTo(5, 60);
ctx.moveTo(15, 50);
ctx.lineTo(15, 60);
ctx.stroke();
}
Problem 1[35 points]: With the following code make loops to form the patterns shown below, add two extra functions for each button. Html 1 2 chat 3 cheta charset"utf-8"> 5 Repetitions 6 7 8 9
Repeat the pig
10 11
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
View Solution
Step: 2
Sign Up to view
Step: 3
Sign Up to view
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance