この文章は、日経BP社から出版されている「HTML5ゲーム開発の極意」の付録PDFを元に、参照しやすいようmarkdown形式に書き起こした、個人的メモです。
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
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
| /** カタカナをひらがなに変換する関数 | |
| * @param {String} src - カタカナ | |
| * @returns {String} - ひらがな | |
| */ | |
| function katakanaToHiragana(src) { | |
| return src.replace(/[\u30a1-\u30f6]/g, function(match) { | |
| var chr = match.charCodeAt(0) - 0x60; | |
| return String.fromCharCode(chr); | |
| }); |