1
0

pattern: fix

This commit is contained in:
Philip Wagner
2024-10-27 13:47:13 +01:00
parent 092f91c79e
commit 24f7ebdeb1

View File

@@ -9,10 +9,10 @@
<script> <script>
const NORMAL_SMALL = 29 const NORMAL_SMALL = 29
const NORMAL_BIG = 49 const NORMAL_BIG = 49.5
const MOBILE_SMALL = 10 const MOBILE_SMALL = 8
const MOBILE_BIG = 19.5 const MOBILE_BIG = 14
let small = NORMAL_SMALL let small = NORMAL_SMALL
let big = NORMAL_BIG let big = NORMAL_BIG
@@ -107,22 +107,24 @@ function bg(colorIndex, canvas, ctx, randomColors) {
} }
function font(colorIndex, canvas, ctx) { function font(colorIndex, canvas, ctx) {
const kerningNormal = { R: -12, E: -27, C: -13, A: -13, P: -13, I: -13, T: -13, U: -13, L: -13, N: -13, G: -13 }
let kerningWide
if (IS_DESKTOP) { if (IS_DESKTOP) {
ctx.font = '195px Kobata' ctx.font = '195px Kobata'
kerningWide = { Q: 178.7, U: 178.7, E: 178.7 }
} else { } else {
ctx.font = '74px Kobata' ctx.font = '56px Kobata'
kerningWide = { Q: 138, U: 138, E: 138 }
} }
let kerningNormal = { R: -12, E: -27, C: -13, A: -13, P: -13, I: -13, T: -13, U: -13, L: -13, N: -13, G: -13 }
let kerningWide = { Q: 178.7, U: 178.7, E: 178.7 }
const patterns = [ const patterns = [
[0], [0],
[0, 1] [0, 1]
] ]
function word(str, y, colorIndex, pattern, kerning) { function word(str, y, colorIndex, pattern, kerning) {
let x = -10 let x = IS_DESKTOP ? -10 : -3
for (var i = 0; i < str.length; i++) { for (var i = 0; i < str.length; i++) {
const t = colorIndex + pattern[i % pattern.length] const t = colorIndex + pattern[i % pattern.length]
ctx.fillStyle = colors[t % colors.length] ctx.fillStyle = colors[t % colors.length]