Write the code necessary to create a 300 pixel by 300 pixel <canvas>. Within it, paint a blue 100 pixel by 100 pixel square with | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write the code necessary to create a 300 pixel by 300 pixel <canvas>. Within it, paint a blue 100 pixel by 100 pixel square with

Easy way

25th May 2020, 3:45 PM
Manab Bist
Manab Bist - avatar
3 Answers
+ 1
An easiest way will be to look on my codes.
25th May 2020, 3:49 PM
JaScript
JaScript - avatar
+ 4
<canvas id="c" width="300" height="300"></canvas> <script> var canvas = document.getElementById( "c" ); var drawing_context = canvas.getContext( "2d" ); drawing_context.fillStyle = "blue"; drawing_context.fillRect( 50, 50, 100, 100 ); </script>
25th May 2020, 3:49 PM
Manab Bist
Manab Bist - avatar
+ 2
Don't ask for code. Try to do yourself.
25th May 2020, 3:47 PM
A͢J
A͢J - avatar