@@ -54,10 +54,16 @@ pub(crate) struct GuiState {
5454 configuring_generation : Option < ( SourceImg , GenerationSettings , GuiImageCache ) > ,
5555 pub current_preset : usize ,
5656 error_message : Option < String > ,
57+
58+ has_obamified_once : bool ,
5759}
5860
5961impl GuiState {
60- pub fn default ( presets : Vec < Preset > , current_preset : usize ) -> GuiState {
62+ pub fn default (
63+ presets : Vec < Preset > ,
64+ current_preset : usize ,
65+ has_obamified_once : bool ,
66+ ) -> GuiState {
6167 GuiState {
6268 animate : true ,
6369 //fps_text: String::new(),
@@ -75,6 +81,7 @@ impl GuiState {
7581 configuring_generation : None ,
7682 current_preset,
7783 error_message : None ,
84+ has_obamified_once,
7885 }
7986 }
8087
@@ -128,6 +135,7 @@ fn hide_icons() {
128135impl App for ObamifyApp {
129136 fn save ( & mut self , storage : & mut dyn eframe:: Storage ) {
130137 eframe:: set_value ( storage, "presets" , & self . gui . presets ) ;
138+ eframe:: set_value ( storage, "has_obamified_once" , & self . gui . has_obamified_once ) ;
131139 }
132140 fn update ( & mut self , ctx : & egui:: Context , frame : & mut Frame ) {
133141 let Some ( rs) = frame. wgpu_render_state ( ) else {
@@ -331,7 +339,14 @@ impl App for ObamifyApp {
331339 } ) ;
332340 ui. separator ( ) ;
333341
334- if ui. button ( "save gif" ) . clicked ( ) {
342+ if ui
343+ . button ( if self . reverse {
344+ "save reverse gif"
345+ } else {
346+ "save gif"
347+ } )
348+ . clicked ( )
349+ {
335350 self . gif_recorder . status = GifStatus :: Recording ;
336351 self . gif_recorder . encoder = None ;
337352 if let Err ( err) = self
@@ -460,7 +475,25 @@ impl App for ObamifyApp {
460475 }
461476 } ) ;
462477
463- if ui. button ( "obamify new image" ) . clicked ( ) {
478+ // Make button glow if user hasn't obamified once
479+ let button_response = if !self . gui . has_obamified_once {
480+ // Create a glowing effect by animating the button outline
481+ let time = ui. input ( |i| i. time ) ;
482+ let pulse = ( ( time * 2.0 ) . sin ( ) * 0.5 + 0.5 ) as f32 ;
483+ let glow_color = egui:: Color32 :: from_rgb (
484+ ( 30.0 + pulse * 100.0 ) as u8 ,
485+ ( 120.0 + pulse * 135.0 ) as u8 ,
486+ ( 200.0 + pulse * 55.0 ) as u8 ,
487+ ) ;
488+
489+ let button = egui:: Button :: new ( "obamify new image" )
490+ . stroke ( egui:: Stroke :: new ( 1.0 , glow_color) ) ;
491+ ui. add ( button)
492+ } else {
493+ ui. button ( "obamify new image" )
494+ } ;
495+
496+ if button_response. clicked ( ) {
464497 // open file select
465498 prompt_image (
466499 "choose image to obamify" ,
@@ -793,6 +826,7 @@ impl App for ObamifyApp {
793826 self . gui . presets . len ( ) - 1 ,
794827 ) ;
795828 self . gui . animate = true ;
829+ self . gui . has_obamified_once = true ;
796830 self . gui . hide_progress_modal ( ) ;
797831 ui. close ( ) ;
798832 break ;
0 commit comments