@@ -26,6 +26,7 @@ window.addEventListener("load", main, false);
26
26
27
27
function drawCanvas ( canvas , ctx ) {
28
28
const { currentColorIndex, bgColors } = state ;
29
+ ctx . font = "24px monospace" ;
29
30
ctx . fillStyle = `rgba(${ bgColors [ currentColorIndex ] . join ( ", " ) } , 1)` ;
30
31
ctx . fillRect ( 0 , 0 , canvas . width , canvas . height ) ;
31
32
@@ -42,7 +43,7 @@ function resizeCanvas(canvas, ctx) {
42
43
function drawLines ( canvas , ctx ) {
43
44
const { currentColorIndex, txtColors } = state ;
44
45
const margin = canvas . height / 20 ;
45
- const stroke = ( canvas . height * canvas . width ) / 400000 ;
46
+ const stroke = 2 ;
46
47
47
48
ctx . fillStyle = `rgba(${ txtColors [ currentColorIndex ] . join ( ", " ) } , 1)` ;
48
49
@@ -60,13 +61,18 @@ function drawText(canvas, ctx) {
60
61
const margin = canvas . height / 20 ;
61
62
62
63
const year = new Date ( ) . getFullYear ( ) ;
63
- const text = `© ${ year } NEI/AAC ` ;
64
- const size = window . innerWidth < 500 ? 20 : 25 ;
65
- ctx . font = ` ${ size } px Satoshi Bold` ;
64
+ const first = `${ year } ` ;
65
+ const second = `NEI/AAC` ;
66
+
66
67
ctx . textAlign = "start" ;
67
68
ctx . textBaseline = "bottom" ;
68
69
69
- ctx . fillText ( text , margin + margin / 2 , canvas . height - ( 1.5 * margin ) ) ;
70
+ ctx . fillText ( first , margin * 1.5 , canvas . height - margin * 1.5 ) ;
71
+
72
+ ctx . textAlign = "end" ;
73
+ ctx . textBaseline = "top" ;
74
+
75
+ ctx . fillText ( second , canvas . width - margin * 1.5 , margin * 1.5 ) ;
70
76
}
71
77
72
78
async function fadeCanvas ( canvas , ctx ) {
@@ -98,8 +104,8 @@ function main() {
98
104
99
105
const font = new FontFace ( "Satoshi Bold" , "url(./assets/fonts/satoshi-bold.otf)" ) ;
100
106
101
- font . load ( ) . then ( ( loadedFont ) => {
102
- document . fonts . add ( loadedFont ) ;
107
+ font . load ( ) . then ( ( loaded ) => {
108
+ document . fonts . add ( loaded ) ;
103
109
drawCanvas ( canvas , ctx ) ;
104
110
resizeCanvas ( canvas , ctx ) ;
105
111
fadeCanvas ( canvas , ctx ) ;
0 commit comments