File tree Expand file tree Collapse file tree 1 file changed +28
-8
lines changed
Expand file tree Collapse file tree 1 file changed +28
-8
lines changed Original file line number Diff line number Diff line change 1818 background-color : # ededed ;
1919 }
2020
21- pre {
21+ # controller {
22+ width : 100%
23+ }
24+
25+ # console {
2226 font-family : 'Courier New' , Courier, monospace;
2327 color : # ececec ;
2428 background-color : # 30475e ;
2529 border : 1px solid # 222831 ;
2630 border-radius : 2px ;
27- padding : 17 px 13 px 10px
31+ padding : 19 px 17 px 10px
2832 }
2933 </ style >
3034 < script src ='hollowRhombus.js '> </ script >
35+ < script >
36+ const draw = ( input , output ) => {
37+ const shape = generateCanvas (
38+ { width : input . value , height : input . value } ,
39+ { hollow : ' ' , solid : '*' }
40+ )
41+ output . innerHTML = shape
42+ }
43+ </ script >
3144</ head >
3245
3346< body >
34- < pre id ='main '> </ pre >
47+ < main >
48+ < form id ='input '>
49+ < input type ='range ' name ='controller ' id ='controller ' value ='9 ' min ='1 ' max ='19 ' step ='2 '>
50+ </ form >
51+ < pre id ='console '> </ pre >
52+ </ main >
3553</ body >
3654< script >
37- const shape = generateCanvas (
38- { width : 9 , height : 9 } ,
39- { hollow : ' ' , solid : '*' }
40- )
41- document . querySelector ( '#main' ) . innerHTML = shape
55+ const input = document . querySelector ( '#controller' )
56+ const output = document . querySelector ( '#console' )
57+ draw ( input , output )
58+ input . addEventListener (
59+ 'change' ,
60+ e => draw ( e . target , output )
61+ )
4262</ script >
4363
4464</ html >
You can’t perform that action at this time.
0 commit comments