( app: Application, color: string, cache: Map<string, Texture>, )
| 34 | * live renderers. |
| 35 | */ |
| 36 | export function getCircleTexture( |
| 37 | app: Application, |
| 38 | color: string, |
| 39 | cache: Map<string, Texture>, |
| 40 | ): Texture { |
| 41 | const cached = cache.get(color); |
| 42 | if (cached) return cached; |
| 43 | |
| 44 | const g = new Graphics(); |
| 45 | g.circle(CIRCLE_RADIUS, CIRCLE_RADIUS, CIRCLE_RADIUS); |
| 46 | g.fill({ color }); |
| 47 | const tex = app.renderer.generateTexture(g); |
| 48 | g.destroy(); |
| 49 | cache.set(color, tex); |
| 50 | return tex; |
| 51 | } |
| 52 | |
| 53 | const GLOW_RADIUS = 48; // outer radius of the glow texture |
| 54 | const GLOW_RINGS = 8; // number of concentric rings to simulate gradient |
no test coverage detected