Entries from 2022-01-01 to 1 year
let ww:number = window.innerWidth; let hh:number = window.innerHeight; let dom = this.renderer.domElement; dom.style.position="absolute"; let stgW:number = 0; if(ww>hh){ stgW=hh; dom.style.top="0px"; dom.style.left = (ww/2-hh/2)+"px"; }els…
勾配の強弱を考えず、勾配の方向のみを可視化する float dx = tex(0,0) - tex(1,0);//x方向の勾配ベクトル float dy = tex(0,0) - tex(0,1);//y方向の勾配ベクトル float rad = atan(dy,dx);//勾配の方向(ラジアン) float red = 0.5 + 0.5*cos(rad); float…
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' this.control = new OrbitControls(this.camera, domElement); this.control?.update();
document.addEventListener('keydown', (event) => { const keyName = event.key; if(keyName=="d"){ if(this.gui){ if(this.gui.domElement.style.display=="none"){ this.gui.domElement.style.display="block"; this.stats.domElement.style.display="blo…
preserveDrawingBuffer : trueが必要 let dom = document.getElementById("webgl"); this.renderer = new THREE.WebGLRenderer({ canvas: dom,//document.querySelector('#webgl'), antialias: true, preserveDrawingBuffer : true }); document.addEventLis…
threejs で 画像ロードマネージャー import * as THREE from 'three'; import { ImageLoader } from 'three'; interface ImgData { name : string; url : string; tex : THREE.Texture; } export class ImageManager { public static LOGO1:string="LOGO1"; …
// インスタンスを保存するためのstatic変数 private static instance: Singleton; // constructorをprivateにすることで、外部からの新しいインスタンス作成を制限 private constructor() { // 初期化処理 } // インスタンスを取得するためのstaticメソッド…
import * as THREE from 'three'; import { Matrix4, Mesh, Texture, TextureLoader, Vector3 } from 'three'; import waveRender_vert from "../glsl/waveRender.vert"; import waveRender_frag from "../glsl/waveRender.frag"; import { CircleObj } from…
オフスクリーンレンダリング github.com typescript 昔は material.map = this.renderTarget; で行けたきがするがいつからから material.map = this.renderTarget.texture; になった模様 import * as THREE from 'three'; import { Camera, Matrix4, Object3…
エラーが消えない時に使った。 let hoge:string = fuga as any;
使いたいエフェクト・ギミック・アルゴリズム・話などを選ぶ 変化可能なパラメータを列挙する 素材を変える・形を変える・色を変える 質感を与える(フォトリアル)/質感を除去する(グラフィカル) 量を極端に増やす・減らす 2Dなら3Dに、3Dなら2Dに 秩序…
threejsでObject3Dなどを継承しようとしたらes6からじゃないとダメだった tsconfig { "compilerOptions": { "target": "es6",//"es5", "module": "es2015", "types":["node"], "lib": [ "es2019", "dom" ], "allowJs": true, // jsコンパイル用 "checkJs": t…
ジェネラティブなものを作った時、再生を止めるとデータは消えてしまうが 情報を保持しておきたい時がある。それにはいろいろなやり方があるが最も簡単なのは データをクリップボードにコピーし、コードにペーストすることだろう。 Plane tgt = target as Pl…
サイズを合わせたいオブジェクトを選択し、「オブジェクト」メニューの「アートボード」から「選択オブジェクトに合わせる」を選びます。
import * as THREE from 'three'; import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' import Stats from 'three/examples/jsm/libs/stats.module' import { GUI } from 'lil-gui' import { TorusGeometry, MeshPhongMaterial, Dir…
同じjsを使いつつ、処理を出し分けたい時に使った。 注意!タグに書くのは小文字、大文字を書いても小文字になる。ただマイナスを入れるとjs側はマイナスのところは大文字になる(キャメルケースがケバブケースになる) I used it when I wanted to use the …
// ウィンドウをフォーカスしたら指定した関数を実行 window.addEventListener('focus', ()=>{ console.log('onFocus'); }, false); // ウィンドウからフォーカスが外れたら指定した関数を実行 window.addEventListener('blur', ()=>{ console.log("onBlur")…
brink with gasp. i dont know this way is correct. this.count=0; gsap.to(this,{ duration:0.3, onUpdate:()=>{ this.count++; if(this.count%2==0) this.hoge.style.opacity="0"; else this.hoge.style.opacity="100%"; }, onComplete:()=>{ this.hoge.s…
DOMContentLoadedイベントとloadイベントの違い[タイミング]
setCenter(dom:HTMLElement,zIndex:number){ dom.style.position = "absolute"; dom.style.zIndex= ""+zIndex; let tgW = dom.clientWidth; let tgH = dom.clientHeight; dom.style.left = (window.innerWidth/2-tgW/2)+"px"; dom.style.top = (window.inner…
import * as THREE from 'three'; import { MeshBasicMaterial } from 'three'; import gsap from 'gsap'; export class Hoge extends THREE.Mesh{ mat: THREE.MeshBasicMaterial; count: number = 0; constructor(m:THREE.Mesh){ let mat = new MeshBasicMa…
callbackとか忘れる this.count=0; gsap.to(this,{ count: 99, duration: 5, ease: "power3.inOut", onComplete:()=>{window.alert("unko")} }) gsap.delayedCall(5,()=>{ this.hoge(); })
usage descriptionに記述がないのが原因
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MyWebcam2 : MonoBehaviour { private WebCamDevice[] devices; private WebCamTexture webCamTexture; [SerializeField] private Material outputMat; priva…
keybooard shortcutでreferencesって検索 すると shift+option+F12 とでてきた 関数上で、そのショートカットを押したら左側にでてきた!
how to call UnityRecorder from scripts //using UnityEditor.Recorder; var window = (RecorderWindow)EditorWindow.GetWindow(typeof(RecorderWindow)); if(!window.IsRecording()){ window.StartRecording(); } //stop! if(window.IsRecording()){ windo…
UnityEditor.EditorApplication.isPaused = true;//pause or resume UnityEditorEditorApplication.EnterPlaymode();//play UnityEditorEditorApplication.ExitPlaymode();//exit
On UnityEditor, when I put my own button on inspector and press it, the Screen.width/Screen.height is wrong. It does not change on update() function. I think this is a very rare phenomenon. Screen.widthがおかしい時があった。 UnityEditor上…
- for ( i=0; i <= 43 ; i++ ) div( id="t" + i ) h2 for:特定の回数ループ ul - for (var x = 0; x < 3; x++) li item #{x} h2 each:配列をループ ul - var list = ['1','2','3'] each item in list li item #{item} h2 ついでに連想配列each ul - var li…
import * as THREE from 'three'; import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js' interface ObjData { url : string; mesh : THREE.Mesh; } export class ObjLoaders { public list:ObjData[]; private callback:()=>void; private …