Category Archives: javascript

Updates Shorts and Rbn… snippet.zone zapp.codes etc…

I started making youtube shorts using a monaco-powered micro-editor I created called https://zapp.codes. Check them out here: https://www.youtube.com/@shapevent/shorts

I don’t think I ever mentioned https://snippet.zone here. It’s just another actionsnippet-like site I created a few years ago… I don’t update it all that frequently but it has many snippets mostly written in js.

recent fork of a snippet.zone that I used in a short…

Here’s a short showing something I did for genuary 2022…

Also posted in Graphics, color, es6, glsl, graphics algorithms, html5, misc | Leave a comment

Pathtracer Research

I spent awhile a few months ago learning about Pathtracers… After I good deal of research I ended up forking Evan Wallace’s Path Tracer and added a few new features and shapes - some of which I learned from Erich Loftis’s Three.js PathTracing Renderer.

view demo 1

view demo 2

Been wanting to get back to this and do optimizations and boolean shapes - but so far I haven’t gotten around to it.

Also posted in 3D, Graphics, glsl, graphics algorithms | Leave a comment

Proxy - (object always defined)

This uses a proxy to make sure all keys/props of an object are always defined.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
let spec = {
  get: (o, key) => {
    return o[key] != null ? o[key] : o[key] = O();
  },
  set: (o, key, v) => {
    o[key] = v;
  }
};
 
let O = () => {
  return new Proxy({}, spec);  
};
 
let dynamic = O();
dynamic.prop.creation = 'is interesting';
dynamic.prop.stuff.not.clear.what.this.could.be.used.for = 123;
 
// log out full structure
let f = (o) => {
  for (let i in o) {
    console.log(o[i]);
    if (typeof o[i] === 'object') f(o[i]);
  }
};
f(dynamic);

Outputs:

Proxy {creation: "is interesting", stuff: Proxy}
is interesting
Proxy {not: Proxy}
Proxy {clear: Proxy}
Proxy {what: Proxy}
Proxy {this: Proxy}
Proxy {could: Proxy}
Proxy {be: Proxy}
Proxy {used: Proxy}
Proxy {for: 123}
123
Also posted in Object, dynamic, es6, functions | Tagged , | Leave a comment

es6 concat trick

let a = [1], b = [2], c = [3],
    d = [...a, ...b, ...c];
console.log(d);
// outputs: [1, 2, 3]
Also posted in arrays, es6 | Tagged | Leave a comment