wisp_storybook/stories/
s_vector_overlays.rs1use glam::Vec2;
13use wisp::application::Application;
14use wisp::math::Rect;
15use wisp::{Callout, Color, Highlight, Stage, VectorShape, VectorStroke};
16
17use crate::story::Story;
18
19pub fn story() -> Story {
20 Story {
21 id: "vector-overlays",
22 category: "Vector",
23 title: "Highlight + callout overlays",
24 milestone: "M-VEC.8 / M-VEC.9",
25 writeup: include_str!("writeups/vector_overlays.md"),
26 build,
27 tick: None,
28 }
29}
30
31fn build(_app: &Application, stage: &mut Stage) {
32 let root = stage.root();
33
34 let outline = Highlight::outline(
36 VectorShape::rounded_rect(Rect::new(-0.7, 0.25, 0.45, 0.25), 0.06),
37 Color::rgba_u8(255, 230, 80, 255),
38 0.025,
39 );
40 let _ = outline.add_to_stage(stage, root);
41
42 let pill = Highlight::pill(
44 Rect::new(0.05, 0.30, 0.55, 0.12),
45 Color::rgba_u8(80, 220, 240, 255),
46 0.5,
47 );
48 let _ = pill.add_to_stage(stage, root);
49
50 let label = Callout::label_box(
52 Rect::new(-0.6, -0.4, 0.6, 0.25),
53 Color::rgba_u8(220, 170, 80, 230),
54 Some(VectorStroke::new(0.012, Color::WHITE)),
55 0.04,
56 );
57 let _ = label.add_to_stage(stage, root);
58
59 let badge = Callout::badge(
61 Vec2::new(0.55, 0.5),
62 0.085,
63 Color::rgba_u8(220, 60, 50, 255),
64 );
65 let _ = badge.add_to_stage(stage, root);
66
67 let caption = Callout::caption_pill(
69 Rect::new(-0.55, -0.7, 1.1, 0.09),
70 Color::rgba_u8(40, 50, 70, 240),
71 );
72 let _ = caption.add_to_stage(stage, root);
73
74 let glow = Highlight::glow(
76 VectorShape::circle(Vec2::new(0.55, 0.5), 0.1),
77 Color::rgba_u8(255, 80, 70, 255),
78 0.05,
79 );
80 let _ = glow.add_to_stage(stage, root);
81}