Guest User

Untitled

a guest
Aug 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. draw_color_square(hue){
  2. var gradB = this.ctx.createLinearGradient(0, 0, 0, 255);
  3. gradB.addColorStop(0, "white");
  4. gradB.addColorStop(1, "black");
  5.  
  6. var gradC = this.ctx.createLinearGradient(0,0,255,0);
  7. gradC.addColorStop(0, "hsla(" + hue + ",100%,50%,0)");
  8. gradC.addColorStop(1, "hsla(" + hue + ",100%,50%,1)");
  9.  
  10. this.ctx.fillStyle = gradB;
  11. this.ctx.fillRect(0, 0, 255, 255);
  12. this.ctx.fillStyle = gradC;
  13. this.ctx.globalCompositeOperation = "multiply";
  14. this.ctx.fillRect(0, 0, 255, 255);
  15. this.ctx.globalCompositeOperation = "source-over";
  16. }
Add Comment
Please, Sign In to add comment