This file contains hidden or 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
/** | |
* usage | |
* | |
* const worker = new FunctionWorker(() => { | |
* self.onmessage = (e) => { | |
* postMessage(e); | |
* } | |
* }); | |
* | |
*/ |
This file contains hidden or 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
#!/bin/sh | |
set -e | |
PYTHON_MAJOR_VERSION=`python -c 'import sys; print(sys.version_info.major)'` | |
ABSPATH=$(cd "$(dirname "$0")"; pwd -P) | |
if [ "$PYTHON_MAJOR_VERSION" = "3" ]; then | |
cd $ABSPATH | |
python -m http.server 8000 |
This file contains hidden or 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
using System; | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Rendering.Universal.ShaderGUI; | |
class CustomLitShader : BaseShaderGUI | |
{ | |
// Properties | |
private LitGUI.LitProperties litProperties; |
This file contains hidden or 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
// ------------------------------------------------------------------------------ | |
// | |
// ディレクトリ以下の画像、もしくは単一ファイルを一括圧縮するバッチスクリプト | |
// | |
// usage: | |
// $ node minify-images.js [src_path] | |
// | |
// ------------------------------------------------------------------------------ | |
const fs = require("fs"); |
This file contains hidden or 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
type Func = (time: number, deltaTime?: number) => void; | |
/** | |
* rafを管理するクラス。実質、singletonとして使う | |
* | |
* @class Ticker | |
*/ | |
class Ticker { | |
private funcs: Func[]; |
This file contains hidden or 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
/** | |
* 強制的にdomのreflowを発火させる | |
* | |
* @export | |
* @param {HTMLElement} dom | |
*/ | |
export function reflow(dom: HTMLElement) { | |
// eslint-disable-next-line no-void | |
void dom.offsetWidth; | |
} |
This file contains hidden or 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
/* eslint-disable no-plusplus */ | |
// ref: | |
// https://gist.github.com/gre/1650294#gistcomment-3141432 | |
// no easing, no acceleration | |
export const linear = (t: number) => { | |
return t; | |
}; | |
// accelerating from zero velocity | |
export const easeInQuad = (t: number) => { |
This file contains hidden or 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
import { Howl, HowlOptions } from "howler"; | |
import { map } from "lodash"; | |
const caches = new Map<string | string[], Howl>(); | |
/** | |
* howlオブジェクトを生成してキャッシュする。。キャッシュの中にあったらキャッシュを返す | |
* | |
* @param {HowlOptions} options | |
* @returns {(Howl | null)} |
This file contains hidden or 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
/** | |
* 画像をリサイズする関数 | |
* | |
* @export | |
* @param {string} imageSrc | |
* @param {(number | null)} [resizeWidth] | |
* @param {(number | null)} [resizeHeight] | |
* @returns {Promise<string>} | |
*/ | |
export default function resizeImage( |
This file contains hidden or 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
/** | |
* srcから縦横幅を取得する | |
* | |
* @export | |
* @param {string} src | |
* @returns {Promise<{ width: number; height: number }>} | |
*/ | |
export default async function getImageSize( | |
src: string | |
): Promise<{ width: number; height: number }> { |