Skip to content

Commit

Permalink
numberz
Browse files Browse the repository at this point in the history
  • Loading branch information
skuqre committed Dec 6, 2023
1 parent adda7b4 commit 46d2ddf
Show file tree
Hide file tree
Showing 36 changed files with 116 additions and 10 deletions.
Binary file modified public/images/nikkefont/!.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/$.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/&.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/,.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/..png
Binary file not shown.
Binary file added public/images/nikkefont/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nikkefont/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/i.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/j.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/n.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/q.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/nikkefont/t.png
Binary file modified public/images/nikkefont/u.png
Binary file modified public/images/nikkefont/y.png
Binary file modified public/images/nikkefont/z.png
2 changes: 1 addition & 1 deletion src/components/DialogueInput.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/>
</td>
<td>
<button id="generate">Generate</button>
<button id="generate">Refresh</button>
</td>
<td rowspan="2" style="vertical-align: top;">
<input
Expand Down
22 changes: 18 additions & 4 deletions src/components/InputFields.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
/>
</td>
<td>
<button id="generate">Generate</button>
<button id="generate">Refresh</button>
</td>
<td rowspan="2">
<td>
<input
type="color"
id="color"
Expand All @@ -43,6 +43,14 @@
<option value="10">10%</option>
</select>
</td>
<td>
<input
type="color"
id="color2"
autocomplete="off"
value="#ffffff"
/>
</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -102,14 +110,20 @@
outline: revert;
}

input#color {
input#color, input#color2 {
width: 40px;
height: 90px;
height: 40px;

margin: 0;
margin-right: 4px;
padding: 0px 2px;
}

#color2 {
position: relative;
top: -2px;
}

button#generate {
width: 90px;
height: 40px;
Expand Down
1 change: 1 addition & 0 deletions src/layouts/md.astro
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const {frontmatter} = Astro.props;

li {
text-align: left !important;
line-height: 24px !important;
}

