Schrift zufälliger machen
This commit is contained in:
@@ -174,15 +174,15 @@ function layoutTextToPaths({
|
|||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
let x = startX;
|
let x = startX;
|
||||||
let drift = 0;
|
let drift = 0;
|
||||||
const lineSlope = (Math.random() - 0.5) * 0.012; // ±2.4px über 400px Zeilenbreite
|
const lineSlope = (Math.random() - 0.5) * 0.01; // ±4px über 400px Zeilenbreite (~0.6°)
|
||||||
|
|
||||||
for (let i = 0; i < line.length; i++) {
|
for (let i = 0; i < line.length; i++) {
|
||||||
const ch = line[i];
|
const ch = line[i];
|
||||||
const glyph = glyphs[ch];
|
const glyph = glyphs[ch];
|
||||||
|
|
||||||
if (!glyph) {
|
if (!glyph) {
|
||||||
// Leerzeichen mit festem Abstand
|
// Leerzeichen mit leicht variierender Breite
|
||||||
const spacePx = fontSizePx * 0.4;
|
const spacePx = fontSizePx * 0.4 * (1 + (Math.random() - 0.5) * 0.08);
|
||||||
x += spacePx;
|
x += spacePx;
|
||||||
drift += (Math.random() - 0.5) * 0.3;
|
drift += (Math.random() - 0.5) * 0.3;
|
||||||
drift = Math.max(-3, Math.min(3, drift));
|
drift = Math.max(-3, Math.min(3, drift));
|
||||||
@@ -198,11 +198,13 @@ function layoutTextToPaths({
|
|||||||
|
|
||||||
const charY = baselineY + yJitter + drift + lineSlope * (x - startX);
|
const charY = baselineY + yJitter + drift + lineSlope * (x - startX);
|
||||||
|
|
||||||
const angleDeg = (Math.random() - 0.5) * 3;
|
const charScale = scale;
|
||||||
|
|
||||||
|
const angleDeg = 5 + (Math.random() - 0.5) * 2; // 4–6° Neigung nach rechts
|
||||||
const pivotX = x + advPx / 2;
|
const pivotX = x + advPx / 2;
|
||||||
const pivotY = charY - fontSizePx * 0.3;
|
const pivotY = charY - fontSizePx * 0.3;
|
||||||
|
|
||||||
const transform = `rotate(${angleDeg.toFixed(3)},${pivotX.toFixed(1)},${pivotY.toFixed(1)}) matrix(${scale},0,0,${-scale},${x},${charY})`;
|
const transform = `rotate(${angleDeg.toFixed(3)},${pivotX.toFixed(1)},${pivotY.toFixed(1)}) matrix(${charScale},0,0,${-charScale},${x},${charY})`;
|
||||||
|
|
||||||
resultPaths.push({ d, transform });
|
resultPaths.push({ d, transform });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user