1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| var canvasBoutonCo = document.getElementById("boutonConnexion");
var boutonCo = canvasBoutonCo.getContext("2d");
var canvasBoutonRe = document.getElementById("boutonRecherche");
var boutonRe = canvasBoutonRe.getContext("2d");
function dessinerBoutonCo(boutonCo, canvasBoutonCo){ // Marche
var gradient = boutonCo.createLinearGradient(50, 10, 160, 160);
boutonCo.clearRect(0, 0, canvasBoutonCo.width, canvasBoutonCo.height);
boutonCo.beginPath();
boutonCo.arc(140, 100, 90, 0, 2 * Math.PI);
boutonCo.fillStyle = "#B3B7B3";
boutonCo.fill();
boutonCo.fillStyle = "white";
boutonCo.textBaseline = "top";
boutonCo.font = "bold 27px serif";
boutonCo.fillText("Connexion", 80, 85);
boutonCo.beginPath();
boutonCo.arc(140, 100, 91, 0, 2 * Math.PI);
gradient.addColorStop("0", "#1F002D");
gradient.addColorStop("1", "#8133A1");
boutonCo.strokeStyle = gradient;
boutonCo.lineWidth = 3;
boutonCo.stroke();
}
function changerBoutonCo(boutonCo, canvasBoutonCo){ // Marche
var gradient = boutonCo.createLinearGradient(50, 10, 160, 160);
boutonCo.clearRect(0, 0, canvasBoutonCo.width, canvasBoutonCo.height);
boutonCo.beginPath();
boutonCo.arc(140, 100, 95, 0, 2 * Math.PI);
boutonCo.fillStyle = "#E6E6E6";
boutonCo.fill();
boutonCo.fillStyle = "#1F002D";
boutonCo.textBaseline = "top";
boutonCo.font = "bold 27px serif";
boutonCo.fillText("Connexion", 80, 85);
boutonCo.beginPath();
boutonCo.arc(140, 100, 96, 0, 2 * Math.PI);
gradient.addColorStop("0", "#1F002D");
gradient.addColorStop("1", "#8133A1");
boutonCo.strokeStyle = gradient;
boutonCo.lineWidth = 3;
boutonCo.stroke();
}
//[...]
function dessinerBoutonRe(boutonRe, canvasBoutonRe){ // Ne marche pas, mais marche si je declare les variables dans la fonction plutot que de les passer par parametres.
boutonRe.clearRect(0, 0, canvasBoutonRe.width, canvasBoutonRe.height);
boutonRe.fillRect(10, 10, 10, 10);
} |