-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-lock-screen.html
More file actions
89 lines (78 loc) · 2.5 KB
/
Copy pathcreate-lock-screen.html
File metadata and controls
89 lines (78 loc) · 2.5 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text with Padding on Canvas</title>
<style>
body {
background-color: #000;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
margin: 0;
}
canvas {
display: block;
}
</style>
</head>
<body>
<canvas id="myCanvas"></canvas>
<script>
setTimeout(() => {
const canvas = document.getElementById('myCanvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const ctx = canvas.getContext('2d');
// Define the text with syllables
const text = `Oh-ha-you go-zai-ma-su Good morning
Kon-ni-chi-wa Good afternoon / Hello
Kon-ban-wa Good evening
A-ri-ga-tou go-zai-ma-su Thank you
Su-mi-ma-sen Excuse me
Ku-da-sai Please
Hai / I-i-e Yes / No
I-ku-ra de-su ka? How much?
To-i-re wa do-ko de-su ka? Where is the bathroom?
Ei-go o ha-na-se-ma-su ka? Do you speak English?
I-ra-sshai-ma-se Welcome
I-chi 1
Ni 2
San 3
Shi / Yon 4
Go 5
Ko-re This
Ku-re-ji-tto kaa-do Credit card`;
// Set padding/margin
const padding = 40;
const textX = padding * 2;
const fontSize = 16;
const lineHeight = 20;
const textY = padding * 4 + fontSize; // Adding initial padding for top margin
// Inverted color scheme
ctx.fillStyle = "#000"; // Background color (black)
ctx.fillRect(0, 0, canvas.width, canvas.height);
console.log(canvas.width, canvas.height);
ctx.font = `${fontSize}px Arial`;
// ctx.font = `bold ${fontSize}px Arial`;
ctx.fillStyle = "#FFF"; // Text color (white)
// // rotate the lines horizontally but keep the text in the screen
// ctx.save();
// ctx.translate(canvas.width / 2, canvas.height / 2);
// ctx.rotate(Math.PI / 2);
// ctx.translate(-canvas.width / 2, -canvas.height / 2);
// Split text into lines and draw each line with padding
const lines = text.split('\n');
lines.forEach((line, index) => {
ctx.fillText(line, textX, textY + index * lineHeight);
});
// You can also add the functionality to save this canvas as an image if needed:
// const img = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
// window.location.href = img; // This will download the image
});
</script>
</body>
</html>