Skip to content

Instantly share code, notes, and snippets.

@AmilaWeerasinghe
Created July 18, 2020 08:57
Show Gist options
  • Save AmilaWeerasinghe/9ebb5a217a500caafac6e3a5a0fa9252 to your computer and use it in GitHub Desktop.
Save AmilaWeerasinghe/9ebb5a217a500caafac6e3a5a0fa9252 to your computer and use it in GitHub Desktop.
ExPOZyM
<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"/>
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);
}
@AmilaWeerasinghe
Copy link
Author

Coursera HTML CSS JS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment