11import  {  CommonModule ,  NgClass  }  from  '@angular/common' ; 
22import  {  Component  }  from  '@angular/core' ; 
3- import  {  UntilDestroy  }  from  '@ngneat/until-destroy' ; 
43import  {  concat ,  timer  }  from  'rxjs' ; 
5- import  {  delay ,   map ,  repeat ,  startWith ,  takeWhile ,   tap  }  from  'rxjs/operators' ; 
4+ import  {  map ,  repeat ,  startWith ,  takeWhile  }  from  'rxjs/operators' ; 
65
7- @UntilDestroy ( ) 
86@Component ( { 
97  selector : 't-logo' , 
108  standalone : true , 
@@ -13,29 +11,30 @@ import { delay, map, repeat, startWith, takeWhile, tap } from 'rxjs/operators';
1311  styleUrls : [ './logo.component.scss' ] 
1412} ) 
1513export  class  LogoComponent  { 
16-   blinkingEyesClass$  =  timer ( 0 ,  500 ) . pipe ( 
17-     startWith ( 0 ) , 
18-     map ( ( x )  =>  x  +  1 ) , 
19-     takeWhile ( ( x )  =>  x  <  6 ) , 
20-     map ( ( x )  =>  `l${ x  %  2  ===  0  ? 1  : 2 }  ` ) 
21-   ) ; 
22- 
2314  runningClass$  =  timer ( 0 ,  100 ) . pipe ( 
2415    startWith ( 0 ) , 
25-     map ( ( x )  =>  x  +  1 ) , 
26-     takeWhile ( ( x )  =>  x  <=  40 ) , 
27-     map ( ( x )  =>  { 
28-       const  range  =  Math . ceil ( x  /  10 ) ; 
16+     takeWhile ( ( t )  =>  t  <  40 ) , 
17+     map ( ( t )  =>  { 
18+       const  range  =  Math . ceil ( ( t  +  1 )  /  10 ) ; 
2919      const  side  =  range  %  2  ===  0  ? 'l'  : 'r' ; 
30-       const  runningLegState  =  x  %  2  ===  0  ? 3  : 4 ; 
31-       const  legState  =  x  ===  40  ? 1  : runningLegState ; 
20+       const  runningLegState  =  t  %  2  ===  1  ? 3  : 4 ; 
21+       const  legState  =  t  ===  39  ? 1  : runningLegState ; 
3222      return  `${ side } ${ legState }  ` ; 
3323    } ) 
3424  ) ; 
3525
36-   dragonNgClass$  =  concat ( this . blinkingEyesClass$ ,  this . runningClass$ ) . pipe ( 
37-     delay ( 5000 ) , 
38-     repeat ( 1000 ) , 
39-     map ( ( className )  =>  [ 'bg dragon' ,  className ] ) 
26+   blinkingEyesClass$  =  timer ( 0 ,  500 ) . pipe ( 
27+     startWith ( 0 ) , 
28+     takeWhile ( ( t )  =>  t  <  5 ) , 
29+     map ( ( t )  =>  `l${ t  %  2  ===  1  ? 1  : 2 }  ` ) 
30+   ) ; 
31+ 
32+   restingClass$  =  timer ( 5000 ) . pipe ( 
33+     startWith ( 0 ) , 
34+     map ( ( )  =>  'l2' ) 
35+   ) ; 
36+ 
37+   dragonClass$  =  concat ( this . runningClass$ ,  this . blinkingEyesClass$ ,  this . restingClass$ ) . pipe ( 
38+     repeat ( Infinity ) 
4039  ) ; 
4140} 
0 commit comments