KITASENJU DESIGN BLOG

memo, html, javascript, unity

position for DOM on Threejs

https://threejs.org/examples/?q=css#css2d_label

webaudioでmp3再生

js

export default class SoundPlayer { constructor() { this.audioContext = new (window.AudioContext || window.webkitAudioContext)(); this.audioBuffer = null; this.sourceNode = null; this.gainNode = this.audioContext.createGain(); this.isPlayin…

p5 editorでclassを追加

https://editor.p5js.org/kubiak200/sketches/l3cW-xhiI

macでewinのキーボードセットアップ

https://www.amazon.co.jp/dp/B083PV3WKQ macで使いたい。 USBで繋ぐとKeybordのセットアップが出てくる。 あるいはsettingsのKeybordのset up keyboradという項目から行ける。 左側のシフトキーの右のキーを押してと言われるので、Zを押す 右側のシフトキー…

MindARのVideo

MindAR( https://hiukim.github.io/mind-ar-js-doc/ )では、画面の長辺に合わせてカメラからのビデオがトリミングされている。(videoタグのpositionなどが変更されている) そこで、全画面のquadを作っていてその際、以下の様にサイズを変えた。 this.unifo…

uGUIでblendMode反転シェーダー

UnityEngine.UI.Imageなどの要素を、blendModeを使って反転したい。 https://baba-s.hatenablog.com/entry/2019/02/03/192500 を参考にさせてもらった。 透明度の反映の仕方がよくわからなかったのでclipした。 BlendOp, Blendを使って計算していると思うが…

glslでpowを使った減衰関数

float y(float x) { float offset = 0.0; float xx = x + offset; return cos(xx*10.0)*pow(2.0,-0.9*abs(xx)); }

chromeで特定のサイトのcookieを削除する

chrome://settings/content/all と打ち込んで、画面内右上の検索から特定のサイトを出す

GPIOとLEDマトリックスの配線

https://blog.tsukumijima.net/article/ledmatrix-movie/ の記事を参考にLED Matrix(HUB75)とGPIOを繋ぐ。 作業がめちゃくちゃ面倒である。 ただ、色付きのジャンパー線を使い以下のように配線できれば、色を元に確認作業ができる。 以下の様なケーブルが手…

PM2でラズパイのコマンドを永続化

以下のようなコマンドで動くnodejsのプログラムがあって、これを永続化させたいということがあった。 sudo npm run example -- examples/hoge.ts' そこで以下のようなhoge.jsを用意した。 const { exec } = require('child_process'); // 実行したいコマンド…

unity+macで書き出したappが動かない

A Mac+Unity-exported app that downloaded from web doesn't work. It is a security problem. You have to do below on Terminal. Unityから書き出したappがネット経由でダウンロードしたappが動かない。 壊れていると言われる。ターミナルで以下を入力。 …

操作後、sliderにフォーカスを渡さないように

I didn't want uGUI to focus a slider after using it on Unity. unityのuguiにて。 private Slider _slider1; _slider1.onValueChanged.AddListener(_onChange); private void _onChange(float value){ EventSystem.current.SetSelectedGameObject(null);/…

scrapboxのシンプルカスタムcss

けっこういい! [** pin & page-list-item] code:style.css /* pinnedのグループを独立させる */ .page-list-item.pin + .page-list-item:not(.pin) { clear: both; } /* pinの高さ */ .page-list-item.pin { height: 60px !important; } /* それ以外 */ .pa…

webglからpngを毎フレームレンダリング

async tick(){ this.renderer.render(this.scene, this.oCamera); if(Params.isRec) Params.download2(); setTimeout(()=>{ this.tick(); },1000/60) } public static dhandle:any; public static async donwloadInit(){ Params.dhandle = await (window as …

typescriptでエラー無視する

// @ts-ignore をかく // @ts-ignore let example = 2; example = "型チェックを無視";

Unityでphysicsをoff

Physics.autoSimulation = false; Physics2D.autoSimulation = false;

unityから書き出したmacのアプリが動かなかった

https://qiita.com/aike@github/items/5df284620059bfc07364 macのappをunityから書き出してwebにファイルをアップ それがローカルファイルを参照するようなものだったとき、動かない! セキュリティの問題で 新規フォルダを作成→appをコピペ→それ以外をコピ…

onguiで背景を設定

[SerializeField] private Texture2D _bg; private void OnGUI(){ if (style == null) { style = new GUIStyle(); style.fontSize = 30; style.normal.textColor = Color.white; style.normal.background = _bg; } GUI.Label( new Rect(0, 700, 200, 50), _i…

unityからdirectoryを作る

public static void MakeNewDir(string newPath){ if ( Directory.Exists( newPath )) { // フォルダが存在する. Debug.Log("既に存在しているのでディレクトリつくらない " + newPath); }else{ Directory.CreateDirectory( newPath ); Debug.Log("ディレク…

random with seed on Unity

//シード値を10に指定 UnityEngine.Random.InitState(10); //ランダム値の生成・出力 for(int i = 0; i < 5; i++) { Debug.Log(UnityEngine.Random.value); }

window.open

js

古の、jsでwindowopen。 なぜかpugです。 a(href='javascript:window.open("https://000690273.codepen.website/","HTML SKETCHES","width=1280,height=720,menubar=0,toolbar=0,locationbar=0")') open!!!!!

Animatorの時間

using System.Collections; using System.Collections.Generic; using UnityEngine; public class CharaBase : MonoBehaviour { [SerializeField] protected Animator _animator; void Update() { CheckAnim(); } void CheckAnim() { if (_animator == null)…

斜め線の繰り返し

https://codepen.io/kitasenjudesign/pen/WNmROJY body{ --col1: #000; --col2: #ea0; width: 2000px; height: 100px; /*background-image: url("circle.png");*/ background-repeat: repeat; background-size: 100px 100px; background-image: repeating-li…

electronを使う

chromeのアドレスバーなしでキャプチャしたかったのだが window.openでもアドレスバーはセキュリティの問題で消すことができない。 そこでElectronを使うことにした。 インストール https://qiita.com/umamichi/items/6ce4f46c1458e89c4cfc コマンドラインで…

pugで一文字ずつspan

pug

How to set span tags randamized class name character by character. (SVOO型) .fuga - var str = "The quick brown fox jumps over the lazy dog. " - var classes = ['a1', 'a2', 'a3'] each char in str - var randomClass = classes[Math.floor(Math.r…

image splitting with quad-tree

export class BitmapData{ private _context:CanvasRenderingContext2D; private _imageData:ImageData; private _img:HTMLImageElement; private _width:number; private _height:number; private _mean:number=0; private _canvas:HTMLCanvasElement; priv…

Raw svg code for css background

I didn't know I can use raw (non-escaped) svg for css background. background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="25" cy="25" r="25" fill="blue" /><circle cx="75" cy="25" r="25" fill="blue" /></circle></circle></svg>

Creative Coding with HTML

Hello. My name is Kitasenjudesign. I do creative coding, mainly with HTML/CSS. HTML SKETCHES - https://000690273.codepen.website/ I think these are unique bcause they are creative coding with almost no programming language. (HTML is calle…

HTML Creative Codingのススメ

English article is here こんにちわ。北千住デザインと申します。アドベントカレンダー2023のための記事です。 私はHTML/CSSを主としたクリエーティブコーディングを行なっています。 HTML SKETCHES - https://000690273.codepen.website/ これらはほぼプ…

HTML Creative Codingを楽しむためのTips

HTML Creative Codingを楽しむためのTipsをお伝えします。 アニメーション CSSにはアニメーションの機能があり、多くのパラメータをアニメーションさせることが可能です。アニメーションさせることでグラフィックデザイン的な静的なものだけでなく、モーショ…

"FOOTER"