()
| 203 | } |
| 204 | |
| 205 | function lightModeRedraw() { |
| 206 | flights = flights.filter(flight => flight.tail_progrss < flight.total); |
| 207 | genNewFlight(); |
| 208 | |
| 209 | const now = Date.now(); |
| 210 | const fps = 1000 / (now - lastTimestamp); |
| 211 | lastTimestamp = now; |
| 212 | |
| 213 | const all_plane_info = flights.map(flight => { |
| 214 | return drawFlight(ctx, projection, flight, fps); |
| 215 | }); |
| 216 | |
| 217 | all_plane_info.forEach(plane_info => { |
| 218 | const [x, y, direction, opacity, display] = plane_info; |
| 219 | if (display) { |
| 220 | ctx.save(); |
| 221 | ctx.translate(x, y); |
| 222 | ctx.rotate(direction); |
| 223 | ctx.globalAlpha = opacity; |
| 224 | ctx.drawImage(img, -10 * proportion, -10 * proportion, 20 * proportion, 20 * proportion); |
| 225 | ctx.restore(); |
| 226 | } |
| 227 | }); |
| 228 | |
| 229 | ctx.beginPath(); |
| 230 | ctx.arc(...shanghai_projected, 5 * proportion, 0, 2 * Math.PI); |
| 231 | ctx.fillStyle = "#C25451"; |
| 232 | ctx.fill(); |
| 233 | } |
| 234 | |
| 235 | function darkModeRedraw() { |
| 236 | UnivList.forEach(univ => { |
no test coverage detected