@@ -419,7 +419,7 @@ struct RotatingCircleResult {
419
419
fn rotating_discrete_circle (
420
420
center : Vec2 ,
421
421
radius : f32 ,
422
- t : f32 ,
422
+ start_angle : f32 ,
423
423
num_circles : i32 ,
424
424
cirle_index : i32 ,
425
425
) -> RotatingCircleResult {
@@ -428,7 +428,7 @@ fn rotating_discrete_circle(
428
428
// base angle for this circle index
429
429
let base_angle = angle_step * cirle_index as f32 ;
430
430
// total rotation angle
431
- let angle = base_angle + t * TWO_PI ;
431
+ let angle = base_angle + start_angle ;
432
432
// compute offset from center
433
433
let offset = vec2 ( angle. cos ( ) , angle. sin ( ) ) * radius;
434
434
// return world‐space position
@@ -529,28 +529,19 @@ impl Inputs {
529
529
let middle_circle_start_radius = start_radius + H ;
530
530
let middle_circle_radius = mix ( middle_circle_start_radius, target_radius, t_middle) ;
531
531
let middle_circle_start_position = bottom_middle - Vec2 :: new ( 0.0 , H ) ;
532
- let middle_circle_position = mix ( middle_circle_start_position, center, t_middle) ;
532
+ let mut middle_circle_position = mix ( middle_circle_start_position, center, t_middle) ;
533
533
let middle_circle_moved_distance =
534
534
( middle_circle_start_position - middle_circle_position) . length ( ) ;
535
535
let outer_circle_outer_radius = ( middle_circle_start_radius + target_radius)
536
536
- ( middle_circle_radius + middle_circle_moved_distance) ;
537
537
let trail_angular_extent = mix ( 0.0 , angle_between_circles, t_trail) ;
538
538
let outer_circle_fade = mix ( 1.0 , 0.4 , t_trail) ;
539
539
540
- let target_rotating_circle = rotating_discrete_circle (
541
- bottom_middle - Vec2 :: new ( 0.0 , H ) ,
542
- start_radius + H ,
543
- 0.0 ,
544
- num_circles,
545
- 3 ,
546
- ) ;
540
+ // y adjust to follow the middle circle
541
+ middle_circle_position. y -=
542
+ ( middle_circle_position. y + middle_circle_radius) * ( 1.0 - t_master) ;
547
543
548
- let m_start_circle = sdf_circle_outline (
549
- uv,
550
- target_rotating_circle. position ,
551
- target_radius,
552
- target_stroke,
553
- ) ;
544
+ let m_start_circle = sdf_circle_outline ( uv, Vec2 :: ZERO , target_radius, target_stroke) ;
554
545
debug_red_alpha = debug_red_alpha. max ( m_start_circle) ;
555
546
let m_middle_circle_path = sdf_circle_outline (
556
547
uv,
@@ -565,18 +556,10 @@ impl Inputs {
565
556
let outer_discrete_circle = rotating_discrete_circle (
566
557
middle_circle_position,
567
558
middle_circle_radius,
568
- -t_rotation * 5.0 ,
559
+ -t_rotation * TWO_PI * 5.0 ,
569
560
num_circles,
570
561
i,
571
562
) ;
572
- let m = sdf_circle_outline (
573
- uv,
574
- outer_discrete_circle. position - vec2 ( 0.1 , 0.0 ) ,
575
- outer_circle_outer_radius,
576
- target_stroke,
577
- ) ;
578
- // Combine masks using max to create a single mask.
579
- //combined_mask = combined_mask.max(m);
580
563
581
564
let outer_circle_inner_radius = ( outer_circle_outer_radius - target_stroke / 2.0 ) . max ( 0.0 ) ;
582
565
let outer_circle_outer_radius = outer_circle_outer_radius + target_stroke / 2.0 ;
@@ -606,6 +589,7 @@ impl Inputs {
606
589
607
590
let color_background = Vec4 :: ONE ;
608
591
let color_black = Vec4 :: new ( 0.0 , 0.0 , 0.0 , black_alpha) ;
592
+ //debug_red_alpha = 0.0;
609
593
let color_red = Vec4 :: new ( 1.0 , 0.0 , 0.0 , debug_red_alpha * 0.5 ) ;
610
594
let color_blue = Vec4 :: new ( 0.0 , 0.0 , 1.0 , debug_blue_alpha * 0.5 ) ;
611
595
0 commit comments