@media only screen and (max-width: 1100px) {
Expand Down
18 changes: 18 additions & 0 deletions src/pages/update-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ embeddesc: the update log
---
<br>

## Numbers `Dec 6, 2023`

- added Numbers to the logo generator
- added the ability to change seperate colors in the logo generator
- reduced file size of glyphs for the logo generator
- **BREAKING** default site behavior changed, outputs now change when you're typing, no more clicking "generate" when creating your images
- button has been renamed to "Refresh" instead of "Generate"
- old behavior can be toggled with by right clicking the button
- **BREAKING** behavior on Logo Generator changed
- the big font's (one for the "NIKKE" text) way of being positioned vertically has been changed a bit:
letters will now be centered vertically with the tallest letter in the word, there should be a small
visual difference but everything would be fine.

<br>

---
<br>

## More motion `Dec 5, 2023`

- added `jump` motion effect
Expand Down
22 changes: 22 additions & 0 deletions src/scripts/dialogue.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,28 @@ document.querySelectorAll('#generate')[0].addEventListener('click', () => {
generateText(text, subtext);
});

let autogen = true;

document.getElementById('generate').oncontextmenu = (e) => {
e.preventDefault();

autogen = !autogen;

document.getElementById('generate').innerHTML = autogen ? 'Refresh' : 'Generate';
document.getElementById('generate').disabled = autogen;
}

function autogent() {
if (autogen) {
var text = document.getElementById('character').value;
var subtext = document.getElementById('dialog').value;
generateText(text, subtext)
}
}

document.getElementById('character').oninput = autogent;
document.getElementById('dialog').oninput = autogent;

document.querySelectorAll('#clear-char')[0].addEventListener('click', () => {
char.src = '/nikke-font-generator/images/transparent.png';
char.onload = function (e) {
Expand Down
61 changes: 56 additions & 5 deletions src/scripts/logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { hexToCSSFilter } from 'hex-to-css-filter';
const canvas = document.getElementById("font-canvas");
const ctx = canvas.getContext("2d");
let loaded = {}
let heights = {}

let logoglyphs = 'abcdefghijklmnopqrstuvwxyz,.!$&'
let logoglyphs = 'abcdefghijklmnopqrstuvwxyz,.!$&0123456789'
for (let i = 0; i < logoglyphs.length; i++) {
let img = new Image();
img.src = `../nikke-font-generator/images/nikkefont/${logoglyphs.split('')[i]}.png`;
img.onload = function (e) {
loaded[logoglyphs.split('')[i]] = img;
heights[logoglyphs.split('')[i]] = img.height;
}
}

Expand All @@ -31,7 +33,19 @@ document.querySelectorAll('#generate')[0].addEventListener('click', () => {
generateLogoText(text, subtext);
});

let autogen = true;

document.getElementById('generate').oncontextmenu = (e) => {
e.preventDefault();

autogen = !autogen;

document.getElementById('generate').innerHTML = autogen ? 'Refresh' : 'Generate';
document.getElementById('generate').disabled = autogen;
}

let color = '#ffffff';
let color2 = '#ffffff';
let size = 100;

document.querySelectorAll('#color')[0].addEventListener('change', () => {
Expand All @@ -41,17 +55,38 @@ document.querySelectorAll('#color')[0].addEventListener('change', () => {
generateLogoText(text, subtext)
});

document.querySelectorAll('#color2')[0].addEventListener('change', () => {
var text = document.getElementById('text').value;
var subtext = document.getElementById('subtext').value;
color2 = document.getElementById('color2').value;
generateLogoText(text, subtext)
});

document.querySelectorAll('#size')[0].addEventListener('change', () => {
var text = document.getElementById('text').value;
var subtext = document.getElementById('subtext').value;
size = parseInt(document.getElementById('size').value);
generateLogoText(text, subtext)
});

function autogent() {
if (autogen) {
var text = document.getElementById('text').value;
var subtext = document.getElementById('subtext').value;
generateLogoText(text, subtext)
}
}

document.getElementById('text').oninput = autogent;
document.getElementById('subtext').oninput = autogent;

setTimeout(() => {
generateLogoText('BARELY', 'ACCURATE NIKKE FONT GENERATOR')
}, 1000, 1);

const canvasTemp = document.createElement("canvas");
const ctxTemp = canvasTemp.getContext("2d");

let curx = 0;
let cury = 0;
function generateLogoText(text, subtext) {
Expand All @@ -78,22 +113,38 @@ function generateLogoText(text, subtext) {
}
canvas.height = (cury + 100) * size / 100;

ctx.filter = 'brightness(0) ' + hexToCSSFilter(color)['filter'].replace(';', '');
// ctx.filter = 'brightness(0) ' + hexToCSSFilter(color)['filter'].replace(';', '');
ctx.scale(size / 100, size / 100);

curx = xoffset;
let tallest = 0;
for (let i = 0; i < lower.length; i++) {
if (lower.split('')[i] == ' ') {
curx += 64;
continue;
}
ctx.drawImage(loaded[lower.split('')[i]], curx > 0 ? curx : 0, 0);
curx += loaded[lower.split('')[i]].width + 32;

let image = loaded[lower.split('')[i]];

if (image.height > tallest) {
tallest = image.height
}

canvasTemp.width = image.width;
canvasTemp.height = image.height;
ctxTemp.fillStyle = color;
ctxTemp.fillRect(0, 0, image.width, image.height);
ctxTemp.globalCompositeOperation = "destination-in";
ctxTemp.drawImage(image, 0, 0);
ctxTemp.globalCompositeOperation = "source-over";

ctx.drawImage(canvasTemp, curx > 0 ? curx : 0, (tallest - image.height) / 2);
curx += image.width + 32;
}

ctx.font = "48px Butch";
ctx.letterSpacing = "32px";
ctx.fillStyle = "white";
ctx.fillStyle = color2;
ctx.textAlign = "center";
ctx.fillText(subtext.trim(), Math.abs(textwidth - canvas.width) <= 5 ? textwidth / 2 + 16 : curx / 2, cury + 90);
}

0 comments on commit 46d2ddf

Please sign in to comment.