I am trying to do a sample weather application for a quite long time now, but can not produce the same effect as seen here. Basically, it has to show sunrise and sunset information, but use similar effects in visualization.
Can someone assist on how to make the same shape and add the code below to it so it would produce the same effects?
The blue area effect is seen here below with this code.
But I can not make the shapes to work with the effect. Can someone assist on how to make the shapes so sunrise sunset would work properly. The colored blue areas are actually hollow, meaning the animation code fills the shapes relative to time passed.
The code uses circle properties at the moment, but are there any shapes that can be made so, it would look like in the image.
var c1 = document.getElementById("canvas1");
var c2 = document.getElementById("canvas2");
var ctx = c1.getContext("2d");
ctx.beginPath();
ctx.arc(100, 100, 90, 0, 2 * Math.PI);
ctx.lineWidth = 2;
ctx.stroke();
animateCanvas();
function animateCanvas(){
var w = 0;
var timer = setInterval(function(){
c2.width = w;
w += 1;
var ctx = c2.getContext("2d");
ctx.beginPath();
ctx.arc(100, 100, 89, 0, 2 * Math.PI);
ctx.fillStyle = "#efba32";
ctx.fill();
if (w===200){clearInterval(timer)}
}, 20);
}
.canvases{
position: absolute;
top: 0;
left: 0;
}
<canvas id="canvas1" class="canvases" width="200" height="200"></canvas>
<canvas id="canvas2" class="canvases" width="200" height="200"></canvas>
How to make these shapes with javascript?