-
Notifications
You must be signed in to change notification settings - Fork 3
/
DogeScript 2048.djs
96 lines (82 loc) · 2.74 KB
/
DogeScript 2048.djs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
so ../lib/node-canvas as Canvas
so fs
very Image is Canvas.Image;
very font is '24px ComicSansMS';
such woof much path words callbark
such bark much err data
rly err not null
plz callbark with err null
wow
rly err is null
very img is new Image
img.src is data;
very w is img.width
very h is img.height
very canv is new Canvas with w h
very context is plz canv.getContext with '2d'
context.textDrawingMode is 'glyph';
context.font is font;
plz context.drawImage with img 0 0 w h 0 0 w h
very bounds is new Array with 0
very length is words.length + 2
much very i as 0 next i lesser length next i more 1
very word is words[i]
rly word not undefined
very prefix is plz rollword
word is prefix + ' ' + word
wow
rly word is undefined
word is 'wow';
wow
very bound is plz wordbound with word context
plz bounds.push with bound
very x is plz rollposition with 1 w
very y is plz rollposition with 1 h
very color is plz rollcolor
context.strokeStyle is color
plz context.strokeText with word x y
wow
very comp is plz path.split with '/'
very pos is comp.length - 1
very file is comp[pos]
very outpath is __dirname + '/../images/' + file
very out is plz fs.createWriteStream with outpath
very stream is plz canv.createJPEGStream with {bufsize: 2048, quality: 80}
plz stream.pipe with out
plz stream.on with 'end' finish
such finish
plz callbark with null file
wow
wow
wow
plz fs.readFile with path bark
wow
such wordbound much word context
very measure is plz context.measureText with word
very bound is {
'height': measure.height,
'width': measure.width
}
wow bound
such rollposition much min max
very random is plz Math.random
random is random * max
random is random + min
random is plz Math.floor with random
wow random
such rollcolor
very random is plz Math.random
random is random * 16777215
very hexnum is plz Math.floor with random
very hexstr is plz hexnum.toString with 16
very hex is '#' + hexstr
wow hex
such rollword
very words is new Array with 'wow' 'such' 'so' 'much' 'very'
very num is plz rollposition with 0 4
very word is words[num];
wow word
very dogeme is {
'woof': woof
}
module.exports is dogeme