@@ -1775,23 +1775,21 @@ class Myr {
17751775 //if the element is light
17761776 if ( String ( el . id ) . includes ( "lgt" ) ) {
17771777 let split = el . light . state . split ( / \s | ; / ) . filter ( Boolean ) ;
1778- let colorIndex = split . indexOf ( "color:" ) ;
1779- let baseCol = split [ colorIndex + 1 ] ;
1778+ let colorIndex = split . indexOf ( "color:" ) + 1 ;
1779+ let baseCol = split [ colorIndex ] ;
17801780 if ( this . colourNameToHex ( baseCol ) !== false ) {
17811781 baseCol = this . colourNameToHex ( baseCol ) ;
17821782 }
17831783 if ( this . colourNameToHex ( color ) !== false ) {
17841784 color = this . colourNameToHex ( color ) ;
17851785 }
1786- let anim = `
1787- property: light.color;
1786+ let anim = `property: light.color;
17881787 from: ${ baseCol } ;
17891788 to: ${ color } ;
17901789 dur: ${ this . cursor . duration } ;
17911790 dir: alternate;
17921791 loop: ${ Boolean ( this . cursor . loop ) } ;
1793- type: color;
1794- ` ;
1792+ type: color;` ;
17951793 el . animation__color = anim ;
17961794 return outerElId ;
17971795 }
@@ -1801,31 +1799,29 @@ class Myr {
18011799 let innerEl = el . els [ i ] ;
18021800 //innerEl.material.split(/\s|;/) returns an array of strings separated by " " and ";",
18031801 //color is always its first attribute (after "color: ")
1804- let anim = `
1805- property: components.material.material.color;
1806- from: ${ ( innerEl . material . split ( / \s | ; / ) ) [ 1 ] } ;
1807- to: ${ color } ;
1808- dur: ${ this . cursor . duration } ;
1809- dir: alternate;
1810- loop: ${ Boolean ( this . cursor . loop ) } ;
1811- isRawProperty: true;
1812- type: color;
1813- ` ;
1802+ let anim = `property: components.material.material.color;
1803+ from: ${ ( innerEl . material . split ( / \s | ; / ) ) [ 1 ] } ;
1804+ to: ${ color } ;
1805+ dur: ${ this . cursor . duration } ;
1806+ dir: alternate;
1807+ loop: ${ Boolean ( this . cursor . loop ) } ;
1808+ isRawProperty: true;
1809+ type: color;` ;
18141810 innerEl . animation__color = anim ;
18151811
18161812 }
18171813 return outerElId ;
18181814 }
1819- let anim = `
1820- property: components .material.material.color ;
1821- from: ${ ( el . material . split ( / \s | ; / ) ) [ 2 ] } ;
1822- to : ${ color } ;
1823- dur : ${ this . cursor . duration } ;
1824- dir: alternate ;
1825- loop: ${ Boolean ( this . cursor . loop ) } ;
1826- isRawProperty: true ;
1827- type: color ;
1828- ` ;
1815+
1816+ const mat = el . material . split ( / \s | ; / ) ;
1817+ let anim = `property: components .material.material.color ;
1818+ from : ${ mat [ mat . indexOf ( " color:" ) + 1 ] } ;
1819+ to : ${ color } ;
1820+ dur: ${ this . cursor . duration } ;
1821+ dir: alternate ;
1822+ loop: ${ Boolean ( this . cursor . loop ) } ;
1823+ isRawProperty: true ;
1824+ type: color; ` ;
18291825 el . animation__color = anim ;
18301826 return outerElId ;
18311827 }
0 commit comments