@@ -1001,7 +1001,7 @@ async function twitchHypeTrainStart(data) {
10011001 const goalElement = document . querySelector ( '#goals' ) ;
10021002 const hypeTrainTemplate = document . querySelector ( '#hypetrain-template' ) ;
10031003 const hypeTrainClone = hypeTrainTemplate . content . cloneNode ( true ) ;
1004- const hypeTrainElement = hypeTrainClone . firstElementChild ;
1004+ const hypetrainElement = hypeTrainClone . firstElementChild ;
10051005
10061006 const {
10071007 'progressbar-fill' : progressBarFill ,
@@ -1017,14 +1017,14 @@ async function twitchHypeTrainStart(data) {
10171017 ) ;
10181018
10191019 if ( is_golden_kappa_train == true ) {
1020- hypeTrainElement . classList . add ( 'golden-kappa-train' ) ;
1020+ hypetrainElement . classList . add ( 'golden-kappa-train' ) ;
10211021 logo . querySelector ( 'img' ) . src = 'js/modules/twitch/images/golden-kappa-emote.png' ;
10221022 icon . querySelector ( 'span' ) . textContent = tRD ( 'twitch.hypetrain.bar_golden_kappa' ) ;
10231023 }
10241024
10251025 if ( is_treasure_train == true ) {
1026- hypeTrainElement . classList . add ( 'treasure-train' ) ;
1027- logo . querySelector ( 'img' ) . src = 'js/modules/twitch/images/icon-treasure.svg ' ;
1026+ hypetrainElement . classList . add ( 'treasure-train' ) ;
1027+ logo . querySelector ( 'img' ) . src = 'js/modules/twitch/images/icon-treasure-train.png ' ;
10281028 icon . querySelector ( 'i' ) . remove ( ) ;
10291029 icon . querySelector ( 'span' ) . textContent = tRD ( 'twitch.hypetrain.bar_treasure' ) ;
10301030 }
@@ -1036,9 +1036,10 @@ async function twitchHypeTrainStart(data) {
10361036 info . textContent = hypetrainInfo ;
10371037 info . classList . add ( 'animate__animated' ) ;
10381038
1039- hypeTrainElement . classList . add ( 'animate__fadeInDown' ) ;
1039+ hypetrainElement . classList . add ( 'animate__fadeInDown' ) ;
1040+ hypetrainElement . querySelector ( '.info' ) . classList . add ( 'animate__fadeIn' ) ;
10401041
1041- goalElement . insertAdjacentElement ( 'beforeend' , hypeTrainElement ) ;
1042+ goalElement . insertAdjacentElement ( 'beforeend' , hypetrainElement ) ;
10421043
10431044 requestAnimationFrame ( ( ) => {
10441045 requestAnimationFrame ( ( ) => {
@@ -1147,6 +1148,7 @@ async function twitchHypeTrainLevelUp(data) {
11471148 if ( showTwitchHypeTrainBar == true ) {
11481149
11491150 const hypetrainElement = document . querySelector ( '#hypetrain' ) ;
1151+ twitchConfettiBurst ( hypetrainElement ) ;
11501152
11511153 hypetrainElement . querySelector ( '.level' ) . textContent = `LVL ${ level } ` ;
11521154 hypetrainElement . querySelector ( '.progressbar-fill' ) . style . width = `${ htProgress } %` ;
@@ -1818,4 +1820,20 @@ async function getTwitchUserPronouns(username) {
18181820 console . error ( `Couldn't retrieve pronouns for ${ username } :` , err ) ;
18191821 return '' ;
18201822 }
1823+ }
1824+
1825+ function twitchConfettiBurst ( el ) {
1826+ const rect = el . getBoundingClientRect ( ) ;
1827+
1828+ myConfetti ( {
1829+ particleCount : 100 ,
1830+ spread : 100 ,
1831+ startVelocity : 20 ,
1832+ gravity : 1.5 ,
1833+ ticks : 80 ,
1834+ origin : {
1835+ x : ( rect . left + rect . width / 2 ) / window . innerWidth ,
1836+ y : ( rect . top + rect . height / 2 ) / window . innerHeight ,
1837+ } ,
1838+ } ) ;
18211839}
0 commit comments