@@ -24,7 +24,7 @@ function changeTheme(theme) {
24
24
if ( document . getElementById ( 'theme_in' ) !== null )
25
25
document . getElementById ( 'theme_in' ) . value = theme ;
26
26
27
- window . history . pushState ( `${ theme . toUpperCase ( ) } -THEME` , 'Changed theme ... ' , `${ theme } ` ) ;
27
+ // window.history.pushState(`${theme.toUpperCase()}-THEME`, 'Changed theme ... ', `${theme}`);
28
28
29
29
xhtp . open ( "GET" , "themes/" + theme + ".css" ) ;
30
30
xhtp . send ( ) ;
@@ -66,6 +66,43 @@ function display_array_color_pillars(arr) {
66
66
ctx . stroke ( ) ;
67
67
}
68
68
}
69
+ function display_array_pyramid ( arr , focused_els_i ) {
70
+ focused_els_i = focused_els_i || [ ] ;
71
+
72
+ ctx . clearRect ( 0 , 0 , canvas . width , canvas . height ) ;
73
+ let scale = canvas . width / Math . max ( ...arr ) ;
74
+
75
+ for ( let i = canvas . height / ( arr . length + 1 ) ; i <= canvas . height ; i += canvas . height / ( arr . length + 1 ) ) {
76
+ ctx . beginPath ( ) ;
77
+
78
+ ctx . strokeStyle = focused_els_i . includes ( Math . floor ( i / ( canvas . width / ( arr . length + 1 ) ) ) ) ? "red" : glob_themes [ glob_theme ] [ "color" ] ;
79
+ ctx . lineWidth = focused_els_i . includes ( Math . floor ( i / ( canvas . width / ( arr . length + 1 ) ) ) ) ? 4 : 2 ;
80
+
81
+ ctx . moveTo ( canvas . width / 2 - ( arr [ Math . floor ( i / ( canvas . width / ( arr . length + 1 ) ) ) - 1 ] * scale ) / 2 , i ) ;
82
+ ctx . lineTo ( canvas . width / 2 + ( arr [ Math . floor ( i / ( canvas . width / ( arr . length + 1 ) ) ) - 1 ] * scale ) / 2 , i ) ;
83
+
84
+ ctx . stroke ( ) ;
85
+ }
86
+ }
87
+ function display_array_color_pyramid ( arr ) {
88
+ ctx . clearRect ( 0 , 0 , canvas . width , canvas . height ) ;
89
+ let scale = canvas . height / Math . max ( ...arr ) ;
90
+
91
+ let line_weight = 2 ,
92
+ arr_max = Math . max ( ...arr ) ;
93
+
94
+ for ( let i = canvas . width / ( arr . length - 1 ) ; i <= canvas . width ; i += canvas . width / ( arr . length - 1 ) ) {
95
+ ctx . beginPath ( ) ;
96
+
97
+ ctx . strokeStyle = "hsl(" + arr [ Math . floor ( i / ( canvas . width / ( arr . length - 1 ) ) ) ] * ( 360 / arr_max ) + ", 100%, 50%)" ;
98
+ ctx . lineWidth = line_weight ;
99
+
100
+ ctx . moveTo ( canvas . width / 2 - ( arr [ Math . floor ( i / ( canvas . width / ( arr . length + 1 ) ) ) - 1 ] * scale ) / 2 , i ) ;
101
+ ctx . lineTo ( canvas . width / 2 + ( arr [ Math . floor ( i / ( canvas . width / ( arr . length + 1 ) ) ) - 1 ] * scale ) / 2 , i ) ;
102
+
103
+ ctx . stroke ( ) ;
104
+ }
105
+ }
69
106
function display_array_pillar_spiral ( arr , focused_els_i ) {
70
107
focused_els_i = focused_els_i || [ ] ;
71
108
ctx . clearRect ( 0 , 0 , canvas . width , canvas . height ) ;
0 commit comments