-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,051 additions
and
930 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,4 @@ jobs: | |
steps: | ||
- name: Deploy | ||
id: deployment | ||
uses: actions/deploy-pages@v2 | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"cSpell.words": [ | ||
"browserconfig", | ||
"controlslist", | ||
"lightskyblue", | ||
"MaruMinya", | ||
"mimoz", | ||
"nodownload", | ||
"ondataavailable" | ||
] | ||
} | ||
"cSpell.words": [ | ||
"browserconfig", | ||
"controlslist", | ||
"lightskyblue", | ||
"MaruMinya", | ||
"mimoz", | ||
"nodownload", | ||
"ondataavailable" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { browser } from "$app/environment"; | ||
import { init, register } from "svelte-i18n"; | ||
import { browser } from '$app/environment'; | ||
import { init, register } from 'svelte-i18n'; | ||
|
||
export const defaultLocale = "ja"; | ||
export const defaultLocale = 'ja'; | ||
export const languagesList = [ | ||
{ lang: "ja", name: "日本語" }, | ||
{ lang: "en", name: "English" } | ||
{ lang: 'ja', name: '日本語' }, | ||
{ lang: 'en', name: 'English' } | ||
]; | ||
|
||
register("ja", () => import("./locales/ja.json")); | ||
register("en", () => import("./locales/en.json")); | ||
register('ja', () => import('./locales/ja.json')); | ||
register('en', () => import('./locales/en.json')); | ||
|
||
init({ | ||
fallbackLocale: defaultLocale, | ||
initialLocale: browser ? window.navigator.language : defaultLocale, | ||
initialLocale: browser ? window.navigator.language : defaultLocale | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
{ | ||
"usage": "Usage", | ||
"usage_1": "Upload pixel art (png, jpg...)", | ||
"usage_2": "Upload music (wav, mp3...)", | ||
"usage_3": "Play music!", | ||
"supported_version": "Supported Versions", | ||
"upload_image": "Upload image file", | ||
"upload_image_error": "Image is too large. Please pixelate. (Images of 256px x 256px or less can be specified.)", | ||
"image_info": "Image size ( width: {width}px, height: {height}px )", | ||
"is_pixelation": "Do you want to pixelate?", | ||
"do_pixelation": " yes", | ||
"do_not_pixelation": " no", | ||
"upload_audio": "Upload audio file.", | ||
"parameters_setting": "⚙️ Setting", | ||
"parameters_window_size": "window size: ", | ||
"parameters_custom": "custom", | ||
"parameters_width": "width: ", | ||
"parameters_height": "height: ", | ||
"parameters_note": "NOTE: The value should be n times the number of pixels in the image to display it nicely", | ||
"parameters_background": "background: ", | ||
"parameters_fft_size": "FFT size: ", | ||
"parameters_spectrum_type": "spectrum type: ", | ||
"parameters_sensitivity": "sensitivity: ", | ||
"parameters_grid_size": "grid size: ", | ||
"parameters_smooth": "smooth: ", | ||
"change_full_screen": "full screen mode", | ||
"disabled_full_screen": "Full screen mode is not available", | ||
"generate_video": "Generate video", | ||
"generate_video_message": "Generating video... Please keep the screen open.", | ||
"generate_video_error": "Upload your image and audio.", | ||
"ffmpeg_error": "error: ffmpeg is not available.", | ||
"download_video": "Download video" | ||
} | ||
"usage": "Usage", | ||
"usage_1": "Upload pixel art (png, jpg...)", | ||
"usage_2": "Upload music (wav, mp3...)", | ||
"usage_3": "Play music!", | ||
"supported_version": "Supported Versions", | ||
"upload_image": "Upload image file", | ||
"upload_image_error": "Image is too large. Please pixelate. (Images of 256px x 256px or less can be specified.)", | ||
"image_info": "Image size ( width: {width}px, height: {height}px )", | ||
"is_pixelation": "Do you want to pixelate?", | ||
"do_pixelation": " yes", | ||
"do_not_pixelation": " no", | ||
"upload_audio": "Upload audio file.", | ||
"parameters_setting": "⚙️ Setting", | ||
"parameters_window_size": "window size: ", | ||
"parameters_custom": "custom", | ||
"parameters_width": "width: ", | ||
"parameters_height": "height: ", | ||
"parameters_note": "NOTE: The value should be n times the number of pixels in the image to display it nicely", | ||
"parameters_background": "background: ", | ||
"parameters_fft_size": "FFT size: ", | ||
"parameters_spectrum_type": "spectrum type: ", | ||
"parameters_sensitivity": "sensitivity: ", | ||
"parameters_grid_size": "grid size: ", | ||
"parameters_smooth": "smooth: ", | ||
"change_full_screen": "full screen mode", | ||
"disabled_full_screen": "Full screen mode is not available", | ||
"generate_video": "Generate video", | ||
"generate_video_message": "Generating video... Please keep the screen open.", | ||
"generate_video_error": "Upload your image and audio.", | ||
"ffmpeg_error": "error: ffmpeg is not available.", | ||
"download_video": "Download video" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
{ | ||
"usage": "使い方", | ||
"usage_1": "ドット絵をアップ (png, jpg...)", | ||
"usage_2": "音声をアップ (wav, mp3...)", | ||
"usage_3": "音声を再生!", | ||
"supported_version": "サポートされているバージョン", | ||
"upload_image": "画像をアップロード", | ||
"upload_image_error": "画像が大き過ぎます。ドット化してください。(256px × 256px以下の画像が指定可能です。)", | ||
"image_info": "画像サイズ(幅: {width}px, 高さ: {height}px)", | ||
"is_pixelation": "ドット化しますか?", | ||
"do_pixelation": "する", | ||
"do_not_pixelation": "しない", | ||
"upload_audio": "音声をアップロード", | ||
"parameters_setting": "⚙️ 設定", | ||
"parameters_window_size": "画面サイズ: ", | ||
"parameters_custom": "カスタム", | ||
"parameters_width": "幅: ", | ||
"parameters_height": "高さ: ", | ||
"parameters_note": "※ ドット絵のピクセル数×n倍の値にすると、きれいに表示できます", | ||
"parameters_background": "背景色: ", | ||
"parameters_fft_size": "FFTサイズ: ", | ||
"parameters_spectrum_type": "タイプ: ", | ||
"parameters_sensitivity": "感度: ", | ||
"parameters_grid_size": "グリッドサイズ: ", | ||
"parameters_smooth": "スムーズ: ", | ||
"change_full_screen": "全画面モードに切り替える", | ||
"disabled_full_screen": "全画面モードが使用できません", | ||
"generate_video": "動画を作成する", | ||
"generate_video_message": "動画を作成中です... 画面を開いたままにしてください", | ||
"generate_video_error": "画像と音声をアップロードしてください", | ||
"ffmpeg_error": "エラー: ffmpegが使用できません", | ||
"download_video": "動画をダウンロードする" | ||
"usage": "使い方", | ||
"usage_1": "ドット絵をアップ (png, jpg...)", | ||
"usage_2": "音声をアップ (wav, mp3...)", | ||
"usage_3": "音声を再生!", | ||
"supported_version": "サポートされているバージョン", | ||
"upload_image": "画像をアップロード", | ||
"upload_image_error": "画像が大き過ぎます。ドット化してください。(256px × 256px以下の画像が指定可能です。)", | ||
"image_info": "画像サイズ(幅: {width}px, 高さ: {height}px)", | ||
"is_pixelation": "ドット化しますか?", | ||
"do_pixelation": "する", | ||
"do_not_pixelation": "しない", | ||
"upload_audio": "音声をアップロード", | ||
"parameters_setting": "⚙️ 設定", | ||
"parameters_window_size": "画面サイズ: ", | ||
"parameters_custom": "カスタム", | ||
"parameters_width": "幅: ", | ||
"parameters_height": "高さ: ", | ||
"parameters_note": "※ ドット絵のピクセル数×n倍の値にすると、きれいに表示できます", | ||
"parameters_background": "背景色: ", | ||
"parameters_fft_size": "FFTサイズ: ", | ||
"parameters_spectrum_type": "タイプ: ", | ||
"parameters_sensitivity": "感度: ", | ||
"parameters_grid_size": "グリッドサイズ: ", | ||
"parameters_smooth": "スムーズ: ", | ||
"change_full_screen": "全画面モードに切り替える", | ||
"disabled_full_screen": "全画面モードが使用できません", | ||
"generate_video": "動画を作成する", | ||
"generate_video_message": "動画を作成中です... 画面を開いたままにしてください", | ||
"generate_video_error": "画像と音声をアップロードしてください", | ||
"ffmpeg_error": "エラー: ffmpegが使用できません", | ||
"download_video": "動画をダウンロードする" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,62 @@ | ||
export const toBase64 = (file: File) => new Promise<string>((resolve, reject) => { | ||
const reader = new FileReader(); | ||
reader.readAsDataURL(file); | ||
reader.onload = () => resolve(reader.result as string); | ||
reader.onerror = reject; | ||
}); | ||
|
||
export const loadImage = (src: string) => new Promise<HTMLImageElement>((resolve, reject) => { | ||
const img = new Image(); | ||
img.onload = () => resolve(img); | ||
img.onerror = (e) => reject(e); | ||
img.src = src; | ||
}); | ||
export const toBase64 = (file: File) => | ||
new Promise<string>((resolve, reject) => { | ||
const reader = new FileReader(); | ||
reader.readAsDataURL(file); | ||
reader.onload = () => resolve(reader.result as string); | ||
reader.onerror = reject; | ||
}); | ||
|
||
export const loadImage = (src: string) => | ||
new Promise<HTMLImageElement>((resolve, reject) => { | ||
const img = new Image(); | ||
img.onload = () => resolve(img); | ||
img.onerror = (e) => reject(e); | ||
img.src = src; | ||
}); | ||
|
||
export const getRGBAbyImageData = (imageData: ImageData, x: number, y: number, width: number) => { | ||
return [ | ||
imageData.data[(x + y * width) * 4], | ||
imageData.data[(x + y * width) * 4 + 1], | ||
imageData.data[(x + y * width) * 4 + 2], | ||
imageData.data[(x + y * width) * 4 + 3] / 255 | ||
]; | ||
} | ||
return [ | ||
imageData.data[(x + y * width) * 4], | ||
imageData.data[(x + y * width) * 4 + 1], | ||
imageData.data[(x + y * width) * 4 + 2], | ||
imageData.data[(x + y * width) * 4 + 3] / 255 | ||
]; | ||
}; | ||
|
||
// ピクセル化(サンプリング) (pixelSizeの大きさ) | ||
export const executePixelationSampling = (context: CanvasRenderingContext2D, img: HTMLImageElement, pixelSize: number) => { | ||
const newWidth = Math.floor(img.width / pixelSize); | ||
const newHeight = Math.floor(img.height / pixelSize); | ||
|
||
// draw original image | ||
context.canvas.width = img.width; | ||
context.canvas.height = img.height; | ||
context.drawImage(img, 0, 0); | ||
|
||
const imageData = context.getImageData(0, 0, img.width, img.height); | ||
const newImageData = new ImageData(newWidth, newHeight); | ||
|
||
for (let y = 0; y < img.height; y += pixelSize) { | ||
for (let x = 0; x < img.width; x += pixelSize) { | ||
|
||
const red = imageData.data[((img.width * y) + x) * 4]; | ||
const green = imageData.data[((img.width * y) + x) * 4 + 1]; | ||
const blue = imageData.data[((img.width * y) + x) * 4 + 2]; | ||
const alpha = imageData.data[((img.width * y) + x) * 4 + 3]; | ||
|
||
newImageData.data[((newWidth * (y / pixelSize)) + (x / pixelSize)) * 4] = red; | ||
newImageData.data[((newWidth * (y / pixelSize)) + (x / pixelSize)) * 4 + 1] = green; | ||
newImageData.data[((newWidth * (y / pixelSize)) + (x / pixelSize)) * 4 + 2] = blue; | ||
newImageData.data[((newWidth * (y / pixelSize)) + (x / pixelSize)) * 4 + 3] = alpha; | ||
} | ||
} | ||
|
||
context.canvas.width = newWidth; | ||
context.canvas.height = newHeight; | ||
context.putImageData(newImageData, 0, 0); | ||
|
||
return newImageData; | ||
} | ||
export const executePixelationSampling = ( | ||
context: CanvasRenderingContext2D, | ||
img: HTMLImageElement, | ||
pixelSize: number | ||
) => { | ||
const newWidth = Math.floor(img.width / pixelSize); | ||
const newHeight = Math.floor(img.height / pixelSize); | ||
|
||
// draw original image | ||
context.canvas.width = img.width; | ||
context.canvas.height = img.height; | ||
context.drawImage(img, 0, 0); | ||
|
||
const imageData = context.getImageData(0, 0, img.width, img.height); | ||
const newImageData = new ImageData(newWidth, newHeight); | ||
|
||
for (let y = 0; y < img.height; y += pixelSize) { | ||
for (let x = 0; x < img.width; x += pixelSize) { | ||
const red = imageData.data[(img.width * y + x) * 4]; | ||
const green = imageData.data[(img.width * y + x) * 4 + 1]; | ||
const blue = imageData.data[(img.width * y + x) * 4 + 2]; | ||
const alpha = imageData.data[(img.width * y + x) * 4 + 3]; | ||
|
||
newImageData.data[(newWidth * (y / pixelSize) + x / pixelSize) * 4] = red; | ||
newImageData.data[(newWidth * (y / pixelSize) + x / pixelSize) * 4 + 1] = green; | ||
newImageData.data[(newWidth * (y / pixelSize) + x / pixelSize) * 4 + 2] = blue; | ||
newImageData.data[(newWidth * (y / pixelSize) + x / pixelSize) * 4 + 3] = alpha; | ||
} | ||
} | ||
|
||
context.canvas.width = newWidth; | ||
context.canvas.height = newHeight; | ||
context.putImageData(newImageData, 0, 0); | ||
|
||
return newImageData; | ||
}; |
Oops, something went wrong.