smokePuff function

void smokePuff(
  1. Painter p,
  2. double x,
  3. double y,
  4. double k,
  5. double size, [
  6. int col = 0,
  7. bool big = false,
  8. double aMul = 1.0,
])

Implementation

void smokePuff(
  Painter p,
  double x,
  double y,
  double k,
  double size, [
  int col = 0,
  bool big = false,
  double aMul = 1.0,
]) {
  final age = 1.0 - k;
  final r = size *
      (0.65 + math.min(1.0, age * 2.5) * 0.45 + age * (big ? 0.5 : 0.4));
  final a = math.min(1.0, age * 12.0) *
      math.min(1.0, k * 2.4) *
      (big ? 0.7 : 0.58) *
      aMul;
  final c = col != 0
      ? mix(col, _rampAt(kSmokeRamp, age), age)
      : _rampAt(kSmokeRamp, age * 1.05);
  softDisc(p, x, y, r, c, a * 0.45);
  softDisc(p, x + r * 0.05, y + r * 0.06, r * 0.74, c, a * 0.62);
  if (age < 0.5) {
    softDisc(p, x - r * 0.22, y - r * 0.3, r * 0.5, mix(c, kWhite, 0.12),
        a * 0.4 * (1.0 - age * 2.0));
  }
}