emberDot function

void emberDot(
  1. Painter p,
  2. double x,
  3. double y,
  4. double k,
  5. double size,
  6. List<int> cols,
  7. double ph,
)

Implementation

void emberDot(
  Painter p,
  double x,
  double y,
  double k,
  double size,
  List<int> cols,
  double ph,
) {
  if (k < 0.25 && math.sin(ph) < 0.0) return;
  final c = k > 0.6 ? cols[0] : (k > 0.3 ? cols[1] : cols[2]);
  if (size >= 2.0) {
    final rim = k > 0.45 ? cols[2] : cols[3];
    p.px(x - 1, y, rim);
    p.px(x + 1, y, rim);
    p.px(x, y - 1, rim);
    p.px(x, y + 1, rim);
    p.px(x, y, c);
    p.glow(x, y, 8, c, 0.4 * k);
    return;
  }
  p.px(x, y, c);
  if (size > 1.4) p.px(x, y + 1, cols[3]);
  p.glow(x, y, 3.0 + size, c, 0.35 * k);
}