U
U
Umid2017-04-30 11:59:05
JavaScript
Umid, 2017-04-30 11:59:05

How to make a shadow without painting over the entire figure (canvas)?

Good afternoon.

ctx.translate(theCanvas.width/2, theCanvas.height/2);

      ctx.beginPath();
      ctx.strokeStyle = "#444";
      ctx.arc(0, 0, 130, 0, Math.PI * 2);
      ctx.shadowColor = "#222";
      ctx.shadowOffsetX = 0;
      ctx.shadowOffsetY = 0;
      ctx.shadowBlur = 25;
      //ctx.fill();
                        ctx.stoke()

The shadow does not work when using the ctx.stroke(); function, but when using ctx.fill() the shadow works.
Interested in how to make a shadow for an unfilled figure?
There is an idea to make 1 more circle inside the filled circle, thereby achieving a border, but maybe there is a special method for this case?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question