-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
407 lines (376 loc) · 14.8 KB
/
Copy pathindex.html
File metadata and controls
407 lines (376 loc) · 14.8 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CNSH 字元编辑器 · 人人平等版</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
.header h1 {
font-size: 36px;
margin-bottom: 10px;
}
.header p {
font-size: 18px;
opacity: 0.9;
}
.main {
display: grid;
grid-template-columns: 350px 1fr 400px;
gap: 20px;
padding: 20px;
}
.panel {
background: #f8f9fa;
border-radius: 10px;
padding: 20px;
}
.panel h2 {
font-size: 20px;
margin-bottom: 15px;
color: #333;
border-bottom: 3px solid #667eea;
padding-bottom: 10px;
}
.control-group {
margin-bottom: 20px;
}
.control-group label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #555;
}
.control-group input, .control-group select {
width: 100%;
padding: 10px;
border: 2px solid #ddd;
border-radius: 5px;
font-size: 14px;
}
.control-group input:focus, .control-group select:focus {
outline: none;
border-color: #667eea;
}
button {
width: 100%;
padding: 12px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
margin-bottom: 10px;
transition: transform 0.2s;
}
button:hover {
transform: translateY(-2px);
}
#canvas {
width: 100%;
height: 600px;
background: white;
border: 3px solid #667eea;
border-radius: 10px;
cursor: crosshair;
}
.feature-list {
list-style: none;
}
.feature-list li {
padding: 10px;
margin-bottom: 5px;
background: white;
border-radius: 5px;
display: flex;
align-items: center;
}
.feature-list li::before {
content: "✓";
color: #667eea;
font-weight: bold;
margin-right: 10px;
}
.info {
background: #e3f2fd;
padding: 15px;
border-radius: 8px;
margin-bottom: 15px;
font-size: 14px;
line-height: 1.6;
}
.dna-tag {
background: #fff3cd;
padding: 8px 12px;
border-radius: 5px;
font-size: 12px;
font-family: monospace;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🐉 CNSH 字元编辑器</h1>
<p>人人平等 · 技术普惠 · 让每个人都能创作自己的字元</p>
<p style="font-size:14px; margin-top:10px; opacity:0.8">
#ZHUGEXIN⚡️ | UID9622 龙魂体系 | 无西方术语 | 完全自主
</p>
</div>
<div class="main">
<!-- 左侧控制面板 -->
<div class="panel">
<h2>📝 创作工具</h2>
<div class="info">
这是一个完全自主的字元编辑器,不依赖任何西方字体标准。
你可以用鼠标画笔画,调整参数,创作独特的字元。
</div>
<div class="control-group">
<label>字元名称</label>
<input type="text" id="字元名称" placeholder="例如:龙、魂、中、华">
</div>
<div class="control-group">
<label>笔画力度(粗细)</label>
<input type="range" id="力度" min="8" max="30" value="18">
<span id="力度值">18</span>
</div>
<div class="control-group">
<label>侵蚀强度(风化感)</label>
<input type="range" id="侵蚀" min="0" max="100" value="20">
<span id="侵蚀值">0.20</span>
</div>
<div class="control-group">
<label>纹理类型</label>
<select id="纹理">
<option value="光滑">光滑</option>
<option value="粗糙">粗糙</option>
<option value="石刻">石刻</option>
</select>
</div>
<div class="control-group">
<label>墨色浓度</label>
<input type="range" id="墨色" min="40" max="100" value="80">
<span id="墨色值">0.80</span>
</div>
<button onclick="开始新笔画()">➕ 开始新笔画</button>
<button onclick="撤销()">↶ 撤销上一步</button>
<button onclick="清空画布()">🗑️ 清空画布</button>
<button onclick="保存作品()">💾 保存作品</button>
<button onclick="导出SVG()">📥 导出 SVG</button>
<div class="dna-tag">
DNA追溯码:<br>
#ZHUGEXIN⚡️-CNSH-USER-<span id="用户ID">0001</span>
</div>
</div>
<!-- 中间画布 -->
<div class="panel">
<h2>🎨 创作画布(用鼠标绘制笔画)</h2>
<canvas id="canvas" width="600" height="600"></canvas>
<p style="margin-top:10px; font-size:14px; color:#666;">
提示:按住鼠标左键拖动即可绘制笔画
</p>
</div>
<!-- 右侧信息面板 -->
<div class="panel">
<h2>ℹ️ 系统信息</h2>
<h3 style="margin-top:20px; color:#667eea;">✨ 15 层渲染特性</h3>
<ul class="feature-list">
<li>三次贝塞尔曲线</li>
<li>笔画力度调节</li>
<li>棱角断锋效果</li>
<li>节奏停顿表达</li>
<li>层级遮挡关系</li>
<li>笔画断续风格</li>
<li>侵蚀风化质感</li>
<li>石刻纹理效果</li>
<li>墨色浓淡渐变</li>
<li>字元重心调整</li>
<li>多字组合排版</li>
<li>笔画阴影立体</li>
</ul>
<h3 style="margin-top:20px; color:#667eea;">🌍 普惠理念</h3>
<div class="info">
<p><strong>人人平等:</strong>无需编程知识,每个人都能创作</p>
<p><strong>完全免费:</strong>无付费墙,无会员限制</p>
<p><strong>技术自主:</strong>不依赖西方字体标准</p>
<p><strong>文化传承:</strong>数字甲骨文,传承华夏文明</p>
</div>
<h3 style="margin-top:20px; color:#667eea;">📊 当前作品信息</h3>
<div class="info">
<p>笔画数量: <strong id="笔画数">0</strong></p>
<p>点数统计: <strong id="点数">0</strong></p>
<p>创作时间: <strong id="创作时间">--</strong></p>
</div>
</div>
</div>
</div>
<script>
// 画布初始化
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let 正在绘制 = false;
let 当前笔画 = [];
let 所有笔画 = [];
let 开始时间 = new Date();
// 更新显示值
document.getElementById('力度').oninput = function() {
document.getElementById('力度值').textContent = this.value;
};
document.getElementById('侵蚀').oninput = function() {
document.getElementById('侵蚀值').textContent = (this.value / 100).toFixed(2);
};
document.getElementById('墨色').oninput = function() {
document.getElementById('墨色值').textContent = (this.value / 100).toFixed(2);
};
// 鼠标绘制
canvas.onmousedown = function(e) {
正在绘制 = true;
当前笔画 = [];
const rect = canvas.getBoundingClientRect();
当前笔画.push({
x: e.clientX - rect.left,
y: e.clientY - rect.top
});
};
canvas.onmousemove = function(e) {
if (!正在绘制) return;
const rect = canvas.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
当前笔画.push({x, y});
// 实时绘制
重绘画布();
ctx.strokeStyle = 'rgba(0,0,0,' + (document.getElementById('墨色').value / 100) + ')';
ctx.lineWidth = document.getElementById('力度').value;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.beginPath();
ctx.moveTo(当前笔画[0].x, 当前笔画[0].y);
for (let i = 1; i < 当前笔画.length; i++) {
ctx.lineTo(当前笔画[i].x, 当前笔画[i].y);
}
ctx.stroke();
};
canvas.onmouseup = function() {
if (正在绘制 && 当前笔画.length > 1) {
所有笔画.push({
点: 当前笔画,
力度: document.getElementById('力度').value,
侵蚀: document.getElementById('侵蚀').value / 100,
纹理: document.getElementById('纹理').value,
墨色: document.getElementById('墨色').value / 100
});
更新统计();
}
正在绘制 = false;
当前笔画 = [];
};
function 重绘画布() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
所有笔画.forEach(笔画 => {
ctx.strokeStyle = 'rgba(0,0,0,' + 笔画.墨色 + ')';
ctx.lineWidth = 笔画.力度;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.beginPath();
ctx.moveTo(笔画.点[0].x, 笔画.点[0].y);
for (let i = 1; i < 笔画.点.length; i++) {
ctx.lineTo(笔画.点[i].x, 笔画.点[i].y);
}
ctx.stroke();
});
}
function 开始新笔画() {
alert('✅ 准备就绪!请在画布上拖动鼠标绘制笔画');
}
function 撤销() {
if (所有笔画.length > 0) {
所有笔画.pop();
重绘画布();
更新统计();
}
}
function 清空画布() {
if (confirm('确定要清空画布吗?')) {
所有笔画 = [];
ctx.clearRect(0, 0, canvas.width, canvas.height);
更新统计();
}
}
function 保存作品() {
const 字元名称 = document.getElementById('字元名称').value || '未命名';
const 数据 = {
来源标注: "#ZHUGEXIN⚡️ | UID9622 龙魂体系",
工程名称: "CNSH 数字甲骨文字元立碑工程 · 用户创作",
创作者: "普通用户",
字元名称: 字元名称,
创作时间: new Date().toLocaleString('zh-CN'),
笔画数据: 所有笔画
};
const blob = new Blob([JSON.stringify(数据, null, 2)], {type: 'application/json'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 字元名称 + '_CNSH.json';
a.click();
alert('✅ 作品已保存!文件名:' + 字元名称 + '_CNSH.json');
}
function 导出SVG() {
// 简化版 SVG 导出
let svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600">\n';
所有笔画.forEach((笔画, i) => {
const 路径 = 笔画.点.map((p, j) =>
(j === 0 ? 'M' : 'L') + ' ' + p.x + ' ' + p.y
).join(' ');
svg += `<path d="${路径}" fill="none" stroke="black" `;
svg += `stroke-width="${笔画.力度}" `;
svg += `opacity="${笔画.墨色}" />\n`;
});
svg += '</svg>';
const blob = new Blob([svg], {type: 'image/svg+xml'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = (document.getElementById('字元名称').value || '字元') + '.svg';
a.click();
alert('✅ SVG 已导出!');
}
function 更新统计() {
document.getElementById('笔画数').textContent = 所有笔画.length;
let 总点数 = 0;
所有笔画.forEach(笔画 => 总点数 += 笔画.点.length);
document.getElementById('点数').textContent = 总点数;
const 耗时 = Math.floor((new Date() - 开始时间) / 1000);
const 分钟 = Math.floor(耗时 / 60);
const 秒 = 耗时 % 60;
document.getElementById('创作时间').textContent = 分钟 + '分' + 秒 + '秒';
}
// 生成随机用户ID
document.getElementById('用户ID').textContent =
Math.floor(Math.random() * 10000).toString().padStart(4, '0');
</script>
</body>
</html>