Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I add the code here if necessary HTML : Repetitions Repeat the pig First Part Second Part javascript use strict; let ctx; function setup() {

image text in transcribedimage text in transcribed

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 11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions