A Pen by Amila Weerasinghe on CodePen.
Created
July 18, 2020 08:57
-
-
Save AmilaWeerasinghe/9ebb5a217a500caafac6e3a5a0fa9252 to your computer and use it in GitHub Desktop.
ExPOZyM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Test</h1> | |
<canvas id="c1"></canvas> | |
<input type="range" onClick="doSquare()" min=0 max=100 value="size" id="slider"/> | |
<input id="clr" type="color" onchange="changepick()" value="#0000FF"/> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changepick(){ | |
var c1=document.getElementById("c1"); | |
var colorInput=document.getElementById("clr"); | |
var color=colorInput.value; | |
c1.style.backgroundColor=color; | |
} | |
function doSquare(){ | |
var c1=document.getElementById("c1"); | |
var slider=document.getElementById("slider"); | |
var size=slider.value; | |
var ctx=c1.getContext("2d"); | |
ctx.fillStyle="yellow"; | |
ctx.fillRect(10,10,size,size); | |
ctx.fillRect(10,10,size,size); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Coursera HTML CSS JS