Hello,
im making some buttons using canvas and JS, but i'd like to make rounded corners and a white circle on the left of my button (next to text), but i kind couldnt figure it out how to do it... so i'd like to ask for some help
Here is what i got:
button in html:
<a href="#">
<canvas onmouseover="drawCanvas2()" onmouseout="drawCanvas1()" width="170" height="50" id="gradientCanvas">
Your browser does not support HTML5 Canvas.
</canvas>
</a>
JS code:
function drawCanvas1() {
var gradientCanvas = document.getElementById('gradientCanvas');
var context = gradientCanvas.getContext('2d');
var myGradient = context.createLinearGradient(0, 60, 0, 0);
myGradient.addColorStop(0, 'blue');
context.fillStyle = myGradient;
context.fillRect(0, 0, 170, 50);
//text drawing..
context.fillStyle = 'white';
context.textBaseline = 'top';
context.font = 'bold 30px sans-serif';
context.fillText('Download', 10, 10);
}