Question
Draw a black rectangle in the center of a white canvas. Use the slider from jQuery Mobile to alter the RGB values of a rectangle
Draw a black rectangle in the center of a white canvas.
Use the slider from jQuery Mobile to alter the RGB values of a rectangle to allow the user to select a color of a rectangle. Do not use the color picker tool, I want you to write you own way to select a color manually by RGB values). If can additionally use the color picker if you wish.
Have a slider that makes the rectangel larger/smaller.
Use a radio button, to toggle the color of the background/rectangle.
Have a checkbox that will hide the rectangle on the screen.
Have a reset button to put things back to the begining values.
This is what I have so far!
/*Define canvas*/ var canvas = document.getElementById('myCanvas');
/*Define context */
var context = canvas.getContext('2d');
/*Begin*/
context.beginPath();
/*Define rectangle dimensions*/
context.rect(188, 50, 200, 100);
context.fillStyle = 'yellow';
/*Fill */
context.fill();
/*Set width */
context.lineWidth = 7;
/*Set stroke */
context.strokeStyle = 'black';
/*Set stroke */
context.stroke();
/*End*/
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
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started