@@ -50,6 +50,9 @@ public class Editor : Toplevel
5050 private static string _keymapPath = string . Empty ;
5151 private static string _logDirectory = string . Empty ;
5252
53+ int step = 0 ;
54+ private int numberOfSteps = 50 ;
55+
5356 /// <summary>
5457 /// True to disable logging (must be set before constructing <see cref="Editor"/>).
5558 /// </summary>
@@ -75,6 +78,13 @@ public Editor()
7578 this . Closing += this . Editor_Closing ;
7679
7780 this . BuildRootMenu ( ) ;
81+
82+ Application . AddTimeout ( TimeSpan . FromMilliseconds ( 100 ) , ( ) =>
83+ {
84+ step = ( step + 1 ) % numberOfSteps ;
85+ this . SetNeedsDraw ( ) ;
86+ return true ;
87+ } ) ;
7888 }
7989
8090 private void LoadKeyMap ( )
@@ -341,6 +351,23 @@ protected override bool OnDrawingContent()
341351 return r ;
342352 }
343353
354+ // The main ASCII art text block
355+ static readonly string
356+ ArtText = """
357+ ___________ .__ .__
358+ \__ ___/__________ _____ |__| ____ _____ | |
359+ | |_/ __ \_ __ \/ \| |/ \\__ \ | |
360+ | |\ ___/| | \/ Y Y \ | | \/ __ \| |__
361+ |____| \___ >__| |__|_| /__|___| (____ /____/
362+ \/ \/ \/ \/
363+ ________ .__ ________ .__
364+ / _____/ __ __|__| \______ \ ____ _____|__| ____ ____ ___________
365+ / \ ___| | \ | | | \_/ __ \ / ___/ |/ ___\ / \_/ __ \_ __ \
366+ \ \_\ \ | / | | ` \ ___/ \___ \| / /_/ > | \ ___/| | \/
367+ \______ /____/|__| /_______ /\___ >____ >__\___ /|___| /\___ >__|
368+ \/ \/ \/ \/ /_____/ \/ \/
369+ """ . Replace ( "\r \n " , "\n " ) ;
370+
344371 private void RenderTitle ( Rectangle inArea )
345372 {
346373 var assembly = typeof ( Label ) . Assembly ;
@@ -353,31 +380,12 @@ private void RenderTitle(Rectangle inArea)
353380 informationalVersion = informationalVersion . Substring ( 0 , informationalVersion . IndexOf ( '+' ) ) ;
354381 }
355382
356- // The main ASCII art text block
357- string artText = """
358- ___________ .__ .__
359- \__ ___/__________ _____ |__| ____ _____ | |
360- | |_/ __ \_ __ \/ \| |/ \\__ \ | |
361- | |\ ___/| | \/ Y Y \ | | \/ __ \| |__
362- |____| \___ >__| |__|_| /__|___| (____ /____/
363- \/ \/ \/ \/
364- ________ .__ ________ .__
365- / _____/ __ __|__| \______ \ ____ _____|__| ____ ____ ___________
366- / \ ___| | \ | | | \_/ __ \ / ___/ |/ ___\ / \_/ __ \_ __ \
367- \ \_\ \ | / | | ` \ ___/ \___ \| / /_/ > | \ ___/| | \/
368- \______ /____/|__| /_______ /\___ >____ >__\___ /|___| /\___ >__|
369- \/ \/ \/ \/ /_____/ \/ \/
370- """ ;
371-
372- // Standardize the text
373- artText = artText . Replace ( "\r \n " , "\n " ) ;
374-
375383 // The version information line
376384 string versionLine = $ "(Alpha - { informationalVersion } )";
377385 string logLine = "Logs - " + _logDirectory ;
378386
379387 // Split the ASCII art into lines
380- var artLines = artText . Split ( '\n ' ) ;
388+ var artLines = ArtText . Split ( '\n ' ) ;
381389
382390 // Calculate the starting point for centering the art text
383391 int artHeight = artLines . Length ;
@@ -438,6 +446,10 @@ ________ .__ ________ .__
438446 int artStartX = inArea . X + ( inArea . Width - artWidth ) / 2 ;
439447 int artStartY = inArea . Y + ( inArea . Height - artHeight - 1 ) / 2 ; // -1 for the version line below
440448
449+ int centerX = inArea . X + inArea . Width / 2 ;
450+ int centerY = inArea . Y + inArea . Height / 2 ;
451+
452+
441453 // Create the gradient
442454 var gradient = new Gradient (
443455 new [ ]
@@ -454,6 +466,22 @@ ________ .__ ________ .__
454466 ) ;
455467 var fill = new GradientFill ( inArea , gradient , GradientDirection . Diagonal ) ;
456468
469+
470+ double t = 2 * Math . PI * step / ( float ) numberOfSteps ; // full loop every
471+
472+ // Scale the figure-eight
473+ double fx = Math . Sin ( t ) ;
474+ double fy = Math . Sin ( t ) * Math . Cos ( t ) ;
475+
476+ // Define x/y radii of the figure
477+ int rx = ( int ) ( inArea . Width * 0.3 ) ; // horizontal stretch
478+ int ry = ( int ) ( inArea . Height * 1 ) ; // tall figure-eight
479+
480+ // Convert to screen coordinates
481+ int lightX = centerX + ( int ) ( fx * rx ) ;
482+ int lightY = centerY + ( int ) ( fy * ry ) ;
483+
484+
457485 // Render the ASCII art block
458486 for ( int i = 0 ; i < artLines . Length ; i ++ )
459487 {
@@ -463,8 +491,9 @@ ________ .__ ________ .__
463491 int x = artStartX + j ;
464492 int y = artStartY + i ;
465493
466- var colorAtPoint = fill . GetColor ( new Point ( x , y ) ) ;
467- Driver . SetAttribute ( new Attribute ( new Color ( colorAtPoint ) , new Color ( Color . Black ) ) ) ;
494+ var baseColor = fill . GetColor ( new Point ( x , y ) ) ;
495+ var adjustedColor = AdjustColorForLightDistance ( lightX , lightY , baseColor , x , y ) ;
496+ Driver . SetAttribute ( new Attribute ( new Color ( adjustedColor ) , new Color ( Color . Black ) ) ) ;
468497 this . AddRune ( x , y , ( Rune ) line [ j ] ) ;
469498 }
470499 }
@@ -478,11 +507,18 @@ ________ .__ ________ .__
478507 int x = versionLineX + i ;
479508 int y = versionLineY ;
480509
481- var colorAtPoint = fill . GetColor ( new Point ( x , y ) ) ;
482- Driver . SetAttribute ( new Attribute ( new Color ( colorAtPoint ) , new Color ( Color . Black ) ) ) ;
510+ var baseColor = fill . GetColor ( new Point ( x , y ) ) ;
511+ var adjustedColor = AdjustColorForLightDistance ( lightX , lightY , baseColor , x , y ) ;
512+
513+ Driver . SetAttribute ( new Attribute ( new Color ( adjustedColor ) , new Color ( Color . Black ) ) ) ;
483514 this . AddRune ( x , y , ( Rune ) versionLine [ i ] ) ;
484515 }
485516
517+ // Optional, to debug 'light' path
518+ Driver . SetAttribute ( new Attribute ( Color . BrightYellow , Color . Black ) ) ;
519+ this . AddRune ( lightX , lightY , new Rune ( '*' ) ) ;
520+
521+
486522 if ( Quiet )
487523 {
488524 return ;
@@ -497,14 +533,71 @@ ________ .__ ________ .__
497533 int x = logLineX + i ;
498534 int y = logLineY ;
499535
500- var colorAtPoint = fill . GetColor ( new Point ( x , y ) ) ;
501- Driver . SetAttribute ( new Attribute ( new Color ( colorAtPoint ) , new Color ( Color . Black ) ) ) ;
536+ var baseColor = fill . GetColor ( new Point ( x , y ) ) ;
537+ var adjustedColor = AdjustColorForLightDistance ( lightX , lightY , baseColor , x , y ) ;
538+
539+ Driver . SetAttribute ( new Attribute ( new Color ( adjustedColor ) , new Color ( Color . Black ) ) ) ;
502540 this . AddRune ( x , y , ( Rune ) logLine [ i ] ) ;
503541 }
504542 }
505543 }
506544
545+ private int AdjustColorForLightDistance ( int lightX , int lightY , Color baseColor , int x , int y )
546+ {
547+
548+ // Distance to light source
549+ double dx = x - lightX ;
550+ double dy = y - lightY ;
551+ double distSq = dx * dx + dy * dy ;
552+
553+ const double maxDistSq = 1600.0 ; // Bigger influence area (~40 px radius)
554+ double normalized = Math . Min ( distSq / maxDistSq , 1.0 ) ;
555+
556+ double brightnessDelta ;
557+
558+ if ( normalized < 0.2 )
559+ {
560+ // Strong brightening close to light
561+ brightnessDelta = 0.4 - ( normalized / 0.2 ) * 0.2 ; // 0.4 to 0.2
562+ }
563+ else if ( normalized < 0.6 )
564+ {
565+ // Smoothly fade to neutral
566+ brightnessDelta = 0.2 - ( ( normalized - 0.2 ) / 0.4 ) * 0.2 ; // 0.2 to 0
567+ }
568+ else
569+ {
570+ // Begin darkening
571+ brightnessDelta = - ( ( normalized - 0.6 ) / 0.4 ) * 0.6 ; // 0 to -0.6
572+ }
573+
574+ return AdjustBrightness ( baseColor , brightnessDelta ) ;
575+ }
576+
577+
578+ private Color AdjustBrightness ( Color color , double factor )
579+ {
580+ int r = color . R ;
581+ int g = color . G ;
582+ int b = color . B ;
583+
584+ if ( factor > 0 )
585+ {
586+ r += ( int ) ( ( 255 - r ) * factor ) ;
587+ g += ( int ) ( ( 255 - g ) * factor ) ;
588+ b += ( int ) ( ( 255 - b ) * factor ) ;
589+ }
590+ else
591+ {
592+ r = ( int ) ( r * ( 1.0 + factor ) ) ; // factor is negative, dims
593+ g = ( int ) ( g * ( 1.0 + factor ) ) ;
594+ b = ( int ) ( b * ( 1.0 + factor ) ) ;
595+ }
596+
597+ return new Color ( Clamp ( r ) , Clamp ( g ) , Clamp ( b ) ) ;
598+ }
507599
600+ private int Clamp ( int val ) => Math . Max ( 0 , Math . Min ( 255 , val ) ) ;
508601
509602
510603 /// <summary>
0 commit comments