diff --git a/game/src/render/traffic_signal.rs b/game/src/render/traffic_signal.rs index 61fbfd6c41..83d3025657 100644 --- a/game/src/render/traffic_signal.rs +++ b/game/src/render/traffic_signal.rs @@ -40,11 +40,12 @@ pub fn draw_signal_phase( } } - let percent = if let Some(t) = time_left { - (t / phase.duration) as f32 + let (yellow_light, percent) = if let Some(t) = time_left { + (t <= Duration::seconds(5.0), (t / phase.duration) as f32) } else { - 1.0 + (false, 1.0) }; + let yellow = Color::YELLOW; for g in &phase.protected_groups { if !g.crosswalk { let slice_start = if crossed_roads.contains(&(g.from.id, g.parent)) { @@ -60,7 +61,11 @@ pub fn draw_signal_phase( let pl = &signal.turn_groups[g].geom; batch.push( - protected_color.alpha(percent), + if yellow_light { + yellow + } else { + protected_color.alpha(percent) + }, pl.exact_slice(slice_start, pl.length() - slice_end) .make_arrow(BIG_ARROW_THICKNESS, ArrowCap::Triangle) .unwrap(), @@ -87,7 +92,7 @@ pub fn draw_signal_phase( center, 0.07, angle, - RewriteColor::ChangeAlpha(percent), + RewriteColor::NoOp, true, ); } @@ -95,7 +100,7 @@ pub fn draw_signal_phase( assert!(!g.crosswalk); let pl = &signal.turn_groups[g].geom; batch.extend( - Color::BLACK.alpha(percent), + Color::BLACK, pl.exact_slice( SIDEWALK_THICKNESS - Distance::meters(0.1), pl.length() - SIDEWALK_THICKNESS + Distance::meters(0.1), @@ -108,7 +113,11 @@ pub fn draw_signal_phase( ), ); batch.extend( - protected_color.alpha(percent), + if yellow_light { + yellow + } else { + protected_color.alpha(percent) + }, pl.exact_slice(SIDEWALK_THICKNESS, pl.length() - SIDEWALK_THICKNESS) .dashed_arrow( BIG_ARROW_THICKNESS / 2.0,