Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var canvas = document.getElementById("myCanvas");
- var ctx = canvas.getContext("2d");
- ctx.fillStyle = '#FF0000';
- ctx.fillRect(0, 0, 50, 250);
- ctx.fill();
- for(var i = 0; i < 255; i ++){
- var a = 255 - i;
- ctx.fillStyle = "RGB("+i+", "+a+", 0)"
- ctx.fillRect(0, i, 50, 250);
- ctx.fill();
- }
- /*for(var i = 0; i < 255; i ++){
- var a = 255 - (i - 255);
- var p = i - 255;
- ctx.fillStyle = "RGB("+a+", 0, "+p+")"
- ctx.fillRect(0, i, 50, 250);
- ctx.fill();
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement