1- import { Controller } from " @hotwired/stimulus" ;
1+ import { Controller } from ' @hotwired/stimulus' ;
22
33export default class extends Controller {
4-
54 connect ( ) {
65 this . startSnowfall ( ) ;
76 }
@@ -37,12 +36,12 @@ export default class extends Controller {
3736 startSnowfall ( ) {
3837 const snowflakeCount = this . getSnowflakeCount ( ) ;
3938 const svgUrls = [
40- " /img/ui/santa/snowflake-2.svg" ,
41- " /img/ui/santa/snowflake-3.svg" ,
42- " /img/ui/santa/snowflake-4.svg" ,
43- " /img/ui/santa/snowflake-5.svg" ,
44- " /img/ui/santa/snowflake-6.svg" ,
45- " /img/ui/santa/snowflake-7.svg" ,
39+ ' /img/ui/santa/snowflake-2.svg' ,
40+ ' /img/ui/santa/snowflake-3.svg' ,
41+ ' /img/ui/santa/snowflake-4.svg' ,
42+ ' /img/ui/santa/snowflake-5.svg' ,
43+ ' /img/ui/santa/snowflake-6.svg' ,
44+ ' /img/ui/santa/snowflake-7.svg' ,
4645 ] ;
4746
4847 for ( let i = 0 ; i < snowflakeCount ; i ++ ) {
@@ -55,15 +54,15 @@ export default class extends Controller {
5554 * Создаёт элемент снежинки с рандомными стилями.
5655 */
5756 createSnowflake ( svgUrls ) {
58- const snowflake = document . createElement ( " img" ) ;
59- snowflake . classList . add ( " snowflake" ) ;
57+ const snowflake = document . createElement ( ' img' ) ;
58+ snowflake . classList . add ( ' snowflake' ) ;
6059
61- snowflake . src = svgUrls [ Math . floor ( Math . random ( ) * svgUrls . length ) ] ;
60+ snowflake . src = svgUrls [ Math . floor ( Math . random ( ) * svgUrls . length ) ] ;
6261
63- snowflake . style . setProperty ( " --snowflake-size" , `${ this . getRandomInRange ( 0.5 , 1 , 2 ) } rem` ) ;
64- snowflake . style . setProperty ( " --snowflake-left" , `${ this . getRandomInRange ( 0 , 100 , 5 ) } vw` ) ;
65- snowflake . style . setProperty ( " --fall-duration" , `${ this . getRandomInRange ( 5 , 20 , 2 ) } s` ) ;
66- snowflake . style . setProperty ( " --fall-delay" , `${ this . getRandomInRange ( 0 , 5 , 1 ) } s` ) ;
62+ snowflake . style . setProperty ( ' --snowflake-size' , `${ this . getRandomInRange ( 0.5 , 1 , 2 ) } rem` ) ;
63+ snowflake . style . setProperty ( ' --snowflake-left' , `${ this . getRandomInRange ( 0 , 100 , 5 ) } vw` ) ;
64+ snowflake . style . setProperty ( ' --fall-duration' , `${ this . getRandomInRange ( 5 , 20 , 2 ) } s` ) ;
65+ snowflake . style . setProperty ( ' --fall-delay' , `${ this . getRandomInRange ( 0 , 5 , 1 ) } s` ) ;
6766
6867 return snowflake ;
6968 }
0 commit comments