# include struct PhigrosEffect : IEffect { struct Particle { Vec2 start; Vec2 velocity; double alpha; }; Array m_particles; Vec2 center; explicit PhigrosEffect(const Vec2& start) : m_particles(Random(1, 4)), center(start) { for (auto& particle : m_particles) { const Vec2 vec = RandomVec2(40.0); particle.start = start + vec; particle.velocity = vec*Random(0.5,1.0); particle.alpha = Random(0.4, 1.0); } } bool update(double t) override { t *= 1.5; for (const auto& particle : m_particles) { const Vec2 pos = particle.start + particle.velocity*EaseOutQuad(t); RectF{ pos, 10.0 }.draw(ColorF(1,1,0.7,particle.alpha*(1-EaseInQuad(t)))); } RectF{ Arg::center(center),40 + EaseOutExpo(t) * 25 }.drawFrame(2, ColorF(1, 1, 0.7, 1 - EaseInQuad(t))); RectF{ Arg::center(center),40 + EaseOutExpo(t) * 25 }.rotated(45_deg).drawFrame(1, ColorF(1, 1, 0.7, 0.5 - EaseInQuad(t) * 0.5)); RectF{ Arg::center(center),40 + EaseOutQuart(t) * 25 }.rotated(45_deg).drawFrame(1, ColorF(1, 1, 0.7, 0.5 - EaseInQuad(t) * 0.5)); RectF{ Arg::center(center),40 + EaseOutSine(t) * 25 }.rotated(45_deg).drawFrame(1, ColorF(1, 1, 0.7, 0.5 - EaseInQuad(t) * 0.5)); Circle{ Arg::center(center),10 - EaseOutCubic(t) * 7 }.draw(ColorF(1, 1, 0.7, 1 - EaseInQuad(t))); Circle{ Arg::center(center),10 }.draw(ColorF(1, 1, 0.7, 0.5 - EaseInQuad(t) * 0.5)); Circle{ Arg::center(center),30 }.drawArc(180_deg + t * 20_deg, 75_deg, 2.0, 0.0, ColorF(1, 1, 0.7, 1 - EaseInQuad(t))); Circle{ Arg::center(center),30 }.drawArc(t * 20_deg, 75_deg, 2.0, 0.0, ColorF(1, 1, 0.7, 1 - EaseInQuad(t))); return (t < 1.0); } }; void Main() { Effect effect; while (System::Update()) { if (MouseL.down()) { effect.add(Cursor::Pos()); } effect.update(); } }