Menu
cosmic-mobile
publicLatest change d22956783f74f68f3d7eff1dd31f885aaf0fbe3e - Checkpoint BúiOS prototype and document clean-worktree workflow by AkurAI Build
use eframe::egui::*;
pub fn active(t: f32) -> bool {
t < 3.
}
pub fn particle(i: usize, t: f32) -> (f32, f32) {
let a = i as f32 * 2.399963;
let k = (t / 2.).clamp(0., 1.);
let k = k * k * (3. - 2. * k);
let radius = 110. + (i % 53) as f32 * 3.;
let spin = a + t.min(2.) * 2.;
let target = (a.cos() * 125., a.sin() * 55.);
(
(1. - k) * spin.cos() * radius + k * target.0,
(1. - k) * spin.sin() * radius + k * target.1,
)
}
// Repaint/timed-painter pattern: emilk/egui 0.33.3 dancing_strings.rs (MIT/Apache-2.0).
// ponytail: CPU-projected particles rendered by existing OpenGL; no 3D mesh or new renderer.
pub fn paint(ctx: &Context, t: f32) {
if !active(t) {
return;
}
ctx.request_repaint();
let alpha = ((3. - t) / 0.5).clamp(0., 1.);
let p = ctx.layer_painter(LayerId::new(Order::Tooltip, Id::new("boot")));
let rect = ctx.content_rect();
p.rect_filled(
rect,
0,
Color32::from_rgba_unmultiplied(12, 17, 32, (255. * alpha) as u8),
);
let center = rect.center();
for i in 0..240 {
let (x, y) = particle(i, t);
let depth = ((i as f32 * 2.399963).sin() + 1.) / 2.;
p.circle_filled(
center + vec2(x, y),
0.8 + depth * 1.7,
Color32::from_rgba_unmultiplied(110, 190, 255, (alpha * (80. + depth * 150.)) as u8),
);
}
let reveal = ((t - 1.) / 0.8).clamp(0., 1.) * alpha;
p.text(
center,
Align2::CENTER_CENTER,
"BúiOS",
FontId::proportional(48.),
Color32::from_white_alpha((255. * reveal) as u8),
);
}