MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / draw

Method draw

assets/js/bubbleParticle.js:39–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38}
39draw(){
40 ctx.fillStyle="rgba(255,255,255,0.8)";
41 ctx.strokeStyle="rgba(34,147,214,1)";
42
43 ctx.beginPath();
44if(this.distance < mouse.radius-5){
45 this.size=13;
46 ctx.arc(this.x,this.y,this.size,0,Math.PI*2);
47 ctx.stroke();
48 ctx.closePath();
49 ctx.beginPath();
50 ctx.arc(this.x-3,this.y-3,this.size/2.5,0,Math.PI*2);
51 ctx.arc(this.x+7,this.y-1,this.size/3.5,0,Math.PI*2);
52}
53else if(this.distance <= mouse.radius){
54this.size=10;
55ctx.arc(this.x,this.y,this.size,0,Math.PI*2);
56ctx.stroke();
57ctx.closePath();
58ctx.beginPath();
59ctx.arc(this.x-2,this.y-2,this.size/3,0,Math.PI*2);
60
61}
62else{
63this.size=8;
64ctx.arc(this.x,this.y,this.size,0,Math.PI*2);
65ctx.stroke();
66ctx.closePath();
67ctx.beginPath();
68ctx.arc(this.x-1,this.y-1,this.size/3,0,Math.PI*2);
69
70}
71ctx.closePath();
72
73ctx.fill();
74
75}
76update(){
77 let dx=mouse.x-this.x;
78 let dy=mouse.y-this.y;

Callers 1

animateFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected