KITASENJU DESIGN BLOG

memo, html, javascript, unity

Entries from 2023-05-01 to 1 month

RGBとYIQとHSL

/* RGB 0〜1 Y: 0〜1 I: 約-0.5957〜約0.5957 Q: 約-0.5226〜約0.5226 */ function yiqToRgb(y, i, q) { let r = y + 0.956*i + 0.621*q; let g = y - 0.272*i - 0.647*q; let b = y - 1.106*i + 1.703*q; // Clamp values if they are out of range r = Mat…

hash値(文字列)をシードにした乱数生成

Xorshiftアルゴリズムを使用した疑似乱数生成器 (PRNG) chatGPTに聞きました export class Xorshift { private state: number; constructor(seedHash: string) { this.state = this.hashStringToInt32(seedHash); } public hashStringToInt32(str: string): …

vertex colorとline segmentとShaderMaterial

import * as THREE from 'three'; import vert from "./line/line.vert"; import frag from "./line/line.frag"; import glslify from 'glslify'; export class MyLine extends THREE.Object3D{ numParticles:number=5000; strokes:THREE.Line; counter=0; p…

lil-guiで色を使う時

dat.guiの後継lil-guiにて。 lil-gui.georgealways.com //https://lil-gui.georgealways.com/# public static colors:number[] = [ 0xeeeeee,// 0xeeeeee,// 0xff77bb,// 0xff0000,// ]; //以下でいけた gui.addColor(Colors.colors,"0").listen(); gui.addC…

"FOOTER"