MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / darkModeRedraw

Function darkModeRedraw

src/Components/WorldMap/display.js:235–255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233}
234
235function darkModeRedraw() {
236 UnivList.forEach(univ => {
237 const [x, y] = projection([univ.longitude, univ.latitude]);
238 const speed = 0.001 + univ.hash * 0.001;
239 univ.size = Math.abs(Math.sin((Date.now() + univ.hash * 1000) * speed)) * 4 + 3;
240 ctx.globalAlpha = 0.5;
241 ctx.beginPath();
242 ctx.arc(x, y, univ.size, 0, 2 * Math.PI);
243
244 const gradient = ctx.createRadialGradient(x, y, 0, x, y, univ.size);
245 gradient.addColorStop(1.0, 'rgba(255, 171, 46, 0.00155)');
246 gradient.addColorStop(0.8, 'rgba(255, 171, 46, 0.12185)');
247 gradient.addColorStop(0.6, 'rgba(255, 171, 46, 0.35375)');
248 gradient.addColorStop(0.4, 'rgba(255, 171, 46, 0.57965)');
249 gradient.addColorStop(0.2, 'rgba(255, 171, 46, 0.68195)');
250 gradient.addColorStop(0.0, 'rgba(255, 171, 46, 0.70000)');
251
252 ctx.fillStyle = gradient;
253 ctx.fill();
254 });
255}
256
257function redraw(mode) {
258 cancelAnimationFrame(animationId);

Callers 1

redrawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected