code stringlengths 0 56.1M | repo_name stringlengths 3 57 | path stringlengths 2 176 | language stringclasses 672 values | license stringclasses 8 values | size int64 0 56.8M |
|---|---|---|---|---|---|
export default /* glsl */ `uniform vec4 sliceOffset;
vec4 getSliceOffset(vec4 xyzw) {
return xyzw + sliceOffset;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/slice.position.js | JavaScript | mit | 121 |
declare var _default: "uniform float sphericalBend;\nuniform float sphericalFocus;\nuniform float sphericalAspectX;\nuniform float sphericalAspectY;\nuniform float sphericalScaleY;\n\nuniform mat4 viewMatrix;\n\nvec4 getSphericalPosition(vec4 position, inout vec4 stpq) {\n if (sphericalBend > 0.0001) {\n\n vec3 xyz = position.xyz * vec3(sphericalBend, sphericalBend / sphericalAspectY * sphericalScaleY, sphericalAspectX);\n float radius = sphericalFocus + xyz.z;\n float cosine = cos(xyz.y) * radius;\n\n return viewMatrix * vec4(\n sin(xyz.x) * cosine,\n sin(xyz.y) * radius * sphericalAspectY,\n (cos(xyz.x) * cosine - sphericalFocus) / sphericalAspectX,\n 1.0\n );\n }\n else {\n return viewMatrix * vec4(position.xyz, 1.0);\n }\n}";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/spherical.position.d.ts | TypeScript | mit | 807 |
export default /* glsl */ `uniform float sphericalBend;
uniform float sphericalFocus;
uniform float sphericalAspectX;
uniform float sphericalAspectY;
uniform float sphericalScaleY;
uniform mat4 viewMatrix;
vec4 getSphericalPosition(vec4 position, inout vec4 stpq) {
if (sphericalBend > 0.0001) {
vec3 xyz = position.xyz * vec3(sphericalBend, sphericalBend / sphericalAspectY * sphericalScaleY, sphericalAspectX);
float radius = sphericalFocus + xyz.z;
float cosine = cos(xyz.y) * radius;
return viewMatrix * vec4(
sin(xyz.x) * cosine,
sin(xyz.y) * radius * sphericalAspectY,
(cos(xyz.x) * cosine - sphericalFocus) / sphericalAspectX,
1.0
);
}
else {
return viewMatrix * vec4(position.xyz, 1.0);
}
}`;
| cchudzicki/mathbox | build/esm/shaders/glsl/spherical.position.js | JavaScript | mit | 761 |
declare var _default: "uniform float splitStride;\n\nvec2 getIndices(vec4 xyzw);\nvec4 getRest(vec4 xyzw);\nvec4 injectIndex(float v);\n\nvec4 getSplitXYZW(vec4 xyzw) {\n vec2 uv = getIndices(xyzw);\n float offset = uv.x + uv.y * splitStride;\n return injectIndex(offset) + getRest(xyzw);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/split.position.d.ts | TypeScript | mit | 324 |
export default /* glsl */ `uniform float splitStride;
vec2 getIndices(vec4 xyzw);
vec4 getRest(vec4 xyzw);
vec4 injectIndex(float v);
vec4 getSplitXYZW(vec4 xyzw) {
vec2 uv = getIndices(xyzw);
float offset = uv.x + uv.y * splitStride;
return injectIndex(offset) + getRest(xyzw);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/split.position.js | JavaScript | mit | 292 |
declare var _default: "uniform vec4 spreadOffset;\nuniform mat4 spreadMatrix;\n\n// External\nvec4 getSample(vec4 xyzw);\n\nvec4 getSpreadSample(vec4 xyzw) {\n vec4 sample = getSample(xyzw);\n return sample + spreadMatrix * (spreadOffset + xyzw);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/spread.position.d.ts | TypeScript | mit | 281 |
export default /* glsl */ `uniform vec4 spreadOffset;
uniform mat4 spreadMatrix;
// External
vec4 getSample(vec4 xyzw);
vec4 getSpreadSample(vec4 xyzw) {
vec4 sample = getSample(xyzw);
return sample + spreadMatrix * (spreadOffset + xyzw);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/spread.position.js | JavaScript | mit | 250 |
declare var _default: "varying vec2 vSprite;\n\nvec4 getSample(vec2 xy);\n\nvec4 getSpriteColor() {\n return getSample(vSprite);\n}";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/sprite.fragment.d.ts | TypeScript | mit | 160 |
export default /* glsl */ `varying vec2 vSprite;
vec4 getSample(vec2 xy);
vec4 getSpriteColor() {
return getSample(vSprite);
}`;
| cchudzicki/mathbox | build/esm/shaders/glsl/sprite.fragment.js | JavaScript | mit | 133 |
export default /* glsl */ `uniform vec2 spriteOffset;
uniform float spriteScale;
uniform float spriteDepth;
uniform float spriteSnap;
uniform vec2 renderOdd;
uniform float renderScale;
uniform float renderScaleInv;
uniform float pixelUnit;
uniform float focusDepth;
uniform vec4 geometryClip;
attribute vec4 position4;
attribute vec2 sprite;
varying float vPixelSize;
// External
vec3 getPosition(vec4 xyzw, float canonical);
vec4 getSprite(vec4 xyzw);
vec3 getSpritePosition() {
// Clip points
vec4 p = min(geometryClip, position4);
float diff = length(position4 - p);
if (diff > 0.0) {
return vec3(0.0, 0.0, 1000.0);
}
// Make sprites
vec3 center = getPosition(p, 1.0);
vec4 atlas = getSprite(p);
// Sprite goes from -1..1, width = 2.
// -1..1 -> -0.5..0.5
vec2 halfSprite = sprite * .5;
vec2 halfFlipSprite = vec2(halfSprite.x, -halfSprite.y);
#ifdef POSITION_UV
// Assign UVs
vUV = atlas.xy + atlas.zw * (halfFlipSprite + .5);
#endif
// Depth blending
// TODO: orthographic camera
// Workaround: set depth = 0
float depth = focusDepth, z;
z = -center.z;
if (spriteDepth < 1.0) {
depth = mix(z, focusDepth, spriteDepth);
}
// Match device/unit mapping
float size = pixelUnit * spriteScale;
float depthSize = depth * size;
// Calculate pixelSize for anti-aliasing
float pixelSize = (spriteDepth > 0.0 ? depthSize / z : size);
vPixelSize = pixelSize;
// Position sprite
vec2 atlasOdd = fract(atlas.zw / 2.0);
vec2 offset = (spriteOffset + halfSprite * atlas.zw) * depthSize;
if (spriteSnap > 0.5) {
// Snap to pixel (w/ epsilon shift to avoid jitter)
return vec3(((floor(center.xy / center.z * renderScale + 0.001) + renderOdd + atlasOdd) * center.z + offset) * renderScaleInv, center.z);
}
else {
// Place directly
return center + vec3(offset * renderScaleInv, 0.0);
}
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/sprite.position.js | JavaScript | mit | 1,884 |
declare var _default: "uniform float stereoBend;\n\nuniform mat4 viewMatrix;\n\nvec4 getStereoPosition(vec4 position, inout vec4 stpq) {\n if (stereoBend > 0.0001) {\n\n vec3 pos = position.xyz;\n float r = length(pos);\n float z = r + pos.z;\n vec3 project = vec3(pos.xy / z, r);\n \n vec3 lerped = mix(pos, project, stereoBend);\n\n return viewMatrix * vec4(lerped, 1.0);\n }\n else {\n return viewMatrix * vec4(position.xyz, 1.0);\n }\n}";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/stereographic.position.d.ts | TypeScript | mit | 496 |
export default /* glsl */ `uniform float stereoBend;
uniform mat4 viewMatrix;
vec4 getStereoPosition(vec4 position, inout vec4 stpq) {
if (stereoBend > 0.0001) {
vec3 pos = position.xyz;
float r = length(pos);
float z = r + pos.z;
vec3 project = vec3(pos.xy / z, r);
vec3 lerped = mix(pos, project, stereoBend);
return viewMatrix * vec4(lerped, 1.0);
}
else {
return viewMatrix * vec4(position.xyz, 1.0);
}
}`;
| cchudzicki/mathbox | build/esm/shaders/glsl/stereographic.position.js | JavaScript | mit | 456 |
declare var _default: "uniform float stereoBend;\nuniform vec4 basisScale;\nuniform vec4 basisOffset;\nuniform mat4 viewMatrix;\nuniform vec2 view4D;\n\nvec4 getStereographic4Position(vec4 position, inout vec4 stpq) {\n \n vec4 transformed;\n if (stereoBend > 0.0001) {\n\n float r = length(position);\n float w = r + position.w;\n vec4 project = vec4(position.xyz / w, r);\n \n transformed = mix(position, project, stereoBend);\n }\n else {\n transformed = position;\n }\n\n vec4 pos4 = transformed * basisScale - basisOffset;\n vec3 xyz = (viewMatrix * vec4(pos4.xyz, 1.0)).xyz;\n return vec4(xyz, pos4.w * view4D.y + view4D.x);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/stereographic4.position.d.ts | TypeScript | mit | 690 |
export default /* glsl */ `uniform float stereoBend;
uniform vec4 basisScale;
uniform vec4 basisOffset;
uniform mat4 viewMatrix;
uniform vec2 view4D;
vec4 getStereographic4Position(vec4 position, inout vec4 stpq) {
vec4 transformed;
if (stereoBend > 0.0001) {
float r = length(position);
float w = r + position.w;
vec4 project = vec4(position.xyz / w, r);
transformed = mix(position, project, stereoBend);
}
else {
transformed = position;
}
vec4 pos4 = transformed * basisScale - basisOffset;
vec3 xyz = (viewMatrix * vec4(pos4.xyz, 1.0)).xyz;
return vec4(xyz, pos4.w * view4D.y + view4D.x);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/stereographic4.position.js | JavaScript | mit | 644 |
declare var _default: "varying vec2 vST;\n\nvec4 getSample(vec2 st);\n\nvec4 getSTSample() {\n return getSample(vST);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/stpq.sample.2d.d.ts | TypeScript | mit | 151 |
export default /* glsl */ `varying vec2 vST;
vec4 getSample(vec2 st);
vec4 getSTSample() {
return getSample(vST);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/stpq.sample.2d.js | JavaScript | mit | 123 |
declare var _default: "varying vec2 vUV;\n\nvoid setRawUV(vec4 xyzw) {\n vUV = xyzw.xy;\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/stpq.xyzw.2d.d.ts | TypeScript | mit | 121 |
export default /* glsl */ `varying vec2 vUV;
void setRawUV(vec4 xyzw) {
vUV = xyzw.xy;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/stpq.xyzw.2d.js | JavaScript | mit | 95 |
declare var _default: "uniform vec4 geometryClip;\nattribute vec4 position4;\nattribute vec3 strip;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvarying vec3 vNormal;\nvarying vec3 vLight;\nvarying vec3 vPosition;\n\nvoid getStripGeometry(vec4 xyzw, vec3 strip, out vec3 pos, out vec3 normal) {\n vec3 a, b, c;\n\n a = getPosition(xyzw, 1.0);\n b = getPosition(vec4(xyzw.xyz, strip.x), 0.0);\n c = getPosition(vec4(xyzw.xyz, strip.y), 0.0);\n\n normal = normalize(cross(c - a, b - a)) * strip.z;\n \n pos = a;\n}\n\nvec3 getStripPositionNormal() {\n vec3 center, normal;\n\n vec4 p = min(geometryClip, position4);\n\n getStripGeometry(p, strip, center, normal);\n vNormal = normal;\n vLight = normalize((viewMatrix * vec4(1.0, 2.0, 2.0, 0.0)).xyz);\n vPosition = -center;\n\n return center;\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/strip.position.normal.d.ts | TypeScript | mit | 868 |
export default /* glsl */ `uniform vec4 geometryClip;
attribute vec4 position4;
attribute vec3 strip;
// External
vec3 getPosition(vec4 xyzw, float canonical);
varying vec3 vNormal;
varying vec3 vLight;
varying vec3 vPosition;
void getStripGeometry(vec4 xyzw, vec3 strip, out vec3 pos, out vec3 normal) {
vec3 a, b, c;
a = getPosition(xyzw, 1.0);
b = getPosition(vec4(xyzw.xyz, strip.x), 0.0);
c = getPosition(vec4(xyzw.xyz, strip.y), 0.0);
normal = normalize(cross(c - a, b - a)) * strip.z;
pos = a;
}
vec3 getStripPositionNormal() {
vec3 center, normal;
vec4 p = min(geometryClip, position4);
getStripGeometry(p, strip, center, normal);
vNormal = normal;
vLight = normalize((viewMatrix * vec4(1.0, 2.0, 2.0, 0.0)).xyz);
vPosition = -center;
return center;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/strip.position.normal.js | JavaScript | mit | 812 |
declare var _default: "uniform vec3 styleColor;\nuniform float styleOpacity;\n\nvec4 getStyleColor() {\n return vec4(styleColor, styleOpacity);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/style.color.d.ts | TypeScript | mit | 177 |
export default /* glsl */ `uniform vec3 styleColor;
uniform float styleOpacity;
vec4 getStyleColor() {
return vec4(styleColor, styleOpacity);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/style.color.js | JavaScript | mit | 150 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideDepth(vec4 xyzw) {\n float x = xyzw.z;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(xyzw.xy, i + g, xyzw.w));\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.depth.d.ts | TypeScript | mit | 397 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideDepth(vec4 xyzw) {
float x = xyzw.z;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
return sampleData(vec4(xyzw.xy, i + g, xyzw.w));
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.depth.js | JavaScript | mit | 361 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideDepthLerp(vec4 xyzw) {\n float x = xyzw.z;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(xyzw.xy, i, xyzw.w);\n vec4 xyzw2 = vec4(xyzw.xy, i + 1.0, xyzw.w);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.depth.lerp.d.ts | TypeScript | mit | 531 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideDepthLerp(vec4 xyzw) {
float x = xyzw.z;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
vec4 xyzw1 = vec4(xyzw.xy, i, xyzw.w);
vec4 xyzw2 = vec4(xyzw.xy, i + 1.0, xyzw.w);
vec4 a = sampleData(xyzw1);
vec4 b = sampleData(xyzw2);
return mix(a, b, g);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.depth.lerp.js | JavaScript | mit | 489 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideHeight(vec4 xyzw) {\n float x = xyzw.y;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(xyzw.x, i + g, xyzw.zw));\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.height.d.ts | TypeScript | mit | 398 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideHeight(vec4 xyzw) {
float x = xyzw.y;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
return sampleData(vec4(xyzw.x, i + g, xyzw.zw));
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.height.js | JavaScript | mit | 362 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideHeightLerp(vec4 xyzw) {\n float x = xyzw.y;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(xyzw.x, i, xyzw.zw);\n vec4 xyzw2 = vec4(xyzw.x, i + 1.0, xyzw.zw);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.height.lerp.d.ts | TypeScript | mit | 532 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideHeightLerp(vec4 xyzw) {
float x = xyzw.y;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
vec4 xyzw1 = vec4(xyzw.x, i, xyzw.zw);
vec4 xyzw2 = vec4(xyzw.x, i + 1.0, xyzw.zw);
vec4 a = sampleData(xyzw1);
vec4 b = sampleData(xyzw2);
return mix(a, b, g);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.height.lerp.js | JavaScript | mit | 490 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideItems(vec4 xyzw) {\n float x = xyzw.w;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(xyzw.xyz, i + g));\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.items.d.ts | TypeScript | mit | 390 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideItems(vec4 xyzw) {
float x = xyzw.w;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
return sampleData(vec4(xyzw.xyz, i + g));
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.items.js | JavaScript | mit | 354 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideItemsLerp(vec4 xyzw) {\n float x = xyzw.w;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(xyzw.xyz, i);\n vec4 xyzw2 = vec4(xyzw.xyz, i + 1.0);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.items.lerp.d.ts | TypeScript | mit | 517 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideItemsLerp(vec4 xyzw) {
float x = xyzw.w;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
vec4 xyzw1 = vec4(xyzw.xyz, i);
vec4 xyzw2 = vec4(xyzw.xyz, i + 1.0);
vec4 a = sampleData(xyzw1);
vec4 b = sampleData(xyzw2);
return mix(a, b, g);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.items.lerp.js | JavaScript | mit | 475 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideWidth(vec4 xyzw) {\n float x = xyzw.x;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(i + g, xyzw.yzw));\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.width.d.ts | TypeScript | mit | 390 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideWidth(vec4 xyzw) {
float x = xyzw.x;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
return sampleData(vec4(i + g, xyzw.yzw));
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.width.js | JavaScript | mit | 354 |
declare var _default: "uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideWidthLerp(vec4 xyzw) {\n float x = xyzw.x;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(i, xyzw.yzw);\n vec4 xyzw2 = vec4(i + 1.0, xyzw.yzw);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.width.lerp.d.ts | TypeScript | mit | 517 |
export default /* glsl */ `uniform float subdivideBevel;
// External
vec4 sampleData(vec4 xyzw);
vec4 subdivideWidthLerp(vec4 xyzw) {
float x = xyzw.x;
float i = floor(x);
float f = x - i;
float minf = subdivideBevel * min(f, 1.0 - f);
float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;
vec4 xyzw1 = vec4(i, xyzw.yzw);
vec4 xyzw2 = vec4(i + 1.0, xyzw.yzw);
vec4 a = sampleData(xyzw1);
vec4 b = sampleData(xyzw2);
return mix(a, b, g);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/subdivide.width.lerp.js | JavaScript | mit | 475 |
declare var _default: "attribute vec4 position4;\n\nfloat getSurfaceHollowMask(vec4 xyzw) {\n vec4 df = abs(fract(position4) - .5);\n vec2 df2 = min(df.xy, df.zw);\n float df3 = min(df2.x, df2.y);\n return df3;\n}";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/surface.mask.hollow.d.ts | TypeScript | mit | 245 |
export default /* glsl */ `attribute vec4 position4;
float getSurfaceHollowMask(vec4 xyzw) {
vec4 df = abs(fract(position4) - .5);
vec2 df2 = min(df.xy, df.zw);
float df3 = min(df2.x, df2.y);
return df3;
}`;
| cchudzicki/mathbox | build/esm/shaders/glsl/surface.mask.hollow.js | JavaScript | mit | 217 |
declare var _default: "uniform vec4 geometryClip;\nuniform vec4 geometryResolution;\nuniform vec4 mapSize;\n\nattribute vec4 position4;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvec3 getSurfacePosition() {\n vec4 p = min(geometryClip, position4);\n vec3 xyz = getPosition(p, 1.0);\n\n // Overwrite UVs\n#ifdef POSITION_UV\n#ifdef POSITION_UV_INT\n vUV = -.5 + (position4.xy * geometryResolution.xy) * mapSize.xy;\n#else\n vUV = position4.xy * geometryResolution.xy;\n#endif\n#endif\n\n return xyz;\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/surface.position.d.ts | TypeScript | mit | 559 |
export default /* glsl */ `uniform vec4 geometryClip;
uniform vec4 geometryResolution;
uniform vec4 mapSize;
attribute vec4 position4;
// External
vec3 getPosition(vec4 xyzw, float canonical);
vec3 getSurfacePosition() {
vec4 p = min(geometryClip, position4);
vec3 xyz = getPosition(p, 1.0);
// Overwrite UVs
#ifdef POSITION_UV
#ifdef POSITION_UV_INT
vUV = -.5 + (position4.xy * geometryResolution.xy) * mapSize.xy;
#else
vUV = position4.xy * geometryResolution.xy;
#endif
#endif
return xyz;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/surface.position.js | JavaScript | mit | 514 |
export default /* glsl */ `uniform vec4 mapSize;
uniform vec4 geometryResolution;
uniform vec4 geometryClip;
attribute vec4 position4;
attribute vec2 surface;
// External
vec3 getPosition(vec4 xyzw, float canonical);
void getSurfaceGeometry(vec4 xyzw, float edgeX, float edgeY, out vec3 left, out vec3 center, out vec3 right, out vec3 up, out vec3 down) {
vec4 deltaX = vec4(1.0, 0.0, 0.0, 0.0);
vec4 deltaY = vec4(0.0, 1.0, 0.0, 0.0);
/*
// high quality, 5 tap
center = getPosition(xyzw, 1.0);
left = (edgeX > -0.5) ? getPosition(xyzw - deltaX, 0.0) : center;
right = (edgeX < 0.5) ? getPosition(xyzw + deltaX, 0.0) : center;
down = (edgeY > -0.5) ? getPosition(xyzw - deltaY, 0.0) : center;
up = (edgeY < 0.5) ? getPosition(xyzw + deltaY, 0.0) : center;
*/
// low quality, 3 tap
center = getPosition(xyzw, 1.0);
left = center;
down = center;
right = (edgeX < 0.5) ? getPosition(xyzw + deltaX, 0.0) : (2.0 * center - getPosition(xyzw - deltaX, 0.0));
up = (edgeY < 0.5) ? getPosition(xyzw + deltaY, 0.0) : (2.0 * center - getPosition(xyzw - deltaY, 0.0));
}
vec3 getSurfaceNormal(vec3 left, vec3 center, vec3 right, vec3 up, vec3 down) {
vec3 dx = right - left;
vec3 dy = up - down;
vec3 n = cross(dy, dx);
if (length(n) > 0.0) {
return normalize(n);
}
return vec3(0.0, 1.0, 0.0);
}
varying vec3 vNormal;
varying vec3 vLight;
varying vec3 vPosition;
vec3 getSurfacePositionNormal() {
vec3 left, center, right, up, down;
vec4 p = min(geometryClip, position4);
getSurfaceGeometry(p, surface.x, surface.y, left, center, right, up, down);
vNormal = getSurfaceNormal(left, center, right, up, down);
vLight = normalize((viewMatrix * vec4(1.0, 2.0, 2.0, 0.0)).xyz); // hardcoded directional light
vPosition = -center;
#ifdef POSITION_UV
#ifdef POSITION_UV_INT
vUV = -.5 + (position4.xy * geometryResolution.xy) * mapSize.xy;
#else
vUV = position4.xy * geometryResolution.xy;
#endif
#endif
return center;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/surface.position.normal.js | JavaScript | mit | 2,082 |
export default /* glsl */ `uniform float worldUnit;
uniform float focusDepth;
uniform float tickSize;
uniform float tickEpsilon;
uniform vec3 tickNormal;
uniform vec2 tickStrip;
vec4 getSample(vec4 xyzw);
vec3 transformPosition(vec4 position, in vec4 stpqIn, out vec4 stpqOut);
vec3 getTickPosition(vec4 xyzw, in vec4 stpqIn, out vec4 stpqOut) {
float epsilon = tickEpsilon;
// determine tick direction
float leftX = max(tickStrip.x, xyzw.y - 1.0);
float rightX = min(tickStrip.y, xyzw.y + 1.0);
vec4 left = getSample(vec4(leftX, xyzw.zw, 0.0));
vec4 right = getSample(vec4(rightX, xyzw.zw, 0.0));
vec4 diff = right - left;
vec3 normal = cross(normalize(diff.xyz + vec3(diff.w)), tickNormal);
float bias = max(0.0, 1.0 - length(normal) * 2.0);
normal = mix(normal, tickNormal.yzx, bias * bias);
// transform (point) and (point + delta)
vec4 center = getSample(vec4(xyzw.yzw, 0.0));
vec4 delta = vec4(normal, 0.0) * epsilon;
vec4 a = center;
vec4 b = center + delta;
vec4 _;
vec3 c = transformPosition(a, stpqIn, stpqOut);
vec3 d = transformPosition(b, stpqIn, _);
// sample on either side to create line
float line = xyzw.x - .5;
vec3 mid = c;
vec3 side = normalize(d - c);
return mid + side * line * tickSize * worldUnit * focusDepth;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/ticks.position.js | JavaScript | mit | 1,331 |
declare var _default: "uniform mat4 transformMatrix;\n\nvec4 transformPosition(vec4 position, inout vec4 stpq) {\n return transformMatrix * vec4(position.xyz, 1.0);\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/transform3.position.d.ts | TypeScript | mit | 198 |
export default /* glsl */ `uniform mat4 transformMatrix;
vec4 transformPosition(vec4 position, inout vec4 stpq) {
return transformMatrix * vec4(position.xyz, 1.0);
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/transform3.position.js | JavaScript | mit | 172 |
declare var _default: "uniform mat4 transformMatrix;\nuniform vec4 transformOffset;\n\nvec4 transformPosition(vec4 position, inout vec4 stpq) {\n return transformMatrix * position + transformOffset;\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/transform4.position.d.ts | TypeScript | mit | 232 |
export default /* glsl */ `uniform mat4 transformMatrix;
uniform vec4 transformOffset;
vec4 transformPosition(vec4 position, inout vec4 stpq) {
return transformMatrix * position + transformOffset;
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/transform4.position.js | JavaScript | mit | 205 |
declare var _default: "// Implicit three.js uniform\n// uniform mat4 viewMatrix;\n\nvec4 getViewPosition(vec4 position, inout vec4 stpq) {\n return (viewMatrix * vec4(position.xyz, 1.0));\n}\n";
export default _default;
| cchudzicki/mathbox | build/esm/shaders/glsl/view.position.d.ts | TypeScript | mit | 221 |
export default /* glsl */ `// Implicit three.js uniform
// uniform mat4 viewMatrix;
vec4 getViewPosition(vec4 position, inout vec4 stpq) {
return (viewMatrix * vec4(position.xyz, 1.0));
}
`;
| cchudzicki/mathbox | build/esm/shaders/glsl/view.position.js | JavaScript | mit | 194 |
export const Snippets: {
"arrow.position": string;
"axis.position": string;
"cartesian.position": string;
"cartesian4.position": string;
"clamp.position": string;
"color.opaque": string;
"face.position": string;
"face.position.normal": string;
"float.encode": string;
"float.index.pack": string;
"float.stretch": string;
"fragment.clip.dashed": string;
"fragment.clip.dotted": string;
"fragment.clip.ends": string;
"fragment.clip.proximity": string;
"fragment.color": string;
"fragment.map.rgba": string;
"fragment.solid": string;
"fragment.transparent": string;
"grid.position": string;
"grow.position": string;
"join.position": string;
"label.alpha": string;
"label.map": string;
"label.outline": string;
"layer.position": string;
"lerp.depth": string;
"lerp.height": string;
"lerp.items": string;
"lerp.width": string;
"line.position": string;
"map.2d.data": string;
"map.2d.data.wrap": string;
"map.xyzw.2dv": string;
"map.xyzw.align": string;
"map.xyzw.texture": string;
"mesh.fragment.color": string;
"mesh.fragment.map": string;
"mesh.fragment.mask": string;
"mesh.fragment.material": string;
"mesh.fragment.shaded": string;
"mesh.fragment.texture": string;
"mesh.gamma.in": string;
"mesh.gamma.out": string;
"mesh.map.uvwo": string;
"mesh.position": string;
"mesh.vertex.color": string;
"mesh.vertex.mask": string;
"mesh.vertex.position": string;
"move.position": string;
"object.mask.default": string;
"point.alpha.circle": string;
"point.alpha.circle.hollow": string;
"point.alpha.generic": string;
"point.alpha.generic.hollow": string;
"point.edge": string;
"point.fill": string;
"point.mask.circle": string;
"point.mask.diamond": string;
"point.mask.down": string;
"point.mask.left": string;
"point.mask.right": string;
"point.mask.square": string;
"point.mask.up": string;
"point.position": string;
"point.size.uniform": string;
"point.size.varying": string;
"polar.position": string;
"project.position": string;
"project.readback": string;
"raw.position.scale": string;
"repeat.position": string;
"resample.padding": string;
"resample.relative": string;
"reveal.mask": string;
"root.position": string;
"sample.2d": string;
"scale.position": string;
"screen.map.stpq": string;
"screen.map.xy": string;
"screen.map.xyzw": string;
"screen.pass.uv": string;
"screen.position": string;
"slice.position": string;
"spherical.position": string;
"split.position": string;
"spread.position": string;
"sprite.fragment": string;
"sprite.position": string;
"stereographic.position": string;
"stereographic4.position": string;
"stpq.sample.2d": string;
"stpq.xyzw.2d": string;
"strip.position.normal": string;
"style.color": string;
"subdivide.depth": string;
"subdivide.depth.lerp": string;
"subdivide.height": string;
"subdivide.height.lerp": string;
"subdivide.items": string;
"subdivide.items.lerp": string;
"subdivide.width": string;
"subdivide.width.lerp": string;
"surface.mask.hollow": string;
"surface.position": string;
"surface.position.normal": string;
"ticks.position": string;
"transform3.position": string;
"transform4.position": string;
"view.position": string;
};
export * from "./factory.js";
| cchudzicki/mathbox | build/esm/shaders/index.d.ts | TypeScript | mit | 3,551 |
import arrowposition from "./glsl/arrow.position";
import axisposition from "./glsl/axis.position";
import cartesian4position from "./glsl/cartesian4.position";
import cartesianposition from "./glsl/cartesian.position";
import clampposition from "./glsl/clamp.position";
import coloropaque from "./glsl/color.opaque";
import faceposition from "./glsl/face.position";
import facepositionnormal from "./glsl/face.position.normal";
import floatencode from "./glsl/float.encode";
import floatindexpack from "./glsl/float.index.pack";
import floatstretch from "./glsl/float.stretch";
import fragmentclipdashed from "./glsl/fragment.clip.dashed";
import fragmentclipdotted from "./glsl/fragment.clip.dotted";
import fragmentclipends from "./glsl/fragment.clip.ends";
import fragmentclipproximity from "./glsl/fragment.clip.proximity";
import fragmentcolor from "./glsl/fragment.color";
import fragmentmaprgba from "./glsl/fragment.map.rgba";
import fragmentsolid from "./glsl/fragment.solid";
import fragmenttransparent from "./glsl/fragment.transparent";
import gridposition from "./glsl/grid.position";
import growposition from "./glsl/grow.position";
import joinposition from "./glsl/join.position";
import labelalpha from "./glsl/label.alpha";
import labelmap from "./glsl/label.map";
import labeloutline from "./glsl/label.outline";
import layerposition from "./glsl/layer.position";
import lerpdepth from "./glsl/lerp.depth";
import lerpheight from "./glsl/lerp.height";
import lerpitems from "./glsl/lerp.items";
import lerpwidth from "./glsl/lerp.width";
import lineposition from "./glsl/line.position";
import map2ddata from "./glsl/map.2d.data";
import map2ddatawrap from "./glsl/map.2d.data.wrap";
import mapxyzw2dv from "./glsl/map.xyzw.2dv";
import mapxyzwalign from "./glsl/map.xyzw.align";
import mapxyzwtexture from "./glsl/map.xyzw.texture";
import meshfragmentcolor from "./glsl/mesh.fragment.color";
import meshfragmentmap from "./glsl/mesh.fragment.map";
import meshfragmentmask from "./glsl/mesh.fragment.mask";
import meshfragmentmaterial from "./glsl/mesh.fragment.material";
import meshfragmentshaded from "./glsl/mesh.fragment.shaded";
import meshfragmenttexture from "./glsl/mesh.fragment.texture";
import meshgammain from "./glsl/mesh.gamma.in";
import meshgammaout from "./glsl/mesh.gamma.out";
import meshmapuvwo from "./glsl/mesh.map.uvwo";
import meshposition from "./glsl/mesh.position";
import meshvertexcolor from "./glsl/mesh.vertex.color";
import meshvertexmask from "./glsl/mesh.vertex.mask";
import meshvertexposition from "./glsl/mesh.vertex.position";
import moveposition from "./glsl/move.position";
import objectmaskdefault from "./glsl/object.mask.default";
import pointalphacircle from "./glsl/point.alpha.circle";
import pointalphacirclehollow from "./glsl/point.alpha.circle.hollow";
import pointalphageneric from "./glsl/point.alpha.generic";
import pointalphagenerichollow from "./glsl/point.alpha.generic.hollow";
import pointedge from "./glsl/point.edge";
import pointfill from "./glsl/point.fill";
import pointmaskcircle from "./glsl/point.mask.circle";
import pointmaskdiamond from "./glsl/point.mask.diamond";
import pointmaskdown from "./glsl/point.mask.down";
import pointmaskleft from "./glsl/point.mask.left";
import pointmaskright from "./glsl/point.mask.right";
import pointmasksquare from "./glsl/point.mask.square";
import pointmaskup from "./glsl/point.mask.up";
import pointposition from "./glsl/point.position";
import pointsizeuniform from "./glsl/point.size.uniform";
import pointsizevarying from "./glsl/point.size.varying";
import polarposition from "./glsl/polar.position";
import projectposition from "./glsl/project.position";
import projectreadback from "./glsl/project.readback";
import rawpositionscale from "./glsl/raw.position.scale";
import repeatposition from "./glsl/repeat.position";
import resamplepadding from "./glsl/resample.padding";
import resamplerelative from "./glsl/resample.relative";
import revealmask from "./glsl/reveal.mask";
import rootposition from "./glsl/root.position";
import sample2d from "./glsl/sample.2d";
import scaleposition from "./glsl/scale.position";
import screenmapstpq from "./glsl/screen.map.stpq";
import screenmapxy from "./glsl/screen.map.xy";
import screenmapxyzw from "./glsl/screen.map.xyzw";
import screenpassuv from "./glsl/screen.pass.uv";
import screenposition from "./glsl/screen.position";
import sliceposition from "./glsl/slice.position";
import sphericalposition from "./glsl/spherical.position";
import splitposition from "./glsl/split.position";
import spreadposition from "./glsl/spread.position";
import spritefragment from "./glsl/sprite.fragment";
import spriteposition from "./glsl/sprite.position";
import stereographic4position from "./glsl/stereographic4.position";
import stereographicposition from "./glsl/stereographic.position";
import stpqsample2d from "./glsl/stpq.sample.2d";
import stpqxyzw2d from "./glsl/stpq.xyzw.2d";
import strippositionnormal from "./glsl/strip.position.normal";
import stylecolor from "./glsl/style.color";
import subdividedepth from "./glsl/subdivide.depth";
import subdividedepthlerp from "./glsl/subdivide.depth.lerp";
import subdivideheight from "./glsl/subdivide.height";
import subdivideheightlerp from "./glsl/subdivide.height.lerp";
import subdivideitems from "./glsl/subdivide.items";
import subdivideitemslerp from "./glsl/subdivide.items.lerp";
import subdividewidth from "./glsl/subdivide.width";
import subdividewidthlerp from "./glsl/subdivide.width.lerp";
import surfacemaskhollow from "./glsl/surface.mask.hollow";
import surfaceposition from "./glsl/surface.position";
import surfacepositionnormal from "./glsl/surface.position.normal";
import ticksposition from "./glsl/ticks.position";
import transform3position from "./glsl/transform3.position";
import transform4position from "./glsl/transform4.position";
import viewposition from "./glsl/view.position";
export const Snippets = {
"arrow.position": arrowposition,
"axis.position": axisposition,
"cartesian.position": cartesianposition,
"cartesian4.position": cartesian4position,
"clamp.position": clampposition,
"color.opaque": coloropaque,
"face.position": faceposition,
"face.position.normal": facepositionnormal,
"float.encode": floatencode,
"float.index.pack": floatindexpack,
"float.stretch": floatstretch,
"fragment.clip.dashed": fragmentclipdashed,
"fragment.clip.dotted": fragmentclipdotted,
"fragment.clip.ends": fragmentclipends,
"fragment.clip.proximity": fragmentclipproximity,
"fragment.color": fragmentcolor,
"fragment.map.rgba": fragmentmaprgba,
"fragment.solid": fragmentsolid,
"fragment.transparent": fragmenttransparent,
"grid.position": gridposition,
"grow.position": growposition,
"join.position": joinposition,
"label.alpha": labelalpha,
"label.map": labelmap,
"label.outline": labeloutline,
"layer.position": layerposition,
"lerp.depth": lerpdepth,
"lerp.height": lerpheight,
"lerp.items": lerpitems,
"lerp.width": lerpwidth,
"line.position": lineposition,
"map.2d.data": map2ddata,
"map.2d.data.wrap": map2ddatawrap,
"map.xyzw.2dv": mapxyzw2dv,
"map.xyzw.align": mapxyzwalign,
"map.xyzw.texture": mapxyzwtexture,
"mesh.fragment.color": meshfragmentcolor,
"mesh.fragment.map": meshfragmentmap,
"mesh.fragment.mask": meshfragmentmask,
"mesh.fragment.material": meshfragmentmaterial,
"mesh.fragment.shaded": meshfragmentshaded,
"mesh.fragment.texture": meshfragmenttexture,
"mesh.gamma.in": meshgammain,
"mesh.gamma.out": meshgammaout,
"mesh.map.uvwo": meshmapuvwo,
"mesh.position": meshposition,
"mesh.vertex.color": meshvertexcolor,
"mesh.vertex.mask": meshvertexmask,
"mesh.vertex.position": meshvertexposition,
"move.position": moveposition,
"object.mask.default": objectmaskdefault,
"point.alpha.circle": pointalphacircle,
"point.alpha.circle.hollow": pointalphacirclehollow,
"point.alpha.generic": pointalphageneric,
"point.alpha.generic.hollow": pointalphagenerichollow,
"point.edge": pointedge,
"point.fill": pointfill,
"point.mask.circle": pointmaskcircle,
"point.mask.diamond": pointmaskdiamond,
"point.mask.down": pointmaskdown,
"point.mask.left": pointmaskleft,
"point.mask.right": pointmaskright,
"point.mask.square": pointmasksquare,
"point.mask.up": pointmaskup,
"point.position": pointposition,
"point.size.uniform": pointsizeuniform,
"point.size.varying": pointsizevarying,
"polar.position": polarposition,
"project.position": projectposition,
"project.readback": projectreadback,
"raw.position.scale": rawpositionscale,
"repeat.position": repeatposition,
"resample.padding": resamplepadding,
"resample.relative": resamplerelative,
"reveal.mask": revealmask,
"root.position": rootposition,
"sample.2d": sample2d,
"scale.position": scaleposition,
"screen.map.stpq": screenmapstpq,
"screen.map.xy": screenmapxy,
"screen.map.xyzw": screenmapxyzw,
"screen.pass.uv": screenpassuv,
"screen.position": screenposition,
"slice.position": sliceposition,
"spherical.position": sphericalposition,
"split.position": splitposition,
"spread.position": spreadposition,
"sprite.fragment": spritefragment,
"sprite.position": spriteposition,
"stereographic.position": stereographicposition,
"stereographic4.position": stereographic4position,
"stpq.sample.2d": stpqsample2d,
"stpq.xyzw.2d": stpqxyzw2d,
"strip.position.normal": strippositionnormal,
"style.color": stylecolor,
"subdivide.depth": subdividedepth,
"subdivide.depth.lerp": subdividedepthlerp,
"subdivide.height": subdivideheight,
"subdivide.height.lerp": subdivideheightlerp,
"subdivide.items": subdivideitems,
"subdivide.items.lerp": subdivideitemslerp,
"subdivide.width": subdividewidth,
"subdivide.width.lerp": subdividewidthlerp,
"surface.mask.hollow": surfacemaskhollow,
"surface.position": surfaceposition,
"surface.position.normal": surfacepositionnormal,
"ticks.position": ticksposition,
"transform3.position": transform3position,
"transform4.position": transform4position,
"view.position": viewposition,
};
export * from "./factory.js";
| cchudzicki/mathbox | build/esm/shaders/index.js | JavaScript | mit | 10,401 |
export {};
| cchudzicki/mathbox | build/esm/splash.d.ts | TypeScript | mit | 11 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Threestrap plugin
import { Bootstrap } from "threestrap/src/bootstrap.js";
Bootstrap.registerPlugin("splash", {
defaults: {
color: "mono",
fancy: true,
},
listen: [
"ready",
"mathbox/init:init",
"mathbox/progress:progress",
"mathbox/destroy:destroy",
],
uninstall() {
return this.destroy();
},
ready(event, three) {
if (three.MathBox && !this.div) {
// TODO woah seems wrong!!!
return this.init(event, three);
}
},
init(event, three) {
let div;
this.destroy();
const { color } = this.options;
const html = `\
<div class="mathbox-loader mathbox-splash-${color}">
<div class="mathbox-logo">
<div> <div></div><div></div><div></div> </div>
<div> <div></div><div></div><div></div> </div>
</div>
<div class="mathbox-progress"><div></div></div>
</div>\
`;
this.div = div = document.createElement("div");
div.innerHTML = html;
three.element.appendChild(div);
const x = Math.random() * 2 - 1;
const y = Math.random() * 2 - 1;
const z = Math.random() * 2 - 1;
const l = 1 / Math.sqrt(x * x + y * y + z * z);
this.loader = div.querySelector(".mathbox-loader");
this.bar = div.querySelector(".mathbox-progress > div");
this.gyro = div.querySelectorAll(".mathbox-logo > div");
this.transforms = [
"rotateZ(22deg) rotateX(24deg) rotateY(30deg)",
"rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(.6, .6, .6)",
];
this.random = [x * l, y * l, z * l];
this.start = three.Time.now;
return (this.timer = null);
},
// Update splash screen state and animation
progress(event, three) {
if (!this.div) {
return;
}
const { current, total } = event;
// Display splash screen
const visible = current < total;
clearTimeout(this.timer);
if (visible) {
this.loader.classList.remove("mathbox-exit");
this.loader.style.display = "block";
}
else {
this.loader.classList.add("mathbox-exit");
this.timer = setTimeout(() => {
return (this.loader.style.display = "none");
}, 150);
}
// Update splash progress
const width = current < total
? Math.round((1000 * current) / total) * 0.1 + "%"
: "100%";
this.bar.style.width = width;
if (this.options.fancy) {
// Spinny gyros
const weights = this.random;
// Lerp clock speed
const f = Math.max(0, Math.min(1, three.Time.now - this.start));
const increment = function (transform, j) {
if (j == null) {
j = 0;
}
return transform.replace(/(-?[0-9.e]+)deg/g, (_, n) => +n + weights[j++] * f * three.Time.step * 60 + "deg");
};
return (() => {
const result = [];
for (let i = 0; i < this.gyro.length; i++) {
let t;
const el = this.gyro[i];
this.transforms[i] = t = increment(this.transforms[i]);
result.push((el.style.transform = el.style.WebkitTransform = t));
}
return result;
})();
}
},
destroy() {
if (this.div != null) {
this.div.remove();
}
return (this.div = null);
},
});
| cchudzicki/mathbox | build/esm/splash.js | JavaScript | mit | 4,030 |
import { Traits as TraitsValue } from "./primitives/types/traits";
declare type Traits = typeof TraitsValue;
interface GetTraitsNode {
id: ReturnType<Traits["node"]["id"]["validate"]>;
classes: ReturnType<Traits["node"]["classes"]["validate"]>;
}
interface SetTraitsNode {
/**
* Unique ID
* @default `null`
* @example `"sampler"`
*/
id: Parameters<Traits["node"]["id"]["validate"]>[0];
/**
* Custom classes
* @default `[]`
* @example `["big"]`
*/
classes: Parameters<Traits["node"]["classes"]["validate"]>[0];
}
interface GetTraitsEntity {
active: ReturnType<Traits["entity"]["active"]["validate"]>;
}
interface SetTraitsEntity {
/**
* Updates continuously
* @default `true`
*/
active: Parameters<Traits["entity"]["active"]["validate"]>[0];
}
interface GetTraitsObject {
visible: ReturnType<Traits["object"]["visible"]["validate"]>;
}
interface SetTraitsObject {
/**
* Visibility for rendering
* @default `true`
*/
visible: Parameters<Traits["object"]["visible"]["validate"]>[0];
}
interface GetTraitsUnit {
scale: ReturnType<Traits["unit"]["scale"]["validate"]>;
fov: ReturnType<Traits["unit"]["fov"]["validate"]>;
focus: ReturnType<Traits["unit"]["focus"]["validate"]>;
}
interface SetTraitsUnit {
/**
* (Vertical) Reference scale of viewport in pixels
* @default `null`
* @example `720`
*/
scale: Parameters<Traits["unit"]["scale"]["validate"]>[0];
/**
* (Vertical) Field-of-view to calibrate units for (degrees)
* @default `null`
* @example `60`
*/
fov: Parameters<Traits["unit"]["fov"]["validate"]>[0];
/**
* Camera focus distance in world units
* @default `1`
*/
focus: Parameters<Traits["unit"]["focus"]["validate"]>[0];
}
interface GetTraitsSpan {
range: ReturnType<Traits["span"]["range"]["validate"]>;
}
interface SetTraitsSpan {
/**
* Range on axis
* @default `[-1, 1]`
*/
range: Parameters<Traits["span"]["range"]["validate"]>[0];
}
interface GetTraitsView {
range: ReturnType<Traits["view"]["range"]["validate"]>;
}
interface SetTraitsView {
/**
* 4D range in view
* @default `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]`
*/
range: Parameters<Traits["view"]["range"]["validate"]>[0];
}
interface GetTraitsView3 {
position: ReturnType<Traits["view3"]["position"]["validate"]>;
quaternion: ReturnType<Traits["view3"]["quaternion"]["validate"]>;
rotation: ReturnType<Traits["view3"]["rotation"]["validate"]>;
scale: ReturnType<Traits["view3"]["scale"]["validate"]>;
eulerOrder: ReturnType<Traits["view3"]["eulerOrder"]["validate"]>;
}
interface SetTraitsView3 {
/**
* 3D Position
* @default `[0, 0, 0]`
*/
position: Parameters<Traits["view3"]["position"]["validate"]>[0];
/**
* 3D Quaternion
* @default `[0, 0, 0, 1]`
*/
quaternion: Parameters<Traits["view3"]["quaternion"]["validate"]>[0];
/**
* 3D Euler rotation
* @default `[0, 0, 0]`
*/
rotation: Parameters<Traits["view3"]["rotation"]["validate"]>[0];
/**
* 3D Scale
* @default `[1, 1, 1]`
*/
scale: Parameters<Traits["view3"]["scale"]["validate"]>[0];
/**
* Euler order
* @default `xyz`
*/
eulerOrder: Parameters<Traits["view3"]["eulerOrder"]["validate"]>[0];
}
interface GetTraitsView4 {
position: ReturnType<Traits["view4"]["position"]["validate"]>;
scale: ReturnType<Traits["view4"]["scale"]["validate"]>;
}
interface SetTraitsView4 {
/**
* 4D Position
* @default `[0, 0, 0, 0]`
*/
position: Parameters<Traits["view4"]["position"]["validate"]>[0];
/**
* 4D Scale
* @default `[1, 1, 1, 1]`
*/
scale: Parameters<Traits["view4"]["scale"]["validate"]>[0];
}
interface GetTraitsLayer {
depth: ReturnType<Traits["layer"]["depth"]["validate"]>;
fit: ReturnType<Traits["layer"]["fit"]["validate"]>;
}
interface SetTraitsLayer {
/**
* 3D Depth
* @default `1`
*/
depth: Parameters<Traits["layer"]["depth"]["validate"]>[0];
/**
* Fit to (contain, cover, x, y)
* @default `y`
*/
fit: Parameters<Traits["layer"]["fit"]["validate"]>[0];
}
interface GetTraitsVertex {
pass: ReturnType<Traits["vertex"]["pass"]["validate"]>;
}
interface SetTraitsVertex {
/**
* Vertex pass (data, view, world, eye)
* @default `"view"`
*/
pass: Parameters<Traits["vertex"]["pass"]["validate"]>[0];
}
interface GetTraitsFragment {
pass: ReturnType<Traits["fragment"]["pass"]["validate"]>;
gamma: ReturnType<Traits["fragment"]["gamma"]["validate"]>;
}
interface SetTraitsFragment {
/**
* Fragment pass (color, light, rgba)
* @default `"light"`
*/
pass: Parameters<Traits["fragment"]["pass"]["validate"]>[0];
/**
* Pass RGBA values in sRGB instead of linear RGB
* @default `false`
*/
gamma: Parameters<Traits["fragment"]["gamma"]["validate"]>[0];
}
interface GetTraitsTransform3 {
position: ReturnType<Traits["transform3"]["position"]["validate"]>;
quaternion: ReturnType<Traits["transform3"]["quaternion"]["validate"]>;
rotation: ReturnType<Traits["transform3"]["rotation"]["validate"]>;
eulerOrder: ReturnType<Traits["transform3"]["eulerOrder"]["validate"]>;
scale: ReturnType<Traits["transform3"]["scale"]["validate"]>;
matrix: ReturnType<Traits["transform3"]["matrix"]["validate"]>;
}
interface SetTraitsTransform3 {
/**
* 3D Position
* @default `[0, 0, 0]`
*/
position: Parameters<Traits["transform3"]["position"]["validate"]>[0];
/**
* 3D Quaternion
* @default `[0, 0, 0, 1]`
*/
quaternion: Parameters<Traits["transform3"]["quaternion"]["validate"]>[0];
/**
* 3D Euler rotation
* @default `[0, 0, 0]`
*/
rotation: Parameters<Traits["transform3"]["rotation"]["validate"]>[0];
/**
* 3D Euler order
* @default `xyz`
*/
eulerOrder: Parameters<Traits["transform3"]["eulerOrder"]["validate"]>[0];
/**
* 3D Scale
* @default `[1, 1, 1]`
*/
scale: Parameters<Traits["transform3"]["scale"]["validate"]>[0];
/**
* 3D Projective Matrix
* @default `[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]`
*/
matrix: Parameters<Traits["transform3"]["matrix"]["validate"]>[0];
}
interface GetTraitsTransform4 {
position: ReturnType<Traits["transform4"]["position"]["validate"]>;
scale: ReturnType<Traits["transform4"]["scale"]["validate"]>;
matrix: ReturnType<Traits["transform4"]["matrix"]["validate"]>;
}
interface SetTraitsTransform4 {
/**
* 4D Position
* @default `[0, 0, 0, 0]`
*/
position: Parameters<Traits["transform4"]["position"]["validate"]>[0];
/**
* 4D Scale
* @default `[1, 1, 1, 1]`
*/
scale: Parameters<Traits["transform4"]["scale"]["validate"]>[0];
/**
* 4D Affine Matrix
* @default `[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]`
*/
matrix: Parameters<Traits["transform4"]["matrix"]["validate"]>[0];
}
interface GetTraitsCamera {
proxy: ReturnType<Traits["camera"]["proxy"]["validate"]>;
position: ReturnType<Traits["camera"]["position"]["validate"]>;
quaternion: ReturnType<Traits["camera"]["quaternion"]["validate"]>;
rotation: ReturnType<Traits["camera"]["rotation"]["validate"]>;
lookAt: ReturnType<Traits["camera"]["lookAt"]["validate"]>;
up: ReturnType<Traits["camera"]["up"]["validate"]>;
eulerOrder: ReturnType<Traits["camera"]["eulerOrder"]["validate"]>;
fov: ReturnType<Traits["camera"]["fov"]["validate"]>;
}
interface SetTraitsCamera {
/**
* Re-use existing camera
* @default `false`
*/
proxy: Parameters<Traits["camera"]["proxy"]["validate"]>[0];
/**
* 3D Position
* @default `null`
* @example `[1, 2, 3]`
*/
position: Parameters<Traits["camera"]["position"]["validate"]>[0];
/**
* 3D Quaternion
* @default `null`
* @example `[0.707, 0, 0, 0.707]`
*/
quaternion: Parameters<Traits["camera"]["quaternion"]["validate"]>[0];
/**
* 3D Euler rotation
* @default `null`
* @example `[π/2, 0, 0]`
*/
rotation: Parameters<Traits["camera"]["rotation"]["validate"]>[0];
/**
* 3D Look at
* @default `null`
* @example `[2, 3, 4]`
*/
lookAt: Parameters<Traits["camera"]["lookAt"]["validate"]>[0];
/**
* 3D Up
* @default `null`
* @example `[0, 1, 0]`
*/
up: Parameters<Traits["camera"]["up"]["validate"]>[0];
/**
* 3D Euler order
* @default `"xyz"`
*/
eulerOrder: Parameters<Traits["camera"]["eulerOrder"]["validate"]>[0];
/**
* Field-of-view (degrees)
* @default `null`
* @example `60`
*/
fov: Parameters<Traits["camera"]["fov"]["validate"]>[0];
}
interface GetTraitsPolar {
bend: ReturnType<Traits["polar"]["bend"]["validate"]>;
helix: ReturnType<Traits["polar"]["helix"]["validate"]>;
}
interface SetTraitsPolar {
/**
* Amount of polar bend
* @default `1`
*/
bend: Parameters<Traits["polar"]["bend"]["validate"]>[0];
/**
* Expand into helix
* @default `0`
*/
helix: Parameters<Traits["polar"]["helix"]["validate"]>[0];
}
interface GetTraitsSpherical {
bend: ReturnType<Traits["spherical"]["bend"]["validate"]>;
}
interface SetTraitsSpherical {
/**
* Amount of spherical bend
* @default `1`
*/
bend: Parameters<Traits["spherical"]["bend"]["validate"]>[0];
}
interface GetTraitsStereographic {
bend: ReturnType<Traits["stereographic"]["bend"]["validate"]>;
}
interface SetTraitsStereographic {
/**
* Amount of stereographic bend
* @default `1`
*/
bend: Parameters<Traits["stereographic"]["bend"]["validate"]>[0];
}
interface GetTraitsInterval {
axis: ReturnType<Traits["interval"]["axis"]["validate"]>;
}
interface SetTraitsInterval {
/**
* Axis
* @default `1`
*/
axis: Parameters<Traits["interval"]["axis"]["validate"]>[0];
}
interface GetTraitsArea {
axes: ReturnType<Traits["area"]["axes"]["validate"]>;
}
interface SetTraitsArea {
/**
* Axis pair
* @default `[1, 2]`
*/
axes: Parameters<Traits["area"]["axes"]["validate"]>[0];
}
interface GetTraitsVolume {
axes: ReturnType<Traits["volume"]["axes"]["validate"]>;
}
interface SetTraitsVolume {
/**
* Axis triplet
* @default `[1, 2, 3]`
*/
axes: Parameters<Traits["volume"]["axes"]["validate"]>[0];
}
interface GetTraitsOrigin {
origin: ReturnType<Traits["origin"]["origin"]["validate"]>;
}
interface SetTraitsOrigin {
/**
* 4D Origin
* @default `[0, 0, 0, 0]`
*/
origin: Parameters<Traits["origin"]["origin"]["validate"]>[0];
}
interface GetTraitsScale {
divide: ReturnType<Traits["scale"]["divide"]["validate"]>;
unit: ReturnType<Traits["scale"]["unit"]["validate"]>;
base: ReturnType<Traits["scale"]["base"]["validate"]>;
mode: ReturnType<Traits["scale"]["mode"]["validate"]>;
start: ReturnType<Traits["scale"]["start"]["validate"]>;
end: ReturnType<Traits["scale"]["end"]["validate"]>;
zero: ReturnType<Traits["scale"]["zero"]["validate"]>;
factor: ReturnType<Traits["scale"]["factor"]["validate"]>;
nice: ReturnType<Traits["scale"]["nice"]["validate"]>;
}
interface SetTraitsScale {
/**
* Number of divisions
* @default `10`
*/
divide: Parameters<Traits["scale"]["divide"]["validate"]>[0];
/**
* Reference unit
* @default `1`
*/
unit: Parameters<Traits["scale"]["unit"]["validate"]>[0];
/**
* Power base for sub/super units
* @default `10`
*/
base: Parameters<Traits["scale"]["base"]["validate"]>[0];
/**
* Scale type
* @default `"linear"`
*/
mode: Parameters<Traits["scale"]["mode"]["validate"]>[0];
/**
* Include start
* @default `true`
*/
start: Parameters<Traits["scale"]["start"]["validate"]>[0];
/**
* Include end
* @default `true`
*/
end: Parameters<Traits["scale"]["end"]["validate"]>[0];
/**
* Include zero
* @default `true`
*/
zero: Parameters<Traits["scale"]["zero"]["validate"]>[0];
/**
* Scale factor
* @default `1`
*/
factor: Parameters<Traits["scale"]["factor"]["validate"]>[0];
/**
* Snap to nice numbers
* @default `true`
*/
nice: Parameters<Traits["scale"]["nice"]["validate"]>[0];
}
interface GetTraitsGrid {
lineX: ReturnType<Traits["grid"]["lineX"]["validate"]>;
lineY: ReturnType<Traits["grid"]["lineY"]["validate"]>;
crossed: ReturnType<Traits["grid"]["crossed"]["validate"]>;
closedX: ReturnType<Traits["grid"]["closedX"]["validate"]>;
closedY: ReturnType<Traits["grid"]["closedY"]["validate"]>;
}
interface SetTraitsGrid {
/**
* Draw X lines
* @default `true`
*/
lineX: Parameters<Traits["grid"]["lineX"]["validate"]>[0];
/**
* Draw Y lines
* @default `true`
*/
lineY: Parameters<Traits["grid"]["lineY"]["validate"]>[0];
/**
* UVWO map on matching axes
* @default `true`
*/
crossed: Parameters<Traits["grid"]["crossed"]["validate"]>[0];
/**
* Close X lines
* @default `false`
*/
closedX: Parameters<Traits["grid"]["closedX"]["validate"]>[0];
/**
* Close Y lines
* @default `false`
*/
closedY: Parameters<Traits["grid"]["closedY"]["validate"]>[0];
}
interface GetTraitsAxis {
detail: ReturnType<Traits["axis"]["detail"]["validate"]>;
crossed: ReturnType<Traits["axis"]["crossed"]["validate"]>;
}
interface SetTraitsAxis {
/**
* Geometric detail
* @default `1`
*/
detail: Parameters<Traits["axis"]["detail"]["validate"]>[0];
/**
* UVWO map on matching axis
* @default `true`
*/
crossed: Parameters<Traits["axis"]["crossed"]["validate"]>[0];
}
interface GetTraitsData {
data: ReturnType<Traits["data"]["data"]["validate"]>;
expr: ReturnType<Traits["data"]["expr"]["validate"]>;
bind: ReturnType<Traits["data"]["bind"]["validate"]>;
live: ReturnType<Traits["data"]["live"]["validate"]>;
}
interface SetTraitsData {
/**
* Data array
* @default `null`
*/
data: Parameters<Traits["data"]["data"]["validate"]>[0];
/**
* Data emitter expression
* @default `null`
*/
expr: Parameters<Traits["data"]["expr"]["validate"]>[0];
/**
*
*/
bind: Parameters<Traits["data"]["bind"]["validate"]>[0];
/**
* Update continuously
* @default `true`
*/
live: Parameters<Traits["data"]["live"]["validate"]>[0];
}
interface GetTraitsBuffer {
channels: ReturnType<Traits["buffer"]["channels"]["validate"]>;
items: ReturnType<Traits["buffer"]["items"]["validate"]>;
fps: ReturnType<Traits["buffer"]["fps"]["validate"]>;
hurry: ReturnType<Traits["buffer"]["hurry"]["validate"]>;
limit: ReturnType<Traits["buffer"]["limit"]["validate"]>;
realtime: ReturnType<Traits["buffer"]["realtime"]["validate"]>;
observe: ReturnType<Traits["buffer"]["observe"]["validate"]>;
aligned: ReturnType<Traits["buffer"]["aligned"]["validate"]>;
}
interface SetTraitsBuffer {
/**
* Number of channels
* @default `4`
*/
channels: Parameters<Traits["buffer"]["channels"]["validate"]>[0];
/**
* Number of items
* @default `4`
*/
items: Parameters<Traits["buffer"]["items"]["validate"]>[0];
/**
* Frames-per-second update rate
* @default `null`
* @example `60`
*/
fps: Parameters<Traits["buffer"]["fps"]["validate"]>[0];
/**
* Maximum frames to hurry per frame
* @default `5`
*/
hurry: Parameters<Traits["buffer"]["hurry"]["validate"]>[0];
/**
* Maximum frames to track
* @default `60`
*/
limit: Parameters<Traits["buffer"]["limit"]["validate"]>[0];
/**
* Run on real time, not clock time
* @default `false`
*/
realtime: Parameters<Traits["buffer"]["realtime"]["validate"]>[0];
/**
* Pass clock time to data
* @default `false`
*/
observe: Parameters<Traits["buffer"]["observe"]["validate"]>[0];
/**
* Use (fast) integer lookups
* @default `false`
*/
aligned: Parameters<Traits["buffer"]["aligned"]["validate"]>[0];
}
interface GetTraitsSampler {
centered: ReturnType<Traits["sampler"]["centered"]["validate"]>;
padding: ReturnType<Traits["sampler"]["padding"]["validate"]>;
}
interface SetTraitsSampler {
/**
* Centered instead of corner sampling
* @default `false`
*/
centered: Parameters<Traits["sampler"]["centered"]["validate"]>[0];
/**
* Number of samples padding
* @default `0`
*/
padding: Parameters<Traits["sampler"]["padding"]["validate"]>[0];
}
interface GetTraitsArray {
width: ReturnType<Traits["array"]["width"]["validate"]>;
bufferWidth: ReturnType<Traits["array"]["bufferWidth"]["validate"]>;
history: ReturnType<Traits["array"]["history"]["validate"]>;
}
interface SetTraitsArray {
/**
* Array width
* @default `1`
*/
width: Parameters<Traits["array"]["width"]["validate"]>[0];
/**
* Array buffer width
* @default `1`
*/
bufferWidth: Parameters<Traits["array"]["bufferWidth"]["validate"]>[0];
/**
* Array history
* @default `1`
*/
history: Parameters<Traits["array"]["history"]["validate"]>[0];
}
interface GetTraitsMatrix {
width: ReturnType<Traits["matrix"]["width"]["validate"]>;
height: ReturnType<Traits["matrix"]["height"]["validate"]>;
history: ReturnType<Traits["matrix"]["history"]["validate"]>;
bufferWidth: ReturnType<Traits["matrix"]["bufferWidth"]["validate"]>;
bufferHeight: ReturnType<Traits["matrix"]["bufferHeight"]["validate"]>;
}
interface SetTraitsMatrix {
/**
* Matrix width
* @default `1`
*/
width: Parameters<Traits["matrix"]["width"]["validate"]>[0];
/**
* Matrix height
* @default `1`
*/
height: Parameters<Traits["matrix"]["height"]["validate"]>[0];
/**
* Matrix history
* @default `1`
*/
history: Parameters<Traits["matrix"]["history"]["validate"]>[0];
/**
* Matrix buffer width
* @default `1`
*/
bufferWidth: Parameters<Traits["matrix"]["bufferWidth"]["validate"]>[0];
/**
* Matrix buffer height
* @default `1`
*/
bufferHeight: Parameters<Traits["matrix"]["bufferHeight"]["validate"]>[0];
}
interface GetTraitsVoxel {
width: ReturnType<Traits["voxel"]["width"]["validate"]>;
height: ReturnType<Traits["voxel"]["height"]["validate"]>;
depth: ReturnType<Traits["voxel"]["depth"]["validate"]>;
bufferWidth: ReturnType<Traits["voxel"]["bufferWidth"]["validate"]>;
bufferHeight: ReturnType<Traits["voxel"]["bufferHeight"]["validate"]>;
bufferDepth: ReturnType<Traits["voxel"]["bufferDepth"]["validate"]>;
}
interface SetTraitsVoxel {
/**
* Voxel width
* @default `1`
*/
width: Parameters<Traits["voxel"]["width"]["validate"]>[0];
/**
* Voxel height
* @default `1`
*/
height: Parameters<Traits["voxel"]["height"]["validate"]>[0];
/**
* Voxel depth
* @default `1`
*/
depth: Parameters<Traits["voxel"]["depth"]["validate"]>[0];
/**
* Voxel buffer width
* @default `1`
*/
bufferWidth: Parameters<Traits["voxel"]["bufferWidth"]["validate"]>[0];
/**
* Voxel buffer height
* @default `1`
*/
bufferHeight: Parameters<Traits["voxel"]["bufferHeight"]["validate"]>[0];
/**
* Voxel buffer depth
* @default `1`
*/
bufferDepth: Parameters<Traits["voxel"]["bufferDepth"]["validate"]>[0];
}
interface GetTraitsStyle {
opacity: ReturnType<Traits["style"]["opacity"]["validate"]>;
color: ReturnType<Traits["style"]["color"]["validate"]>;
blending: ReturnType<Traits["style"]["blending"]["validate"]>;
zWrite: ReturnType<Traits["style"]["zWrite"]["validate"]>;
zTest: ReturnType<Traits["style"]["zTest"]["validate"]>;
zIndex: ReturnType<Traits["style"]["zIndex"]["validate"]>;
zBias: ReturnType<Traits["style"]["zBias"]["validate"]>;
zOrder: ReturnType<Traits["style"]["zOrder"]["validate"]>;
}
interface SetTraitsStyle {
/**
* Opacity
* @default `1`
*/
opacity: Parameters<Traits["style"]["opacity"]["validate"]>[0];
/**
* Color
* @default `"rgb(128, 128, 128)"`
*/
color: Parameters<Traits["style"]["color"]["validate"]>[0];
/**
* Blending mode ('no, normal, add, subtract, multiply)
* @default `"normal"`
*/
blending: Parameters<Traits["style"]["blending"]["validate"]>[0];
/**
* Write Z buffer
* @default `true`
*/
zWrite: Parameters<Traits["style"]["zWrite"]["validate"]>[0];
/**
* Test Z buffer
* @default `true`
*/
zTest: Parameters<Traits["style"]["zTest"]["validate"]>[0];
/**
* Z-Index (2D stacking)
* @default `0`
*/
zIndex: Parameters<Traits["style"]["zIndex"]["validate"]>[0];
/**
* Z-Bias (3D stacking)
* @default `0`
*/
zBias: Parameters<Traits["style"]["zBias"]["validate"]>[0];
/**
* Z-Order (drawing order)
* @default `null`
* @example `2`
*/
zOrder: Parameters<Traits["style"]["zOrder"]["validate"]>[0];
}
interface GetTraitsGeometry {
points: ReturnType<Traits["geometry"]["points"]["validate"]>;
colors: ReturnType<Traits["geometry"]["colors"]["validate"]>;
}
interface SetTraitsGeometry {
/**
* Points data source
* @default `<`
*/
points: Parameters<Traits["geometry"]["points"]["validate"]>[0];
/**
* Colors data source
* @default `null`
* @example `"#colors"`
*/
colors: Parameters<Traits["geometry"]["colors"]["validate"]>[0];
}
interface GetTraitsPoint {
size: ReturnType<Traits["point"]["size"]["validate"]>;
sizes: ReturnType<Traits["point"]["sizes"]["validate"]>;
shape: ReturnType<Traits["point"]["shape"]["validate"]>;
optical: ReturnType<Traits["point"]["optical"]["validate"]>;
fill: ReturnType<Traits["point"]["fill"]["validate"]>;
depth: ReturnType<Traits["point"]["depth"]["validate"]>;
}
interface SetTraitsPoint {
/**
* Point size
* @default `4`
*/
size: Parameters<Traits["point"]["size"]["validate"]>[0];
/**
* Point sizes data source
* @default `null`
* @example `"#sizes"`
*/
sizes: Parameters<Traits["point"]["sizes"]["validate"]>[0];
/**
* Point shape (circle, square, diamond, up, down, left, right)
* @default `"circle"`
*/
shape: Parameters<Traits["point"]["shape"]["validate"]>[0];
/**
* Optical or exact sizing
* @default `true`
*/
optical: Parameters<Traits["point"]["optical"]["validate"]>[0];
/**
* Fill shape
* @default `true`
*/
fill: Parameters<Traits["point"]["fill"]["validate"]>[0];
/**
* Depth scaling
* @default `1`
*/
depth: Parameters<Traits["point"]["depth"]["validate"]>[0];
}
interface GetTraitsLine {
width: ReturnType<Traits["line"]["width"]["validate"]>;
depth: ReturnType<Traits["line"]["depth"]["validate"]>;
join: ReturnType<Traits["line"]["join"]["validate"]>;
stroke: ReturnType<Traits["line"]["stroke"]["validate"]>;
proximity: ReturnType<Traits["line"]["proximity"]["validate"]>;
closed: ReturnType<Traits["line"]["closed"]["validate"]>;
}
interface SetTraitsLine {
/**
* Line width
* @default `2`
*/
width: Parameters<Traits["line"]["width"]["validate"]>[0];
/**
* Depth scaling
* @default `1`
*/
depth: Parameters<Traits["line"]["depth"]["validate"]>[0];
/**
*
*/
join: Parameters<Traits["line"]["join"]["validate"]>[0];
/**
* Line stroke (solid, dotted, dashed)
* @default `"solid"`
*/
stroke: Parameters<Traits["line"]["stroke"]["validate"]>[0];
/**
* Proximity threshold
* @default `null`
* @example `10`
*/
proximity: Parameters<Traits["line"]["proximity"]["validate"]>[0];
/**
* Close line
* @default `false`
*/
closed: Parameters<Traits["line"]["closed"]["validate"]>[0];
}
interface GetTraitsMesh {
fill: ReturnType<Traits["mesh"]["fill"]["validate"]>;
shaded: ReturnType<Traits["mesh"]["shaded"]["validate"]>;
map: ReturnType<Traits["mesh"]["map"]["validate"]>;
lineBias: ReturnType<Traits["mesh"]["lineBias"]["validate"]>;
}
interface SetTraitsMesh {
/**
* Fill mesh
* @default `true`
*/
fill: Parameters<Traits["mesh"]["fill"]["validate"]>[0];
/**
* Shade mesh
* @default `false`
*/
shaded: Parameters<Traits["mesh"]["shaded"]["validate"]>[0];
/**
* Texture map source
* @default `null`
* @example `"#map"`
*/
map: Parameters<Traits["mesh"]["map"]["validate"]>[0];
/**
* Z-Bias for lines on fill
* @default `5`
*/
lineBias: Parameters<Traits["mesh"]["lineBias"]["validate"]>[0];
}
interface GetTraitsStrip {
line: ReturnType<Traits["strip"]["line"]["validate"]>;
}
interface SetTraitsStrip {
/**
* Draw line
* @default `false`
*/
line: Parameters<Traits["strip"]["line"]["validate"]>[0];
}
interface GetTraitsFace {
line: ReturnType<Traits["face"]["line"]["validate"]>;
}
interface SetTraitsFace {
/**
* Draw line
* @default `false`
*/
line: Parameters<Traits["face"]["line"]["validate"]>[0];
}
interface GetTraitsArrow {
size: ReturnType<Traits["arrow"]["size"]["validate"]>;
start: ReturnType<Traits["arrow"]["start"]["validate"]>;
end: ReturnType<Traits["arrow"]["end"]["validate"]>;
}
interface SetTraitsArrow {
/**
* Arrow size
* @default `3`
*/
size: Parameters<Traits["arrow"]["size"]["validate"]>[0];
/**
* Draw start arrow
* @default `true`
*/
start: Parameters<Traits["arrow"]["start"]["validate"]>[0];
/**
* Draw end arrow
* @default `true`
*/
end: Parameters<Traits["arrow"]["end"]["validate"]>[0];
}
interface GetTraitsTicks {
normal: ReturnType<Traits["ticks"]["normal"]["validate"]>;
size: ReturnType<Traits["ticks"]["size"]["validate"]>;
epsilon: ReturnType<Traits["ticks"]["epsilon"]["validate"]>;
}
interface SetTraitsTicks {
/**
* Normal for reference plane
* @default `true`
*/
normal: Parameters<Traits["ticks"]["normal"]["validate"]>[0];
/**
* Tick size
* @default `10`
*/
size: Parameters<Traits["ticks"]["size"]["validate"]>[0];
/**
* Tick epsilon
* @default `0.0001`
*/
epsilon: Parameters<Traits["ticks"]["epsilon"]["validate"]>[0];
}
interface GetTraitsAttach {
offset: ReturnType<Traits["attach"]["offset"]["validate"]>;
snap: ReturnType<Traits["attach"]["snap"]["validate"]>;
depth: ReturnType<Traits["attach"]["depth"]["validate"]>;
}
interface SetTraitsAttach {
/**
* 2D offset
* @default `[0, -20]`
*/
offset: Parameters<Traits["attach"]["offset"]["validate"]>[0];
/**
* Snap to pixel
* @default `false`
*/
snap: Parameters<Traits["attach"]["snap"]["validate"]>[0];
/**
* Depth scaling
* @default `0`
*/
depth: Parameters<Traits["attach"]["depth"]["validate"]>[0];
}
interface GetTraitsFormat {
digits: ReturnType<Traits["format"]["digits"]["validate"]>;
data: ReturnType<Traits["format"]["data"]["validate"]>;
expr: ReturnType<Traits["format"]["expr"]["validate"]>;
live: ReturnType<Traits["format"]["live"]["validate"]>;
}
interface SetTraitsFormat {
/**
* Digits of precision
* @default `null`
* @example `2`
*/
digits: Parameters<Traits["format"]["digits"]["validate"]>[0];
/**
* Array of labels
* @default `null`
* @example `["Grumpy", "Sleepy", "Sneezy"]`
*/
data: Parameters<Traits["format"]["data"]["validate"]>[0];
/**
* Label formatter expression
* @default `null`
*/
expr: Parameters<Traits["format"]["expr"]["validate"]>[0];
/**
* Update continuously
* @default `true`
*/
live: Parameters<Traits["format"]["live"]["validate"]>[0];
}
interface GetTraitsFont {
font: ReturnType<Traits["font"]["font"]["validate"]>;
style: ReturnType<Traits["font"]["style"]["validate"]>;
variant: ReturnType<Traits["font"]["variant"]["validate"]>;
weight: ReturnType<Traits["font"]["weight"]["validate"]>;
detail: ReturnType<Traits["font"]["detail"]["validate"]>;
sdf: ReturnType<Traits["font"]["sdf"]["validate"]>;
}
interface SetTraitsFont {
/**
* Font family
* @default `"sans-serif"`
*/
font: Parameters<Traits["font"]["font"]["validate"]>[0];
/**
* Font style
* @default `""`
* @example `"italic"`
*/
style: Parameters<Traits["font"]["style"]["validate"]>[0];
/**
* Font variant
* @default `""`
* @example `"small-caps"`
*/
variant: Parameters<Traits["font"]["variant"]["validate"]>[0];
/**
* Font weight
* @default `""`
* @example `"bold"`
*/
weight: Parameters<Traits["font"]["weight"]["validate"]>[0];
/**
* Font detail
* @default `24`
*/
detail: Parameters<Traits["font"]["detail"]["validate"]>[0];
/**
* Signed distance field range
* @default `5`
*/
sdf: Parameters<Traits["font"]["sdf"]["validate"]>[0];
}
interface GetTraitsLabel {
text: ReturnType<Traits["label"]["text"]["validate"]>;
size: ReturnType<Traits["label"]["size"]["validate"]>;
outline: ReturnType<Traits["label"]["outline"]["validate"]>;
expand: ReturnType<Traits["label"]["expand"]["validate"]>;
background: ReturnType<Traits["label"]["background"]["validate"]>;
}
interface SetTraitsLabel {
/**
* Text source
* @default `"<"`
*/
text: Parameters<Traits["label"]["text"]["validate"]>[0];
/**
* Text size
* @default `16`
*/
size: Parameters<Traits["label"]["size"]["validate"]>[0];
/**
* Outline size
* @default `2`
*/
outline: Parameters<Traits["label"]["outline"]["validate"]>[0];
/**
* Expand glyphs
* @default `0`
*/
expand: Parameters<Traits["label"]["expand"]["validate"]>[0];
/**
* Outline background
* @default `"rgb(255, 255, 255)"`
*/
background: Parameters<Traits["label"]["background"]["validate"]>[0];
}
interface GetTraitsOverlay {
opacity: ReturnType<Traits["overlay"]["opacity"]["validate"]>;
zIndex: ReturnType<Traits["overlay"]["zIndex"]["validate"]>;
}
interface SetTraitsOverlay {
/**
* Opacity
* @default `1`
*/
opacity: Parameters<Traits["overlay"]["opacity"]["validate"]>[0];
/**
* Z-Index (2D stacking)
* @default `0`
*/
zIndex: Parameters<Traits["overlay"]["zIndex"]["validate"]>[0];
}
interface GetTraitsDom {
points: ReturnType<Traits["dom"]["points"]["validate"]>;
html: ReturnType<Traits["dom"]["html"]["validate"]>;
size: ReturnType<Traits["dom"]["size"]["validate"]>;
outline: ReturnType<Traits["dom"]["outline"]["validate"]>;
zoom: ReturnType<Traits["dom"]["zoom"]["validate"]>;
color: ReturnType<Traits["dom"]["color"]["validate"]>;
attributes: ReturnType<Traits["dom"]["attributes"]["validate"]>;
pointerEvents: ReturnType<Traits["dom"]["pointerEvents"]["validate"]>;
}
interface SetTraitsDom {
/**
* Points data source
* @default `"<"`
*/
points: Parameters<Traits["dom"]["points"]["validate"]>[0];
/**
* HTML data source
* @default `"<"`
*/
html: Parameters<Traits["dom"]["html"]["validate"]>[0];
/**
* Text size
* @default `16`
*/
size: Parameters<Traits["dom"]["size"]["validate"]>[0];
/**
* Outline size
* @default `2`
*/
outline: Parameters<Traits["dom"]["outline"]["validate"]>[0];
/**
* HTML zoom
* @default `1`
*/
zoom: Parameters<Traits["dom"]["zoom"]["validate"]>[0];
/**
* Color
* @default `"rgb(255, 255, 255)"`
*/
color: Parameters<Traits["dom"]["color"]["validate"]>[0];
/**
* HTML attributes
* @default `null`
* @example `{"style": {"color": "red"}}`
*/
attributes: Parameters<Traits["dom"]["attributes"]["validate"]>[0];
/**
* Allow pointer events
* @default `false`
*/
pointerEvents: Parameters<Traits["dom"]["pointerEvents"]["validate"]>[0];
}
interface GetTraitsTexture {
minFilter: ReturnType<Traits["texture"]["minFilter"]["validate"]>;
magFilter: ReturnType<Traits["texture"]["magFilter"]["validate"]>;
type: ReturnType<Traits["texture"]["type"]["validate"]>;
}
interface SetTraitsTexture {
/**
* Texture minification filtering
* @default `"nearest"`
*/
minFilter: Parameters<Traits["texture"]["minFilter"]["validate"]>[0];
/**
* Texture magnification filtering
* @default `"nearest"`
*/
magFilter: Parameters<Traits["texture"]["magFilter"]["validate"]>[0];
/**
* Texture data type
* @default `"float"`
*/
type: Parameters<Traits["texture"]["type"]["validate"]>[0];
}
interface GetTraitsShader {
sources: ReturnType<Traits["shader"]["sources"]["validate"]>;
language: ReturnType<Traits["shader"]["language"]["validate"]>;
code: ReturnType<Traits["shader"]["code"]["validate"]>;
uniforms: ReturnType<Traits["shader"]["uniforms"]["validate"]>;
}
interface SetTraitsShader {
/**
* Sampler sources
* @default `null`
* @example `["#pressure", "#divergence"]`
*/
sources: Parameters<Traits["shader"]["sources"]["validate"]>[0];
/**
* Shader language
* @default `"glsl"`
*/
language: Parameters<Traits["shader"]["language"]["validate"]>[0];
/**
* Shader code
* @default `""`
*/
code: Parameters<Traits["shader"]["code"]["validate"]>[0];
/**
* Shader uniform objects (three.js style)
* @default `null`
* @example `{ time: { type: 'f', value: 3 }}`
*/
uniforms: Parameters<Traits["shader"]["uniforms"]["validate"]>[0];
}
interface GetTraitsInclude {
shader: ReturnType<Traits["include"]["shader"]["validate"]>;
}
interface SetTraitsInclude {
/**
* Shader to use
* @default `"<"`
*/
shader: Parameters<Traits["include"]["shader"]["validate"]>[0];
}
interface GetTraitsOperator {
source: ReturnType<Traits["operator"]["source"]["validate"]>;
}
interface SetTraitsOperator {
/**
* Input source
* @default `"<"`
*/
source: Parameters<Traits["operator"]["source"]["validate"]>[0];
}
interface GetTraitsSpread {
unit: ReturnType<Traits["spread"]["unit"]["validate"]>;
items: ReturnType<Traits["spread"]["items"]["validate"]>;
width: ReturnType<Traits["spread"]["width"]["validate"]>;
height: ReturnType<Traits["spread"]["height"]["validate"]>;
depth: ReturnType<Traits["spread"]["depth"]["validate"]>;
alignItems: ReturnType<Traits["spread"]["alignItems"]["validate"]>;
alignWidth: ReturnType<Traits["spread"]["alignWidth"]["validate"]>;
alignHeight: ReturnType<Traits["spread"]["alignHeight"]["validate"]>;
alignDepth: ReturnType<Traits["spread"]["alignDepth"]["validate"]>;
}
interface SetTraitsSpread {
/**
* Spread per item (absolute) or array (relative)
* @default `"relative"`
*/
unit: Parameters<Traits["spread"]["unit"]["validate"]>[0];
/**
* Items offset
* @default `null`
* @example `[1.5, 0, 0, 0]`
*/
items: Parameters<Traits["spread"]["items"]["validate"]>[0];
/**
* Width offset
* @default `null`
* @example `[1.5, 0, 0, 0]`
*/
width: Parameters<Traits["spread"]["width"]["validate"]>[0];
/**
* Height offset
* @default `null`
* @example `[1.5, 0, 0, 0]`
*/
height: Parameters<Traits["spread"]["height"]["validate"]>[0];
/**
* Depth offset
* @default `null`
* @example `[1.5, 0, 0, 0]`
*/
depth: Parameters<Traits["spread"]["depth"]["validate"]>[0];
/**
* Items alignment
* @default `0`
*/
alignItems: Parameters<Traits["spread"]["alignItems"]["validate"]>[0];
/**
* Width alignment
* @default `0`
*/
alignWidth: Parameters<Traits["spread"]["alignWidth"]["validate"]>[0];
/**
* Height alignment
* @default `0`
*/
alignHeight: Parameters<Traits["spread"]["alignHeight"]["validate"]>[0];
/**
* Depth alignment
* @default `0`
*/
alignDepth: Parameters<Traits["spread"]["alignDepth"]["validate"]>[0];
}
interface GetTraitsGrow {
scale: ReturnType<Traits["grow"]["scale"]["validate"]>;
items: ReturnType<Traits["grow"]["items"]["validate"]>;
width: ReturnType<Traits["grow"]["width"]["validate"]>;
height: ReturnType<Traits["grow"]["height"]["validate"]>;
depth: ReturnType<Traits["grow"]["depth"]["validate"]>;
}
interface SetTraitsGrow {
/**
* Scale factor
* @default `1`
*/
scale: Parameters<Traits["grow"]["scale"]["validate"]>[0];
/**
* Items alignment
* @default `null`
* @example `0`
*/
items: Parameters<Traits["grow"]["items"]["validate"]>[0];
/**
* Width alignment
* @default `null`
* @example `0`
*/
width: Parameters<Traits["grow"]["width"]["validate"]>[0];
/**
* Height alignment
* @default `null`
* @example `0`
*/
height: Parameters<Traits["grow"]["height"]["validate"]>[0];
/**
* Depth alignment
* @default `null`
* @example `0`
*/
depth: Parameters<Traits["grow"]["depth"]["validate"]>[0];
}
interface GetTraitsSplit {
order: ReturnType<Traits["split"]["order"]["validate"]>;
axis: ReturnType<Traits["split"]["axis"]["validate"]>;
length: ReturnType<Traits["split"]["length"]["validate"]>;
overlap: ReturnType<Traits["split"]["overlap"]["validate"]>;
}
interface SetTraitsSplit {
/**
* Axis order
* @default `"wxyz"`
*/
order: Parameters<Traits["split"]["order"]["validate"]>[0];
/**
* Axis to split
* @default `null`
* @example `x`
*/
axis: Parameters<Traits["split"]["axis"]["validate"]>[0];
/**
* Tuple length
* @default `1`
*/
length: Parameters<Traits["split"]["length"]["validate"]>[0];
/**
* Tuple overlap
* @default `1`
*/
overlap: Parameters<Traits["split"]["overlap"]["validate"]>[0];
}
interface GetTraitsJoin {
order: ReturnType<Traits["join"]["order"]["validate"]>;
axis: ReturnType<Traits["join"]["axis"]["validate"]>;
overlap: ReturnType<Traits["join"]["overlap"]["validate"]>;
}
interface SetTraitsJoin {
/**
* Axis order
* @default `"wxyz"`
*/
order: Parameters<Traits["join"]["order"]["validate"]>[0];
/**
* Axis to join
* @default `null`
* @example `x`
*/
axis: Parameters<Traits["join"]["axis"]["validate"]>[0];
/**
* Tuple overlap
* @default `1`
*/
overlap: Parameters<Traits["join"]["overlap"]["validate"]>[0];
}
interface GetTraitsSwizzle {
order: ReturnType<Traits["swizzle"]["order"]["validate"]>;
}
interface SetTraitsSwizzle {
/**
* Swizzle order
* @default `xyzw`
*/
order: Parameters<Traits["swizzle"]["order"]["validate"]>[0];
}
interface GetTraitsTranspose {
order: ReturnType<Traits["transpose"]["order"]["validate"]>;
}
interface SetTraitsTranspose {
/**
* Transpose order
* @default `xyzw`
*/
order: Parameters<Traits["transpose"]["order"]["validate"]>[0];
}
interface GetTraitsRepeat {
items: ReturnType<Traits["repeat"]["items"]["validate"]>;
width: ReturnType<Traits["repeat"]["width"]["validate"]>;
height: ReturnType<Traits["repeat"]["height"]["validate"]>;
depth: ReturnType<Traits["repeat"]["depth"]["validate"]>;
}
interface SetTraitsRepeat {
/**
* Repeat items
* @default `1`
*/
items: Parameters<Traits["repeat"]["items"]["validate"]>[0];
/**
* Repeat width
* @default `1`
*/
width: Parameters<Traits["repeat"]["width"]["validate"]>[0];
/**
* Repeat height
* @default `1`
*/
height: Parameters<Traits["repeat"]["height"]["validate"]>[0];
/**
* Repeat depth
* @default `1`
*/
depth: Parameters<Traits["repeat"]["depth"]["validate"]>[0];
}
interface GetTraitsSlice {
items: ReturnType<Traits["slice"]["items"]["validate"]>;
width: ReturnType<Traits["slice"]["width"]["validate"]>;
height: ReturnType<Traits["slice"]["height"]["validate"]>;
depth: ReturnType<Traits["slice"]["depth"]["validate"]>;
}
interface SetTraitsSlice {
/**
* Slice from, to items (excluding to)
* @default `null`
* @example `[2, 4]`
*/
items: Parameters<Traits["slice"]["items"]["validate"]>[0];
/**
* Slice from, to width (excluding to)
* @default `null`
* @example `[2, 4]`
*/
width: Parameters<Traits["slice"]["width"]["validate"]>[0];
/**
* Slice from, to height (excluding to)
* @default `null`
* @example `[2, 4]`
*/
height: Parameters<Traits["slice"]["height"]["validate"]>[0];
/**
* Slice from, to depth (excluding to)
* @default `null`
* @example `[2, 4]`
*/
depth: Parameters<Traits["slice"]["depth"]["validate"]>[0];
}
interface GetTraitsLerp {
size: ReturnType<Traits["lerp"]["size"]["validate"]>;
items: ReturnType<Traits["lerp"]["items"]["validate"]>;
width: ReturnType<Traits["lerp"]["width"]["validate"]>;
height: ReturnType<Traits["lerp"]["height"]["validate"]>;
depth: ReturnType<Traits["lerp"]["depth"]["validate"]>;
}
interface SetTraitsLerp {
/**
* Scaling mode (relative, absolute)
* @default `"absolute"`
*/
size: Parameters<Traits["lerp"]["size"]["validate"]>[0];
/**
* Lerp to items
* @default `null`
* @example `5`
*/
items: Parameters<Traits["lerp"]["items"]["validate"]>[0];
/**
* Lerp to width
* @default `null`
* @example `5`
*/
width: Parameters<Traits["lerp"]["width"]["validate"]>[0];
/**
* Lerp to height
* @default `null`
* @example `5`
*/
height: Parameters<Traits["lerp"]["height"]["validate"]>[0];
/**
* Lerp to depth
* @default `null`
* @example `5`
*/
depth: Parameters<Traits["lerp"]["depth"]["validate"]>[0];
}
interface GetTraitsSubdivide {
items: ReturnType<Traits["subdivide"]["items"]["validate"]>;
width: ReturnType<Traits["subdivide"]["width"]["validate"]>;
height: ReturnType<Traits["subdivide"]["height"]["validate"]>;
depth: ReturnType<Traits["subdivide"]["depth"]["validate"]>;
bevel: ReturnType<Traits["subdivide"]["bevel"]["validate"]>;
lerp: ReturnType<Traits["subdivide"]["lerp"]["validate"]>;
}
interface SetTraitsSubdivide {
/**
* Divisions of items
* @default `null`
* @example `5`
*/
items: Parameters<Traits["subdivide"]["items"]["validate"]>[0];
/**
* Divisions of width
* @default `null`
* @example `5`
*/
width: Parameters<Traits["subdivide"]["width"]["validate"]>[0];
/**
* Divisions of height
* @default `null`
* @example `5`
*/
height: Parameters<Traits["subdivide"]["height"]["validate"]>[0];
/**
* Divisions of depth
* @default `null`
* @example `5`
*/
depth: Parameters<Traits["subdivide"]["depth"]["validate"]>[0];
/**
* Fraction to end outward from vertices
* @default `1`
*/
bevel: Parameters<Traits["subdivide"]["bevel"]["validate"]>[0];
/**
* Interpolate values with computed indices
* @default `true`
*/
lerp: Parameters<Traits["subdivide"]["lerp"]["validate"]>[0];
}
interface GetTraitsResample {
indices: ReturnType<Traits["resample"]["indices"]["validate"]>;
channels: ReturnType<Traits["resample"]["channels"]["validate"]>;
sample: ReturnType<Traits["resample"]["sample"]["validate"]>;
size: ReturnType<Traits["resample"]["size"]["validate"]>;
items: ReturnType<Traits["resample"]["items"]["validate"]>;
width: ReturnType<Traits["resample"]["width"]["validate"]>;
height: ReturnType<Traits["resample"]["height"]["validate"]>;
depth: ReturnType<Traits["resample"]["depth"]["validate"]>;
}
interface SetTraitsResample {
/**
* Resample indices
* @default `4`
*/
indices: Parameters<Traits["resample"]["indices"]["validate"]>[0];
/**
* Resample channels
* @default `4`
*/
channels: Parameters<Traits["resample"]["channels"]["validate"]>[0];
/**
* Source sampling (relative, absolute)
* @default `"relative"`
*/
sample: Parameters<Traits["resample"]["sample"]["validate"]>[0];
/**
* Scaling mode (relative, absolute)
* @default `"absolute"`
*/
size: Parameters<Traits["resample"]["size"]["validate"]>[0];
/**
* Resample factor items
* @default `null`
* @example `10`
*/
items: Parameters<Traits["resample"]["items"]["validate"]>[0];
/**
* Resample factor width
* @default `null`
* @example `10`
*/
width: Parameters<Traits["resample"]["width"]["validate"]>[0];
/**
* Resample factor height
* @default `null`
* @example `10`
*/
height: Parameters<Traits["resample"]["height"]["validate"]>[0];
/**
* Resample factor depth
* @default `null`
* @example `10`
*/
depth: Parameters<Traits["resample"]["depth"]["validate"]>[0];
}
interface GetTraitsReadback {
type: ReturnType<Traits["readback"]["type"]["validate"]>;
expr: ReturnType<Traits["readback"]["expr"]["validate"]>;
data: ReturnType<Traits["readback"]["data"]["validate"]>;
channels: ReturnType<Traits["readback"]["channels"]["validate"]>;
items: ReturnType<Traits["readback"]["items"]["validate"]>;
width: ReturnType<Traits["readback"]["width"]["validate"]>;
height: ReturnType<Traits["readback"]["height"]["validate"]>;
depth: ReturnType<Traits["readback"]["depth"]["validate"]>;
}
interface SetTraitsReadback {
/**
* Readback data type (float, unsignedByte)
* @default `"float"`
*/
type: Parameters<Traits["readback"]["type"]["validate"]>[0];
/**
* Readback consume expression
* @default `null`
*/
expr: Parameters<Traits["readback"]["expr"]["validate"]>[0];
/**
* Readback data buffer (read only)
* @default `[]`
*/
data: Parameters<Traits["readback"]["data"]["validate"]>[0];
/**
* Readback channels (read only)
* @default `4`
*/
channels: Parameters<Traits["readback"]["channels"]["validate"]>[0];
/**
* Readback items (read only)
* @default `1`
*/
items: Parameters<Traits["readback"]["items"]["validate"]>[0];
/**
* Readback width (read only)
* @default `1`
*/
width: Parameters<Traits["readback"]["width"]["validate"]>[0];
/**
* Readback height (read only)
* @default `1`
*/
height: Parameters<Traits["readback"]["height"]["validate"]>[0];
/**
* Readback depth (read only)
* @default `1`
*/
depth: Parameters<Traits["readback"]["depth"]["validate"]>[0];
}
interface GetTraitsRoot {
speed: ReturnType<Traits["root"]["speed"]["validate"]>;
camera: ReturnType<Traits["root"]["camera"]["validate"]>;
}
interface SetTraitsRoot {
/**
* Global speed
* @default `1`
*/
speed: Parameters<Traits["root"]["speed"]["validate"]>[0];
/**
* Active camera
* @default `"[camera]"`
*/
camera: Parameters<Traits["root"]["camera"]["validate"]>[0];
}
interface GetTraitsRtt {
size: ReturnType<Traits["rtt"]["size"]["validate"]>;
width: ReturnType<Traits["rtt"]["width"]["validate"]>;
height: ReturnType<Traits["rtt"]["height"]["validate"]>;
history: ReturnType<Traits["rtt"]["history"]["validate"]>;
}
interface SetTraitsRtt {
/**
*
*/
size: Parameters<Traits["rtt"]["size"]["validate"]>[0];
/**
* RTT width
* @default `null`
* @example `640`
*/
width: Parameters<Traits["rtt"]["width"]["validate"]>[0];
/**
* RTT height
* @default `null`
* @example `360`
*/
height: Parameters<Traits["rtt"]["height"]["validate"]>[0];
/**
* RTT history
* @default `1`
*/
history: Parameters<Traits["rtt"]["history"]["validate"]>[0];
}
interface GetTraitsCompose {
alpha: ReturnType<Traits["compose"]["alpha"]["validate"]>;
}
interface SetTraitsCompose {
/**
* Compose with alpha transparency
* @default `false`
*/
alpha: Parameters<Traits["compose"]["alpha"]["validate"]>[0];
}
interface GetTraitsPresent {
index: ReturnType<Traits["present"]["index"]["validate"]>;
directed: ReturnType<Traits["present"]["directed"]["validate"]>;
length: ReturnType<Traits["present"]["length"]["validate"]>;
}
interface SetTraitsPresent {
/**
* Present slide number
* @default `1`
*/
index: Parameters<Traits["present"]["index"]["validate"]>[0];
/**
* Apply directional transitions
* @default `true`
*/
directed: Parameters<Traits["present"]["directed"]["validate"]>[0];
/**
* Presentation length (computed)
* @default `0`
*/
length: Parameters<Traits["present"]["length"]["validate"]>[0];
}
interface GetTraitsSlide {
order: ReturnType<Traits["slide"]["order"]["validate"]>;
steps: ReturnType<Traits["slide"]["steps"]["validate"]>;
early: ReturnType<Traits["slide"]["early"]["validate"]>;
late: ReturnType<Traits["slide"]["late"]["validate"]>;
from: ReturnType<Traits["slide"]["from"]["validate"]>;
to: ReturnType<Traits["slide"]["to"]["validate"]>;
}
interface SetTraitsSlide {
/**
* Slide order
* @default `0`
*/
order: Parameters<Traits["slide"]["order"]["validate"]>[0];
/**
* Slide steps
* @default `1`
*/
steps: Parameters<Traits["slide"]["steps"]["validate"]>[0];
/**
* Appear early steps
* @default `0`
*/
early: Parameters<Traits["slide"]["early"]["validate"]>[0];
/**
* Stay late steps
* @default `0`
*/
late: Parameters<Traits["slide"]["late"]["validate"]>[0];
/**
* Appear from step
* @default `null`
* @example `2`
*/
from: Parameters<Traits["slide"]["from"]["validate"]>[0];
/**
* Disappear on step
* @default `null`
* @example `4`
*/
to: Parameters<Traits["slide"]["to"]["validate"]>[0];
}
interface GetTraitsTransition {
stagger: ReturnType<Traits["transition"]["stagger"]["validate"]>;
enter: ReturnType<Traits["transition"]["enter"]["validate"]>;
exit: ReturnType<Traits["transition"]["exit"]["validate"]>;
delay: ReturnType<Traits["transition"]["delay"]["validate"]>;
delayEnter: ReturnType<Traits["transition"]["delayEnter"]["validate"]>;
delayExit: ReturnType<Traits["transition"]["delayExit"]["validate"]>;
duration: ReturnType<Traits["transition"]["duration"]["validate"]>;
durationEnter: ReturnType<Traits["transition"]["durationEnter"]["validate"]>;
durationExit: ReturnType<Traits["transition"]["durationExit"]["validate"]>;
}
interface SetTraitsTransition {
/**
* Stagger dimensions
* @default `[0, 0, 0, 0]`
* @example `[2, 1, 0, 0]`
*/
stagger: Parameters<Traits["transition"]["stagger"]["validate"]>[0];
/**
* Enter state
* @default `null`
* @example `0.5`
*/
enter: Parameters<Traits["transition"]["enter"]["validate"]>[0];
/**
* Exit state
* @default `null`
* @example `0.5`
*/
exit: Parameters<Traits["transition"]["exit"]["validate"]>[0];
/**
* Transition delay
* @default `0`
*/
delay: Parameters<Traits["transition"]["delay"]["validate"]>[0];
/**
* Transition enter delay
* @default `null`
* @example `0.3`
*/
delayEnter: Parameters<Traits["transition"]["delayEnter"]["validate"]>[0];
/**
* Transition exit delay
* @default `null`
* @example `0.3`
*/
delayExit: Parameters<Traits["transition"]["delayExit"]["validate"]>[0];
/**
* Transition duration
* @default `0.3`
*/
duration: Parameters<Traits["transition"]["duration"]["validate"]>[0];
/**
* Transition enter duration
* @default `0.3`
*/
durationEnter: Parameters<Traits["transition"]["durationEnter"]["validate"]>[0];
/**
* Transition exit duration
* @default `0.3`
*/
durationExit: Parameters<Traits["transition"]["durationExit"]["validate"]>[0];
}
interface GetTraitsMove {
from: ReturnType<Traits["move"]["from"]["validate"]>;
to: ReturnType<Traits["move"]["to"]["validate"]>;
}
interface SetTraitsMove {
/**
* Enter from
* @default `[0, 0, 0, 0]`
*/
from: Parameters<Traits["move"]["from"]["validate"]>[0];
/**
* Exit to
* @default `[0, 0, 0, 0]`
*/
to: Parameters<Traits["move"]["to"]["validate"]>[0];
}
interface GetTraitsSeek {
seek: ReturnType<Traits["seek"]["seek"]["validate"]>;
}
interface SetTraitsSeek {
/**
* Seek to time
* @default `null`
* @example `4`
*/
seek: Parameters<Traits["seek"]["seek"]["validate"]>[0];
}
interface GetTraitsTrack {
target: ReturnType<Traits["track"]["target"]["validate"]>;
script: ReturnType<Traits["track"]["script"]["validate"]>;
ease: ReturnType<Traits["track"]["ease"]["validate"]>;
}
interface SetTraitsTrack {
/**
* Animation target
* @default `"<"`
*/
target: Parameters<Traits["track"]["target"]["validate"]>[0];
/**
* Animation script
* @default `{}`
* @example `{ "0": { props: { color: "red" }, expr: { size: function (t) { return Math.sin(t) + 1; }}}, "1": ...}`
*/
script: Parameters<Traits["track"]["script"]["validate"]>[0];
/**
* Animation ease (linear, cosine, binary, hold)
* @default `"cosine"`
*/
ease: Parameters<Traits["track"]["ease"]["validate"]>[0];
}
interface GetTraitsTrigger {
trigger: ReturnType<Traits["trigger"]["trigger"]["validate"]>;
}
interface SetTraitsTrigger {
/**
* Trigger on step
* @default `1`
*/
trigger: Parameters<Traits["trigger"]["trigger"]["validate"]>[0];
}
interface GetTraitsStep {
playback: ReturnType<Traits["step"]["playback"]["validate"]>;
stops: ReturnType<Traits["step"]["stops"]["validate"]>;
delay: ReturnType<Traits["step"]["delay"]["validate"]>;
duration: ReturnType<Traits["step"]["duration"]["validate"]>;
pace: ReturnType<Traits["step"]["pace"]["validate"]>;
speed: ReturnType<Traits["step"]["speed"]["validate"]>;
rewind: ReturnType<Traits["step"]["rewind"]["validate"]>;
skip: ReturnType<Traits["step"]["skip"]["validate"]>;
realtime: ReturnType<Traits["step"]["realtime"]["validate"]>;
}
interface SetTraitsStep {
/**
* Playhead ease (linear, cosine, binary, hold)
* @default `"linear"`
*/
playback: Parameters<Traits["step"]["playback"]["validate"]>[0];
/**
* Playhead stops
* @default `null`
* @example `[0, 1, 3, 5]`
*/
stops: Parameters<Traits["step"]["stops"]["validate"]>[0];
/**
* Step delay
* @default `0`
*/
delay: Parameters<Traits["step"]["delay"]["validate"]>[0];
/**
* Step duration
* @default `0.3`
*/
duration: Parameters<Traits["step"]["duration"]["validate"]>[0];
/**
* Step pace
* @default `0`
*/
pace: Parameters<Traits["step"]["pace"]["validate"]>[0];
/**
* Step speed
* @default `1`
*/
speed: Parameters<Traits["step"]["speed"]["validate"]>[0];
/**
* Step rewind factor
* @default `2`
*/
rewind: Parameters<Traits["step"]["rewind"]["validate"]>[0];
/**
* Speed up through skips
* @default `true`
*/
skip: Parameters<Traits["step"]["skip"]["validate"]>[0];
/**
* Run on real time, not clock time
* @default `false`
*/
realtime: Parameters<Traits["step"]["realtime"]["validate"]>[0];
}
interface GetTraitsPlay {
delay: ReturnType<Traits["play"]["delay"]["validate"]>;
pace: ReturnType<Traits["play"]["pace"]["validate"]>;
speed: ReturnType<Traits["play"]["speed"]["validate"]>;
from: ReturnType<Traits["play"]["from"]["validate"]>;
to: ReturnType<Traits["play"]["to"]["validate"]>;
realtime: ReturnType<Traits["play"]["realtime"]["validate"]>;
loop: ReturnType<Traits["play"]["loop"]["validate"]>;
}
interface SetTraitsPlay {
/**
* Play delay
* @default `0`
*/
delay: Parameters<Traits["play"]["delay"]["validate"]>[0];
/**
* Play pace
* @default `1`
*/
pace: Parameters<Traits["play"]["pace"]["validate"]>[0];
/**
* Play speed
* @default `1`
*/
speed: Parameters<Traits["play"]["speed"]["validate"]>[0];
/**
* Play from
* @default `0`
*/
from: Parameters<Traits["play"]["from"]["validate"]>[0];
/**
* Play until
* @default `Infinity`
*/
to: Parameters<Traits["play"]["to"]["validate"]>[0];
/**
* Run on real time, not clock time
* @default `false`
*/
realtime: Parameters<Traits["play"]["realtime"]["validate"]>[0];
/**
* Loop
* @default `false`
*/
loop: Parameters<Traits["play"]["loop"]["validate"]>[0];
}
interface GetTraitsNow {
now: ReturnType<Traits["now"]["now"]["validate"]>;
seek: ReturnType<Traits["now"]["seek"]["validate"]>;
pace: ReturnType<Traits["now"]["pace"]["validate"]>;
speed: ReturnType<Traits["now"]["speed"]["validate"]>;
}
interface SetTraitsNow {
/**
* Current moment
* @default `null`
* @example `1444094929.619`
*/
now: Parameters<Traits["now"]["now"]["validate"]>[0];
/**
* Seek to time
* @default `null`
*/
seek: Parameters<Traits["now"]["seek"]["validate"]>[0];
/**
* Time pace
* @default `1`
*/
pace: Parameters<Traits["now"]["pace"]["validate"]>[0];
/**
* Time speed
* @default `1`
*/
speed: Parameters<Traits["now"]["speed"]["validate"]>[0];
}
/**
* Normalized properties for {@link MathboxSelection.area | area}.
* @category data
*/
export interface AreaPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsMatrix, GetTraitsTexture, GetTraitsArea {
}
/**
* Properties for {@link MathboxSelection.area | area}.
* @category data
*/
export interface AreaProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsMatrix, SetTraitsTexture, SetTraitsArea {
}
/**
* Normalized properties for {@link MathboxSelection.array | array}.
* @category data
*/
export interface ArrayPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsArray, GetTraitsTexture {
}
/**
* Properties for {@link MathboxSelection.array | array}.
* @category data
*/
export interface ArrayProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsArray, SetTraitsTexture {
}
/**
* Normalized properties for {@link MathboxSelection.axis | axis}.
* @category draw
*/
export interface AxisPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsAxis, GetTraitsSpan, GetTraitsInterval, GetTraitsArrow, GetTraitsOrigin {
}
/**
* Properties for {@link MathboxSelection.axis | axis}.
* @category draw
*/
export interface AxisProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsAxis, SetTraitsSpan, SetTraitsInterval, SetTraitsArrow, SetTraitsOrigin {
}
/**
* Normalized properties for {@link MathboxSelection.camera | camera}.
* @category camera
*/
export interface CameraPropsNormalized extends GetTraitsNode, GetTraitsCamera {
}
/**
* Properties for {@link MathboxSelection.camera | camera}.
* @category camera
*/
export interface CameraProps extends SetTraitsNode, SetTraitsCamera {
}
/**
* Normalized properties for {@link MathboxSelection.cartesian | cartesian}.
* @category view
*/
export interface CartesianPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsView3, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.cartesian | cartesian}.
* @category view
*/
export interface CartesianProps extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsView3, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.cartesian4 | cartesian4}.
* @category view
*/
export interface Cartesian4PropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsView4, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.cartesian4 | cartesian4}.
* @category view
*/
export interface Cartesian4Props extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsView4, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.clamp | clamp}.
* @category operator
*/
export interface ClampPropsNormalized extends GetTraitsNode, GetTraitsOperator {
}
/**
* Properties for {@link MathboxSelection.clamp | clamp}.
* @category operator
*/
export interface ClampProps extends SetTraitsNode, SetTraitsOperator {
}
/**
* Normalized properties for {@link MathboxSelection.clock | clock}.
* @category time
*/
export interface ClockPropsNormalized extends GetTraitsNode, GetTraitsSeek, GetTraitsPlay {
}
/**
* Properties for {@link MathboxSelection.clock | clock}.
* @category time
*/
export interface ClockProps extends SetTraitsNode, SetTraitsSeek, SetTraitsPlay {
}
/**
* Normalized properties for {@link MathboxSelection.compose | compose}.
* @category rtt
*/
export interface ComposePropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsOperator, GetTraitsStyle, GetTraitsCompose {
}
/**
* Properties for {@link MathboxSelection.compose | compose}.
* @category rtt
*/
export interface ComposeProps extends SetTraitsNode, SetTraitsObject, SetTraitsOperator, SetTraitsStyle, SetTraitsCompose {
}
/**
* Normalized properties for {@link MathboxSelection.dom | dom}.
* @category overlay
*/
export interface DomPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsOverlay, GetTraitsDom, GetTraitsAttach {
}
/**
* Properties for {@link MathboxSelection.dom | dom}.
* @category overlay
*/
export interface DomProps extends SetTraitsNode, SetTraitsObject, SetTraitsOverlay, SetTraitsDom, SetTraitsAttach {
}
/**
* Normalized properties for {@link MathboxSelection.face | face}.
* @category draw
*/
export interface FacePropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsMesh, GetTraitsFace, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.face | face}.
* @category draw
*/
export interface FaceProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsMesh, SetTraitsFace, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.format | format}.
* @category text
*/
export interface FormatPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsTexture, GetTraitsFormat, GetTraitsFont {
}
/**
* Properties for {@link MathboxSelection.format | format}.
* @category text
*/
export interface FormatProps extends SetTraitsNode, SetTraitsOperator, SetTraitsTexture, SetTraitsFormat, SetTraitsFont {
}
/**
* Normalized properties for {@link MathboxSelection.fragment | fragment}.
* @category transform
*/
export interface FragmentPropsNormalized extends GetTraitsNode, GetTraitsInclude, GetTraitsFragment {
}
/**
* Properties for {@link MathboxSelection.fragment | fragment}.
* @category transform
*/
export interface FragmentProps extends SetTraitsNode, SetTraitsInclude, SetTraitsFragment {
}
/**
* Normalized properties for {@link MathboxSelection.grid | grid}.
* @category draw
*/
export interface GridPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsGrid, GetTraitsArea, GetTraitsOrigin {
}
/**
* Properties for {@link MathboxSelection.grid | grid}.
* @category draw
*/
export interface GridProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsGrid, SetTraitsArea, SetTraitsOrigin {
}
/**
* Normalized properties for {@link MathboxSelection.group | group}.
* @category base
*/
export interface GroupPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsEntity {
}
/**
* Properties for {@link MathboxSelection.group | group}.
* @category base
*/
export interface GroupProps extends SetTraitsNode, SetTraitsObject, SetTraitsEntity {
}
/**
* Normalized properties for {@link MathboxSelection.grow | grow}.
* @category operator
*/
export interface GrowPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsGrow {
}
/**
* Properties for {@link MathboxSelection.grow | grow}.
* @category operator
*/
export interface GrowProps extends SetTraitsNode, SetTraitsOperator, SetTraitsGrow {
}
/**
* Normalized properties for {@link MathboxSelection.html | html}.
* @category overlay
*/
export interface HtmlPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsVoxel {
}
/**
* Properties for {@link MathboxSelection.html | html}.
* @category overlay
*/
export interface HtmlProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsVoxel {
}
/**
* Normalized properties for {@link MathboxSelection.inherit | inherit}.
* @category base
*/
export interface InheritPropsNormalized extends GetTraitsNode {
}
/**
* Properties for {@link MathboxSelection.inherit | inherit}.
* @category base
*/
export interface InheritProps extends SetTraitsNode {
}
/**
* Normalized properties for {@link MathboxSelection.interval | interval}.
* @category data
*/
export interface IntervalPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsTexture, GetTraitsArray, GetTraitsSpan, GetTraitsInterval, GetTraitsSampler {
}
/**
* Properties for {@link MathboxSelection.interval | interval}.
* @category data
*/
export interface IntervalProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsTexture, SetTraitsArray, SetTraitsSpan, SetTraitsInterval, SetTraitsSampler {
}
/**
* Normalized properties for {@link MathboxSelection.join | join}.
* @category operator
*/
export interface JoinPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsJoin {
}
/**
* Properties for {@link MathboxSelection.join | join}.
* @category operator
*/
export interface JoinProps extends SetTraitsNode, SetTraitsOperator, SetTraitsJoin {
}
/**
* Normalized properties for {@link MathboxSelection.label | label}.
* @category text
*/
export interface LabelPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLabel, GetTraitsAttach, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.label | label}.
* @category text
*/
export interface LabelProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLabel, SetTraitsAttach, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.layer | layer}.
* @category transform
*/
export interface LayerPropsNormalized extends GetTraitsNode, GetTraitsVertex, GetTraitsLayer {
}
/**
* Properties for {@link MathboxSelection.layer | layer}.
* @category transform
*/
export interface LayerProps extends SetTraitsNode, SetTraitsVertex, SetTraitsLayer {
}
/**
* Normalized properties for {@link MathboxSelection.lerp | lerp}.
* @category operator
*/
export interface LerpPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsLerp {
}
/**
* Properties for {@link MathboxSelection.lerp | lerp}.
* @category operator
*/
export interface LerpProps extends SetTraitsNode, SetTraitsOperator, SetTraitsLerp {
}
/**
* Normalized properties for {@link MathboxSelection.line | line}.
* @category draw
*/
export interface LinePropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsArrow, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.line | line}.
* @category draw
*/
export interface LineProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsArrow, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.mask | mask}.
* @category transform
*/
export interface MaskPropsNormalized extends GetTraitsNode, GetTraitsInclude {
}
/**
* Properties for {@link MathboxSelection.mask | mask}.
* @category transform
*/
export interface MaskProps extends SetTraitsNode, SetTraitsInclude {
}
/**
* Normalized properties for {@link MathboxSelection.matrix | matrix}.
* @category data
*/
export interface MatrixPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsTexture, GetTraitsMatrix {
}
/**
* Properties for {@link MathboxSelection.matrix | matrix}.
* @category data
*/
export interface MatrixProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsTexture, SetTraitsMatrix {
}
/**
* Normalized properties for {@link MathboxSelection.memo | memo}.
* @category operator
*/
export interface MemoPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsTexture {
}
/**
* Properties for {@link MathboxSelection.memo | memo}.
* @category operator
*/
export interface MemoProps extends SetTraitsNode, SetTraitsOperator, SetTraitsTexture {
}
/**
* Normalized properties for {@link MathboxSelection.move | move}.
* @category present
*/
export interface MovePropsNormalized extends GetTraitsNode, GetTraitsTransition, GetTraitsVertex, GetTraitsMove {
}
/**
* Properties for {@link MathboxSelection.move | move}.
* @category present
*/
export interface MoveProps extends SetTraitsNode, SetTraitsTransition, SetTraitsVertex, SetTraitsMove {
}
/**
* Normalized properties for {@link MathboxSelection.now | now}.
* @category time
*/
export interface NowPropsNormalized extends GetTraitsNode, GetTraitsNow {
}
/**
* Properties for {@link MathboxSelection.now | now}.
* @category time
*/
export interface NowProps extends SetTraitsNode, SetTraitsNow {
}
/**
* Normalized properties for {@link MathboxSelection.play | play}.
* @category present
*/
export interface PlayPropsNormalized extends GetTraitsNode, GetTraitsTrack, GetTraitsTrigger, GetTraitsPlay {
}
/**
* Properties for {@link MathboxSelection.play | play}.
* @category present
*/
export interface PlayProps extends SetTraitsNode, SetTraitsTrack, SetTraitsTrigger, SetTraitsPlay {
}
/**
* Normalized properties for {@link MathboxSelection.point | point}.
* @category draw
*/
export interface PointPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsPoint, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.point | point}.
* @category draw
*/
export interface PointProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsPoint, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.polar | polar}.
* @category view
*/
export interface PolarPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsView3, GetTraitsPolar, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.polar | polar}.
* @category view
*/
export interface PolarProps extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsView3, SetTraitsPolar, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.present | present}.
* @category present
*/
export interface PresentPropsNormalized extends GetTraitsNode, GetTraitsPresent {
}
/**
* Properties for {@link MathboxSelection.present | present}.
* @category present
*/
export interface PresentProps extends SetTraitsNode, SetTraitsPresent {
}
/**
* Normalized properties for {@link MathboxSelection.readback | readback}.
* @category operator
*/
export interface ReadbackPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsReadback, GetTraitsEntity {
}
/**
* Properties for {@link MathboxSelection.readback | readback}.
* @category operator
*/
export interface ReadbackProps extends SetTraitsNode, SetTraitsOperator, SetTraitsReadback, SetTraitsEntity {
}
/**
* Normalized properties for {@link MathboxSelection.repeat | repeat}.
* @category operator
*/
export interface RepeatPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsRepeat {
}
/**
* Properties for {@link MathboxSelection.repeat | repeat}.
* @category operator
*/
export interface RepeatProps extends SetTraitsNode, SetTraitsOperator, SetTraitsRepeat {
}
/**
* Normalized properties for {@link MathboxSelection.resample | resample}.
* @category operator
*/
export interface ResamplePropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsResample, GetTraitsInclude {
}
/**
* Properties for {@link MathboxSelection.resample | resample}.
* @category operator
*/
export interface ResampleProps extends SetTraitsNode, SetTraitsOperator, SetTraitsResample, SetTraitsInclude {
}
/**
* Normalized properties for {@link MathboxSelection.retext | retext}.
* @category text
*/
export interface RetextPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsResample, GetTraitsInclude {
}
/**
* Properties for {@link MathboxSelection.retext | retext}.
* @category text
*/
export interface RetextProps extends SetTraitsNode, SetTraitsOperator, SetTraitsResample, SetTraitsInclude {
}
/**
* Normalized properties for {@link MathboxSelection.reveal | reveal}.
* @category present
*/
export interface RevealPropsNormalized extends GetTraitsNode, GetTraitsTransition {
}
/**
* Properties for {@link MathboxSelection.reveal | reveal}.
* @category present
*/
export interface RevealProps extends SetTraitsNode, SetTraitsTransition {
}
/**
* Normalized properties for {@link MathboxSelection.root | root}.
* @category base
*/
export interface RootPropsNormalized extends GetTraitsNode, GetTraitsRoot, GetTraitsVertex, GetTraitsUnit {
}
/**
* Properties for {@link MathboxSelection.root | root}.
* @category base
*/
export interface RootProps extends SetTraitsNode, SetTraitsRoot, SetTraitsVertex, SetTraitsUnit {
}
/**
* Normalized properties for {@link MathboxSelection.rtt | rtt}.
* @category rtt
*/
export interface RttPropsNormalized extends GetTraitsNode, GetTraitsRoot, GetTraitsVertex, GetTraitsTexture, GetTraitsRtt {
}
/**
* Properties for {@link MathboxSelection.rtt | rtt}.
* @category rtt
*/
export interface RttProps extends SetTraitsNode, SetTraitsRoot, SetTraitsVertex, SetTraitsTexture, SetTraitsRtt {
}
/**
* Normalized properties for {@link MathboxSelection.scale | scale}.
* @category data
*/
export interface ScalePropsNormalized extends GetTraitsNode, GetTraitsInterval, GetTraitsSpan, GetTraitsScale, GetTraitsOrigin {
}
/**
* Properties for {@link MathboxSelection.scale | scale}.
* @category data
*/
export interface ScaleProps extends SetTraitsNode, SetTraitsInterval, SetTraitsSpan, SetTraitsScale, SetTraitsOrigin {
}
/**
* Normalized properties for {@link MathboxSelection.shader | shader}.
* @category shader
*/
export interface ShaderPropsNormalized extends GetTraitsNode, GetTraitsShader {
}
/**
* Properties for {@link MathboxSelection.shader | shader}.
* @category shader
*/
export interface ShaderProps extends SetTraitsNode, SetTraitsShader {
}
/**
* Normalized properties for {@link MathboxSelection.slice | slice}.
* @category operator
*/
export interface SlicePropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsSlice {
}
/**
* Properties for {@link MathboxSelection.slice | slice}.
* @category operator
*/
export interface SliceProps extends SetTraitsNode, SetTraitsOperator, SetTraitsSlice {
}
/**
* Normalized properties for {@link MathboxSelection.slide | slide}.
* @category present
*/
export interface SlidePropsNormalized extends GetTraitsNode, GetTraitsSlide {
}
/**
* Properties for {@link MathboxSelection.slide | slide}.
* @category present
*/
export interface SlideProps extends SetTraitsNode, SetTraitsSlide {
}
/**
* Normalized properties for {@link MathboxSelection.spherical | spherical}.
* @category view
*/
export interface SphericalPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsView3, GetTraitsSpherical, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.spherical | spherical}.
* @category view
*/
export interface SphericalProps extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsView3, SetTraitsSpherical, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.split | split}.
* @category operator
*/
export interface SplitPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsSplit {
}
/**
* Properties for {@link MathboxSelection.split | split}.
* @category operator
*/
export interface SplitProps extends SetTraitsNode, SetTraitsOperator, SetTraitsSplit {
}
/**
* Normalized properties for {@link MathboxSelection.spread | spread}.
* @category operator
*/
export interface SpreadPropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsSpread {
}
/**
* Properties for {@link MathboxSelection.spread | spread}.
* @category operator
*/
export interface SpreadProps extends SetTraitsNode, SetTraitsOperator, SetTraitsSpread {
}
/**
* Normalized properties for {@link MathboxSelection.step | step}.
* @category present
*/
export interface StepPropsNormalized extends GetTraitsNode, GetTraitsTrack, GetTraitsStep, GetTraitsTrigger {
}
/**
* Properties for {@link MathboxSelection.step | step}.
* @category present
*/
export interface StepProps extends SetTraitsNode, SetTraitsTrack, SetTraitsStep, SetTraitsTrigger {
}
/**
* Normalized properties for {@link MathboxSelection.stereographic | stereographic}.
* @category view
*/
export interface StereographicPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsView3, GetTraitsStereographic, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.stereographic | stereographic}.
* @category view
*/
export interface StereographicProps extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsView3, SetTraitsStereographic, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.stereographic4 | stereographic4}.
* @category view
*/
export interface Stereographic4PropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsView4, GetTraitsStereographic, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.stereographic4 | stereographic4}.
* @category view
*/
export interface Stereographic4Props extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsView4, SetTraitsStereographic, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.strip | strip}.
* @category draw
*/
export interface StripPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsMesh, GetTraitsStrip, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.strip | strip}.
* @category draw
*/
export interface StripProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsMesh, SetTraitsStrip, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.subdivide | subdivide}.
* @category operator
*/
export interface SubdividePropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsSubdivide {
}
/**
* Properties for {@link MathboxSelection.subdivide | subdivide}.
* @category operator
*/
export interface SubdivideProps extends SetTraitsNode, SetTraitsOperator, SetTraitsSubdivide {
}
/**
* Normalized properties for {@link MathboxSelection.surface | surface}.
* @category draw
*/
export interface SurfacePropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsMesh, GetTraitsGeometry, GetTraitsGrid {
}
/**
* Properties for {@link MathboxSelection.surface | surface}.
* @category draw
*/
export interface SurfaceProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsMesh, SetTraitsGeometry, SetTraitsGrid {
}
/**
* Normalized properties for {@link MathboxSelection.swizzle | swizzle}.
* @category operator
*/
export interface SwizzlePropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsSwizzle {
}
/**
* Properties for {@link MathboxSelection.swizzle | swizzle}.
* @category operator
*/
export interface SwizzleProps extends SetTraitsNode, SetTraitsOperator, SetTraitsSwizzle {
}
/**
* Normalized properties for {@link MathboxSelection.text | text}.
* @category text
*/
export interface TextPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsTexture, GetTraitsVoxel, GetTraitsFont {
}
/**
* Properties for {@link MathboxSelection.text | text}.
* @category text
*/
export interface TextProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsTexture, SetTraitsVoxel, SetTraitsFont {
}
/**
* Normalized properties for {@link MathboxSelection.ticks | ticks}.
* @category draw
*/
export interface TicksPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsTicks, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.ticks | ticks}.
* @category draw
*/
export interface TicksProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsTicks, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.transform | transform}.
* @category transform
*/
export interface TransformPropsNormalized extends GetTraitsNode, GetTraitsVertex, GetTraitsTransform3 {
}
/**
* Properties for {@link MathboxSelection.transform | transform}.
* @category transform
*/
export interface TransformProps extends SetTraitsNode, SetTraitsVertex, SetTraitsTransform3 {
}
/**
* Normalized properties for {@link MathboxSelection.transform4 | transform4}.
* @category transform
*/
export interface Transform4PropsNormalized extends GetTraitsNode, GetTraitsVertex, GetTraitsTransform4 {
}
/**
* Properties for {@link MathboxSelection.transform4 | transform4}.
* @category transform
*/
export interface Transform4Props extends SetTraitsNode, SetTraitsVertex, SetTraitsTransform4 {
}
/**
* Normalized properties for {@link MathboxSelection.transpose | transpose}.
* @category operator
*/
export interface TransposePropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsTranspose {
}
/**
* Properties for {@link MathboxSelection.transpose | transpose}.
* @category operator
*/
export interface TransposeProps extends SetTraitsNode, SetTraitsOperator, SetTraitsTranspose {
}
/**
* Normalized properties for {@link MathboxSelection.unit | unit}.
* @category base
*/
export interface UnitPropsNormalized extends GetTraitsNode, GetTraitsUnit {
}
/**
* Properties for {@link MathboxSelection.unit | unit}.
* @category base
*/
export interface UnitProps extends SetTraitsNode, SetTraitsUnit {
}
/**
* Normalized properties for {@link MathboxSelection.vector | vector}.
* @category draw
*/
export interface VectorPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsStyle, GetTraitsLine, GetTraitsArrow, GetTraitsGeometry {
}
/**
* Properties for {@link MathboxSelection.vector | vector}.
* @category draw
*/
export interface VectorProps extends SetTraitsNode, SetTraitsObject, SetTraitsStyle, SetTraitsLine, SetTraitsArrow, SetTraitsGeometry {
}
/**
* Normalized properties for {@link MathboxSelection.vertex | vertex}.
* @category transform
*/
export interface VertexPropsNormalized extends GetTraitsNode, GetTraitsInclude, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.vertex | vertex}.
* @category transform
*/
export interface VertexProps extends SetTraitsNode, SetTraitsInclude, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.view | view}.
* @category view
*/
export interface ViewPropsNormalized extends GetTraitsNode, GetTraitsObject, GetTraitsView, GetTraitsVertex {
}
/**
* Properties for {@link MathboxSelection.view | view}.
* @category view
*/
export interface ViewProps extends SetTraitsNode, SetTraitsObject, SetTraitsView, SetTraitsVertex {
}
/**
* Normalized properties for {@link MathboxSelection.volume | volume}.
* @category data
*/
export interface VolumePropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsTexture, GetTraitsVoxel, GetTraitsVolume {
}
/**
* Properties for {@link MathboxSelection.volume | volume}.
* @category data
*/
export interface VolumeProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsTexture, SetTraitsVoxel, SetTraitsVolume {
}
/**
* Normalized properties for {@link MathboxSelection.voxel | voxel}.
* @category data
*/
export interface VoxelPropsNormalized extends GetTraitsNode, GetTraitsBuffer, GetTraitsData, GetTraitsTexture, GetTraitsVoxel {
}
/**
* Properties for {@link MathboxSelection.voxel | voxel}.
* @category data
*/
export interface VoxelProps extends SetTraitsNode, SetTraitsBuffer, SetTraitsData, SetTraitsTexture, SetTraitsVoxel {
}
export {};
| cchudzicki/mathbox | build/esm/src/node_types.d.ts | TypeScript | mit | 85,828 |
export declare const Traits: {
node: {
id: import("./types_typed").Type<import("./types_typed").Optional<string>, string | null>;
classes: import("./types_typed").Type<import("./types_typed").Optional<string | string[]>, string[]>;
};
entity: {
active: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
object: {
visible: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
unit: {
scale: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
fov: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
focus: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
span: {
range: import("./types_typed").Type<unknown, unknown>;
};
view: {
range: import("./types_typed").Type<unknown[], unknown[]>;
};
view3: {
position: any;
quaternion: any;
rotation: any;
scale: any;
eulerOrder: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
};
view4: {
position: any;
scale: any;
};
layer: {
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
fit: any;
};
vertex: {
pass: any;
};
fragment: {
pass: any;
gamma: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
transform3: {
position: any;
quaternion: any;
rotation: any;
eulerOrder: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
scale: any;
matrix: any;
};
transform4: {
position: any;
scale: any;
matrix: any;
};
camera: {
proxy: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
position: import("./types_typed").Type<unknown, unknown>;
quaternion: import("./types_typed").Type<unknown, unknown>;
rotation: import("./types_typed").Type<unknown, unknown>;
lookAt: import("./types_typed").Type<unknown, unknown>;
up: import("./types_typed").Type<unknown, unknown>;
eulerOrder: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
fov: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
polar: {
bend: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
helix: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
spherical: {
bend: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
stereographic: {
bend: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
interval: {
axis: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Axes>, number>;
};
area: {
axes: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
};
volume: {
axes: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
};
origin: {
origin: any;
};
scale: {
divide: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
unit: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
base: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
mode: any;
start: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
end: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
zero: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
factor: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
nice: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
grid: {
lineX: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
lineY: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
crossed: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
closedX: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
closedY: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
axis: {
detail: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
crossed: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
data: {
data: import("./types_typed").Type<unknown, unknown>;
expr: import("./types_typed").Type<unknown, unknown>;
bind: import("./types_typed").Type<unknown, unknown>;
live: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
buffer: {
channels: import("./types_typed").Type<import("./types_typed").Optional<1 | 2 | 3 | 4>, 1 | 2 | 3 | 4>;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
fps: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
hurry: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
limit: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
realtime: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
observe: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
aligned: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
sampler: {
centered: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
padding: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
array: {
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
bufferWidth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
history: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
matrix: {
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
history: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
bufferWidth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
bufferHeight: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
voxel: {
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
bufferWidth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
bufferHeight: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
bufferDepth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
resolve: {
expr: import("./types_typed").Type<unknown, unknown>;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
style: {
opacity: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
color: any;
blending: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").BlendingModes>, import("./types_typed").BlendingModes>;
zWrite: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
zTest: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
zIndex: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
zBias: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
zOrder: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
geometry: {
points: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
colors: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
};
point: {
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
sizes: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
shape: any;
optical: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
fill: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
line: {
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
join: any;
stroke: any;
proximity: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
closed: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
mesh: {
fill: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
shaded: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
map: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
lineBias: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
strip: {
line: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
face: {
line: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
arrow: {
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
start: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
end: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
ticks: {
normal: any;
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
epsilon: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
attach: {
offset: any;
snap: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
format: {
digits: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
data: import("./types_typed").Type<unknown, unknown>;
expr: import("./types_typed").Type<unknown, unknown>;
live: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
font: {
font: any;
style: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
variant: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
weight: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
detail: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
sdf: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
label: {
text: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
outline: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
expand: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
background: any;
};
overlay: {
opacity: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
zIndex: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
dom: {
points: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
html: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
outline: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
zoom: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
color: import("./types_typed").Type<unknown, unknown>;
attributes: import("./types_typed").Type<unknown, unknown>;
pointerEvents: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
texture: {
minFilter: any;
magFilter: any;
type: any;
};
shader: {
sources: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
language: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
code: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
uniforms: import("./types_typed").Type<unknown, unknown>;
};
include: {
shader: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
};
operator: {
source: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
};
spread: {
unit: any;
items: import("./types_typed").Type<unknown, unknown>;
width: import("./types_typed").Type<unknown, unknown>;
height: import("./types_typed").Type<unknown, unknown>;
depth: import("./types_typed").Type<unknown, unknown>;
alignItems: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments>;
alignWidth: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments>;
alignHeight: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments>;
alignDepth: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments>;
};
grow: {
scale: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
items: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments | null>;
width: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Alignments>, import("./types_typed").Alignments | null>;
};
split: {
order: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
axis: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Axes>, number | null>;
length: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
overlap: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
join: {
order: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
axis: import("./types_typed").Type<import("./types_typed").Optional<import("./types_typed").Axes>, number | null>;
overlap: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
swizzle: {
order: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
};
transpose: {
order: import("./types_typed").Type<import("./types_typed").Optional<string | import("./types_typed").Axes[]>, number[]>;
};
repeat: {
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
slice: {
items: import("./types_typed").Type<unknown, unknown>;
width: import("./types_typed").Type<unknown, unknown>;
height: import("./types_typed").Type<unknown, unknown>;
depth: import("./types_typed").Type<unknown, unknown>;
};
lerp: {
size: any;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
subdivide: {
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
bevel: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
lerp: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
resample: {
indices: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
channels: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
sample: any;
size: any;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
readback: {
type: any;
expr: import("./types_typed").Type<unknown, unknown>;
data: any;
channels: import("./types_typed").Type<import("./types_typed").Optional<1 | 2 | 3 | 4>, 1 | 2 | 3 | 4>;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
root: {
speed: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
camera: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
};
inherit: {
source: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
traits: import("./types_typed").Type<import("./types_typed").Optional<string>[], string[]>;
};
rtt: {
size: any;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
history: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
compose: {
alpha: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
present: {
index: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
directed: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
length: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
slide: {
order: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
steps: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
early: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
late: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
from: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
to: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
transition: {
stagger: any;
enter: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
exit: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
delay: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
delayEnter: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
delayExit: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
duration: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
durationEnter: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
durationExit: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
move: {
from: any;
to: any;
};
seek: {
seek: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
track: {
target: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
script: any;
ease: any;
};
trigger: {
trigger: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
step: {
playback: any;
stops: import("./types_typed").Type<import("./types_typed").Optional<number>[] | null, number[] | null>;
delay: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
duration: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
pace: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
speed: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
rewind: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
skip: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
realtime: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
play: {
delay: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
pace: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
speed: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
from: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
to: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
realtime: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
loop: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
now: {
now: import("./types_typed").Type<unknown, unknown>;
seek: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
pace: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
speed: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
};
| cchudzicki/mathbox | build/esm/src/primitives/types/traits.d.ts | TypeScript | mit | 27,151 |
/**
* Manual typings for types.js.
*
* Why not name this types.d.ts? Because then it won't be included in the build,
* see https://stackoverflow.com/a/56440335/2747370. dts files are good for
* specifying types that are only consumed in our source code, but no good for
* specifying types that should be included in the output.
*/
import type { MathboxNode } from "../../types";
declare type OnInvalid = () => void;
declare type Validate<In, Out> = (value: In, target: unknown, invalid: OnInvalid) => Out;
export interface Type<In, Out> {
validate: Validate<In, Out>;
make(): Out;
}
export declare type Optional<T> = T | null | undefined;
export declare type BlendingModes = "no" | "normal" | "add" | "subtract" | "multiply" | "custom";
export declare type Axes = "x" | "y" | "z" | "w" | "W" | "H" | "D" | "I" | "width" | "height" | "depth" | "items" | 1 | 2 | 3 | 4;
export declare type AxesWithZero = Axes | 0 | "zero" | "null";
/**
* Values 'left' and 'right' correspond to -1 and +1, respectively.
*/
export declare type Alignments = "left" | "middle" | "right" | number;
/**
* If specified as a number, should range between -1 ("enter") to +1 ("exit").
*/
export declare type TransitionStates = "enter" | "visible" | "exiit" | number;
export declare type TypeGenerators = {
nullable<I, O>(type: Type<I, O>): Type<null | I, null | O>;
nullable<I, O>(type: Type<I, O>, make: true): Type<null | I, O>;
array<I, O>(type: Type<I, O>, size?: number, value?: O): Type<I[], O[]>;
string(defaultValue?: string): Type<Optional<string>, string>;
bool(defaultValue?: boolean): Type<Optional<boolean>, boolean>;
number(defaultValue?: number): Type<Optional<number>, number>;
enum<E extends string | number>(value: E, keys: E[], map?: Record<E, number>): Type<Optional<E>, E>;
enumber<E extends string | number>(value: E | number, keys: E[], map?: Record<E, number>): Type<Optional<E | number>, E | number>;
classes(): Type<Optional<string | string[]>, string[]>;
blending(defaultValue?: BlendingModes): Type<Optional<BlendingModes>, BlendingModes>;
anchor(defaultValue?: Alignments): Type<Optional<Alignments>, Alignments>;
transitionState(defaultValue?: TransitionStates): Type<Optional<TransitionStates>, TransitionStates>;
axis(value?: Axes, allowZero?: false): Type<Optional<Axes>, number>;
axis(value: AxesWithZero, allowZero: true): Type<Optional<AxesWithZero>, number>;
select(defaultValue?: string): Type<Optional<string | MathboxNode>, string | MathboxNode>;
letters<I, O>(type: Type<I, O>, size?: number, value?: string): Type<Optional<string | I[]>, O[]>;
int(value?: number): Type<Optional<number>, number>;
round(value?: number): Type<Optional<number>, number>;
positive<I, O extends number>(type: Type<I, O>, strict?: boolean): Type<I, O>;
func: any;
emitter: any;
object: any;
timestamp: any;
vec2: any;
ivec2: any;
vec3: any;
ivec3: any;
vec4: any;
ivec4: any;
mat3: any;
mat4: any;
quat: any;
color: any;
transpose(order?: string | Axes[]): Type<Optional<string | Axes[]>, number[]>;
swizzle(order?: string | Axes[], size?: number): Type<Optional<string | Axes[]>, number[]>;
filter: any;
type: any;
scale: any;
mapping: any;
indexing: any;
shape: any;
join: any;
stroke: any;
vertexPass: any;
fragmentPass: any;
ease: any;
fit: any;
font: any;
data: any;
};
export declare const Types: TypeGenerators;
export {};
| cchudzicki/mathbox | build/esm/src/primitives/types/types_typed.d.ts | TypeScript | mit | 3,538 |
import type * as TT from "./node_types";
import type { Alignments, Axes, AxesWithZero, BlendingModes, Optional } from "./primitives/types/types_typed";
export * from "./node_types";
export type { Alignments, Axes, AxesWithZero, BlendingModes, Optional };
export declare type Props = {
area: TT.AreaProps;
array: TT.ArrayProps;
axis: TT.AxisProps;
camera: TT.CameraProps;
cartesian: TT.CartesianProps;
cartesian4: TT.Cartesian4Props;
clamp: TT.ClampProps;
clock: TT.ClockProps;
compose: TT.ComposeProps;
dom: TT.DomProps;
face: TT.FaceProps;
format: TT.FormatProps;
fragment: TT.FragmentProps;
grid: TT.GridProps;
group: TT.GroupProps;
grow: TT.GrowProps;
html: TT.HtmlProps;
inherit: TT.InheritProps;
interval: TT.IntervalProps;
join: TT.JoinProps;
label: TT.LabelProps;
layer: TT.LayerProps;
lerp: TT.LerpProps;
line: TT.LineProps;
mask: TT.MaskProps;
matrix: TT.MatrixProps;
memo: TT.MemoProps;
move: TT.MoveProps;
now: TT.NowProps;
play: TT.PlayProps;
point: TT.PointProps;
polar: TT.PolarProps;
present: TT.PresentProps;
readback: TT.ReadbackProps;
repeat: TT.RepeatProps;
resample: TT.ResampleProps;
retext: TT.RetextProps;
reveal: TT.RevealProps;
root: TT.RootProps;
rtt: TT.RttProps;
scale: TT.ScaleProps;
shader: TT.ShaderProps;
slice: TT.SliceProps;
slide: TT.SlideProps;
spherical: TT.SphericalProps;
split: TT.SplitProps;
spread: TT.SpreadProps;
step: TT.StepProps;
stereographic: TT.StereographicProps;
stereographic4: TT.Stereographic4Props;
strip: TT.StripProps;
subdivide: TT.SubdivideProps;
surface: TT.SurfaceProps;
swizzle: TT.SwizzleProps;
text: TT.TextProps;
ticks: TT.TicksProps;
transform: TT.TransformProps;
transform4: TT.Transform4Props;
transpose: TT.TransposeProps;
unit: TT.UnitProps;
vector: TT.VectorProps;
vertex: TT.VertexProps;
view: TT.ViewProps;
volume: TT.VolumeProps;
voxel: TT.VoxelProps;
};
export declare type PropsNoramlized = {
area: TT.AreaPropsNormalized;
array: TT.ArrayPropsNormalized;
axis: TT.AxisPropsNormalized;
camera: TT.CameraPropsNormalized;
cartesian: TT.CartesianPropsNormalized;
cartesian4: TT.Cartesian4PropsNormalized;
clamp: TT.ClampPropsNormalized;
clock: TT.ClockPropsNormalized;
compose: TT.ComposePropsNormalized;
dom: TT.DomPropsNormalized;
face: TT.FacePropsNormalized;
format: TT.FormatPropsNormalized;
fragment: TT.FragmentPropsNormalized;
grid: TT.GridPropsNormalized;
group: TT.GroupPropsNormalized;
grow: TT.GrowPropsNormalized;
html: TT.HtmlPropsNormalized;
inherit: TT.InheritPropsNormalized;
interval: TT.IntervalPropsNormalized;
join: TT.JoinPropsNormalized;
label: TT.LabelPropsNormalized;
layer: TT.LayerPropsNormalized;
lerp: TT.LerpPropsNormalized;
line: TT.LinePropsNormalized;
mask: TT.MaskPropsNormalized;
matrix: TT.MatrixPropsNormalized;
memo: TT.MemoPropsNormalized;
move: TT.MovePropsNormalized;
now: TT.NowPropsNormalized;
play: TT.PlayPropsNormalized;
point: TT.PointPropsNormalized;
polar: TT.PolarPropsNormalized;
present: TT.PresentPropsNormalized;
readback: TT.ReadbackPropsNormalized;
repeat: TT.RepeatPropsNormalized;
resample: TT.ResamplePropsNormalized;
retext: TT.RetextPropsNormalized;
reveal: TT.RevealPropsNormalized;
root: TT.RootPropsNormalized;
rtt: TT.RttPropsNormalized;
scale: TT.ScalePropsNormalized;
shader: TT.ShaderPropsNormalized;
slice: TT.SlicePropsNormalized;
slide: TT.SlidePropsNormalized;
spherical: TT.SphericalPropsNormalized;
split: TT.SplitPropsNormalized;
spread: TT.SpreadPropsNormalized;
step: TT.StepPropsNormalized;
stereographic: TT.StereographicPropsNormalized;
stereographic4: TT.Stereographic4PropsNormalized;
strip: TT.StripPropsNormalized;
subdivide: TT.SubdividePropsNormalized;
surface: TT.SurfacePropsNormalized;
swizzle: TT.SwizzlePropsNormalized;
text: TT.TextPropsNormalized;
ticks: TT.TicksPropsNormalized;
transform: TT.TransformPropsNormalized;
transform4: TT.Transform4PropsNormalized;
transpose: TT.TransposePropsNormalized;
unit: TT.UnitPropsNormalized;
vector: TT.VectorPropsNormalized;
vertex: TT.VertexPropsNormalized;
view: TT.ViewPropsNormalized;
volume: TT.VolumePropsNormalized;
voxel: TT.VoxelPropsNormalized;
};
export declare type NodeType = keyof Props;
/**
* MathBox (virtual)-DOM Nodes.
*
* Usually one interacts with these via a selection.
*/
export interface MathboxNode<T extends NodeType = NodeType> {
type: string;
props: PropsNoramlized[T];
}
/**
* @typeParam Type The type(s) of MathBox nodes in this selection.
*/
export interface MathboxSelection<Type extends NodeType> {
/**
* Set properties on all nodes in this selection.
*/
set(props: Props[Type]): MathboxSelection<Type>;
/**
* Set a single property on all nodes in this selection
*/
set<P extends keyof Props[Type]>(prop: P, value: Props[Type][P]): MathboxSelection<Type>;
/**
* Return all props for the first node in this node.
*/
get(): PropsNoramlized[Type];
/**
* Retrieve a specific property value for the first node in this selection.
*/
get<P extends keyof PropsNoramlized[Type]>(prop: P): PropsNoramlized[Type][P];
/**
* Return an array of props for all nodes in this node.
*/
getAll(): PropsNoramlized[Type][];
remove: () => void;
print: () => MathboxSelection<Type>;
select: (query: string) => MathboxSelection<NodeType>;
/**
* @hidden Matched nodes by index.
*/
[index: number]: MathboxNode<Type>;
/**
* The number of nodes contained in this selection.
*/
length: number;
/**
* Create new `area` node.
*
* See also {@link AreaProps} and {@link AreaPropsNormalized}.
*
* @category data
*/
area(props?: TT.AreaProps): MathboxSelection<"area">;
/**
* Create new `array` node.
*
* See also {@link ArrayProps} and {@link ArrayPropsNormalized}.
*
* @category data
*/
array(props?: TT.ArrayProps): MathboxSelection<"array">;
/**
* Create new `axis` node.
*
* See also {@link AxisProps} and {@link AxisPropsNormalized}.
*
* @category draw
*/
axis(props?: TT.AxisProps): MathboxSelection<"axis">;
/**
* Create new `camera` node.
*
* See also {@link CameraProps} and {@link CameraPropsNormalized}.
*
* @category camera
*/
camera(props?: TT.CameraProps): MathboxSelection<"camera">;
/**
* Create new `cartesian` node.
*
* See also {@link CartesianProps} and {@link CartesianPropsNormalized}.
*
* @category view
*/
cartesian(props?: TT.CartesianProps): MathboxSelection<"cartesian">;
/**
* Create new `cartesian4` node.
*
* See also {@link Cartesian4Props} and {@link Cartesian4PropsNormalized}.
*
* @category view
*/
cartesian4(props?: TT.Cartesian4Props): MathboxSelection<"cartesian4">;
/**
* Create new `clamp` node.
*
* See also {@link ClampProps} and {@link ClampPropsNormalized}.
*
* @category operator
*/
clamp(props?: TT.ClampProps): MathboxSelection<"clamp">;
/**
* Create new `clock` node.
*
* See also {@link ClockProps} and {@link ClockPropsNormalized}.
*
* @category time
*/
clock(props?: TT.ClockProps): MathboxSelection<"clock">;
/**
* Create new `compose` node.
*
* See also {@link ComposeProps} and {@link ComposePropsNormalized}.
*
* @category rtt
*/
compose(props?: TT.ComposeProps): MathboxSelection<"compose">;
/**
* Create new `dom` node.
*
* See also {@link DomProps} and {@link DomPropsNormalized}.
*
* @category overlay
*/
dom(props?: TT.DomProps): MathboxSelection<"dom">;
/**
* Create new `face` node.
*
* See also {@link FaceProps} and {@link FacePropsNormalized}.
*
* @category draw
*/
face(props?: TT.FaceProps): MathboxSelection<"face">;
/**
* Create new `format` node.
*
* See also {@link FormatProps} and {@link FormatPropsNormalized}.
*
* @category text
*/
format(props?: TT.FormatProps): MathboxSelection<"format">;
/**
* Create new `fragment` node.
*
* See also {@link FragmentProps} and {@link FragmentPropsNormalized}.
*
* @category transform
*/
fragment(props?: TT.FragmentProps): MathboxSelection<"fragment">;
/**
* Create new `grid` node.
*
* See also {@link GridProps} and {@link GridPropsNormalized}.
*
* @category draw
*/
grid(props?: TT.GridProps): MathboxSelection<"grid">;
/**
* Create new `group` node.
*
* See also {@link GroupProps} and {@link GroupPropsNormalized}.
*
* @category base
*/
group(props?: TT.GroupProps): MathboxSelection<"group">;
/**
* Create new `grow` node.
*
* See also {@link GrowProps} and {@link GrowPropsNormalized}.
*
* @category operator
*/
grow(props?: TT.GrowProps): MathboxSelection<"grow">;
/**
* Create new `html` node.
*
* See also {@link HtmlProps} and {@link HtmlPropsNormalized}.
*
* @category overlay
*/
html(props?: TT.HtmlProps): MathboxSelection<"html">;
/**
* Create new `inherit` node.
*
* See also {@link InheritProps} and {@link InheritPropsNormalized}.
*
* @category base
*/
inherit(props?: TT.InheritProps): MathboxSelection<"inherit">;
/**
* Create new `interval` node.
*
* See also {@link IntervalProps} and {@link IntervalPropsNormalized}.
*
* @category data
*/
interval(props?: TT.IntervalProps): MathboxSelection<"interval">;
/**
* Create new `join` node.
*
* See also {@link JoinProps} and {@link JoinPropsNormalized}.
*
* @category operator
*/
join(props?: TT.JoinProps): MathboxSelection<"join">;
/**
* Create new `label` node.
*
* See also {@link LabelProps} and {@link LabelPropsNormalized}.
*
* @category text
*/
label(props?: TT.LabelProps): MathboxSelection<"label">;
/**
* Create new `layer` node.
*
* See also {@link LayerProps} and {@link LayerPropsNormalized}.
*
* @category transform
*/
layer(props?: TT.LayerProps): MathboxSelection<"layer">;
/**
* Create new `lerp` node.
*
* See also {@link LerpProps} and {@link LerpPropsNormalized}.
*
* @category operator
*/
lerp(props?: TT.LerpProps): MathboxSelection<"lerp">;
/**
* Create new `line` node.
*
* See also {@link LineProps} and {@link LinePropsNormalized}.
*
* @category draw
*/
line(props?: TT.LineProps): MathboxSelection<"line">;
/**
* Create new `mask` node.
*
* See also {@link MaskProps} and {@link MaskPropsNormalized}.
*
* @category transform
*/
mask(props?: TT.MaskProps): MathboxSelection<"mask">;
/**
* Create new `matrix` node.
*
* See also {@link MatrixProps} and {@link MatrixPropsNormalized}.
*
* @category data
*/
matrix(props?: TT.MatrixProps): MathboxSelection<"matrix">;
/**
* Create new `memo` node.
*
* See also {@link MemoProps} and {@link MemoPropsNormalized}.
*
* @category operator
*/
memo(props?: TT.MemoProps): MathboxSelection<"memo">;
/**
* Create new `move` node.
*
* See also {@link MoveProps} and {@link MovePropsNormalized}.
*
* @category present
*/
move(props?: TT.MoveProps): MathboxSelection<"move">;
/**
* Create new `now` node.
*
* See also {@link NowProps} and {@link NowPropsNormalized}.
*
* @category time
*/
now(props?: TT.NowProps): MathboxSelection<"now">;
/**
* Create new `play` node.
*
* See also {@link PlayProps} and {@link PlayPropsNormalized}.
*
* @category present
*/
play(props?: TT.PlayProps): MathboxSelection<"play">;
/**
* Create new `point` node.
*
* See also {@link PointProps} and {@link PointPropsNormalized}.
*
* @category draw
*/
point(props?: TT.PointProps): MathboxSelection<"point">;
/**
* Create new `polar` node.
*
* See also {@link PolarProps} and {@link PolarPropsNormalized}.
*
* @category view
*/
polar(props?: TT.PolarProps): MathboxSelection<"polar">;
/**
* Create new `present` node.
*
* See also {@link PresentProps} and {@link PresentPropsNormalized}.
*
* @category present
*/
present(props?: TT.PresentProps): MathboxSelection<"present">;
/**
* Create new `readback` node.
*
* See also {@link ReadbackProps} and {@link ReadbackPropsNormalized}.
*
* @category operator
*/
readback(props?: TT.ReadbackProps): MathboxSelection<"readback">;
/**
* Create new `repeat` node.
*
* See also {@link RepeatProps} and {@link RepeatPropsNormalized}.
*
* @category operator
*/
repeat(props?: TT.RepeatProps): MathboxSelection<"repeat">;
/**
* Create new `resample` node.
*
* See also {@link ResampleProps} and {@link ResamplePropsNormalized}.
*
* @category operator
*/
resample(props?: TT.ResampleProps): MathboxSelection<"resample">;
/**
* Create new `retext` node.
*
* See also {@link RetextProps} and {@link RetextPropsNormalized}.
*
* @category text
*/
retext(props?: TT.RetextProps): MathboxSelection<"retext">;
/**
* Create new `reveal` node.
*
* See also {@link RevealProps} and {@link RevealPropsNormalized}.
*
* @category present
*/
reveal(props?: TT.RevealProps): MathboxSelection<"reveal">;
/**
* Create new `root` node.
*
* See also {@link RootProps} and {@link RootPropsNormalized}.
*
* @category base
*/
root(props?: TT.RootProps): MathboxSelection<"root">;
/**
* Create new `rtt` node.
*
* See also {@link RttProps} and {@link RttPropsNormalized}.
*
* @category rtt
*/
rtt(props?: TT.RttProps): MathboxSelection<"rtt">;
/**
* Create new `scale` node.
*
* See also {@link ScaleProps} and {@link ScalePropsNormalized}.
*
* @category data
*/
scale(props?: TT.ScaleProps): MathboxSelection<"scale">;
/**
* Create new `shader` node.
*
* See also {@link ShaderProps} and {@link ShaderPropsNormalized}.
*
* @category shader
*/
shader(props?: TT.ShaderProps): MathboxSelection<"shader">;
/**
* Create new `slice` node.
*
* See also {@link SliceProps} and {@link SlicePropsNormalized}.
*
* @category operator
*/
slice(props?: TT.SliceProps): MathboxSelection<"slice">;
/**
* Create new `slide` node.
*
* See also {@link SlideProps} and {@link SlidePropsNormalized}.
*
* @category present
*/
slide(props?: TT.SlideProps): MathboxSelection<"slide">;
/**
* Create new `spherical` node.
*
* See also {@link SphericalProps} and {@link SphericalPropsNormalized}.
*
* @category view
*/
spherical(props?: TT.SphericalProps): MathboxSelection<"spherical">;
/**
* Create new `split` node.
*
* See also {@link SplitProps} and {@link SplitPropsNormalized}.
*
* @category operator
*/
split(props?: TT.SplitProps): MathboxSelection<"split">;
/**
* Create new `spread` node.
*
* See also {@link SpreadProps} and {@link SpreadPropsNormalized}.
*
* @category operator
*/
spread(props?: TT.SpreadProps): MathboxSelection<"spread">;
/**
* Create new `step` node.
*
* See also {@link StepProps} and {@link StepPropsNormalized}.
*
* @category present
*/
step(props?: TT.StepProps): MathboxSelection<"step">;
/**
* Create new `stereographic` node.
*
* See also {@link StereographicProps} and {@link StereographicPropsNormalized}.
*
* @category view
*/
stereographic(props?: TT.StereographicProps): MathboxSelection<"stereographic">;
/**
* Create new `stereographic4` node.
*
* See also {@link Stereographic4Props} and {@link Stereographic4PropsNormalized}.
*
* @category view
*/
stereographic4(props?: TT.Stereographic4Props): MathboxSelection<"stereographic4">;
/**
* Create new `strip` node.
*
* See also {@link StripProps} and {@link StripPropsNormalized}.
*
* @category draw
*/
strip(props?: TT.StripProps): MathboxSelection<"strip">;
/**
* Create new `subdivide` node.
*
* See also {@link SubdivideProps} and {@link SubdividePropsNormalized}.
*
* @category operator
*/
subdivide(props?: TT.SubdivideProps): MathboxSelection<"subdivide">;
/**
* Create new `surface` node.
*
* See also {@link SurfaceProps} and {@link SurfacePropsNormalized}.
*
* @category draw
*/
surface(props?: TT.SurfaceProps): MathboxSelection<"surface">;
/**
* Create new `swizzle` node.
*
* See also {@link SwizzleProps} and {@link SwizzlePropsNormalized}.
*
* @category operator
*/
swizzle(props?: TT.SwizzleProps): MathboxSelection<"swizzle">;
/**
* Create new `text` node.
*
* See also {@link TextProps} and {@link TextPropsNormalized}.
*
* @category text
*/
text(props?: TT.TextProps): MathboxSelection<"text">;
/**
* Create new `ticks` node.
*
* See also {@link TicksProps} and {@link TicksPropsNormalized}.
*
* @category draw
*/
ticks(props?: TT.TicksProps): MathboxSelection<"ticks">;
/**
* Create new `transform` node.
*
* See also {@link TransformProps} and {@link TransformPropsNormalized}.
*
* @category transform
*/
transform(props?: TT.TransformProps): MathboxSelection<"transform">;
/**
* Create new `transform4` node.
*
* See also {@link Transform4Props} and {@link Transform4PropsNormalized}.
*
* @category transform
*/
transform4(props?: TT.Transform4Props): MathboxSelection<"transform4">;
/**
* Create new `transpose` node.
*
* See also {@link TransposeProps} and {@link TransposePropsNormalized}.
*
* @category operator
*/
transpose(props?: TT.TransposeProps): MathboxSelection<"transpose">;
/**
* Create new `unit` node.
*
* See also {@link UnitProps} and {@link UnitPropsNormalized}.
*
* @category base
*/
unit(props?: TT.UnitProps): MathboxSelection<"unit">;
/**
* Create new `vector` node.
*
* See also {@link VectorProps} and {@link VectorPropsNormalized}.
*
* @category draw
*/
vector(props?: TT.VectorProps): MathboxSelection<"vector">;
/**
* Create new `vertex` node.
*
* See also {@link VertexProps} and {@link VertexPropsNormalized}.
*
* @category transform
*/
vertex(props?: TT.VertexProps): MathboxSelection<"vertex">;
/**
* Create new `view` node.
*
* See also {@link ViewProps} and {@link ViewPropsNormalized}.
*
* @category view
*/
view(props?: TT.ViewProps): MathboxSelection<"view">;
/**
* Create new `volume` node.
*
* See also {@link VolumeProps} and {@link VolumePropsNormalized}.
*
* @category data
*/
volume(props?: TT.VolumeProps): MathboxSelection<"volume">;
/**
* Create new `voxel` node.
*
* See also {@link VoxelProps} and {@link VoxelPropsNormalized}.
*
* @category data
*/
voxel(props?: TT.VoxelProps): MathboxSelection<"voxel">;
}
export declare function mathBox(opts?: any): MathboxSelection<"root">;
| cchudzicki/mathbox | build/esm/src/types.d.ts | TypeScript | mit | 20,408 |
export class Animator {
constructor(context: any);
context: any;
anims: any[];
make(type: any, options: any): Animation;
unmake(anim: any): any[];
update(): any[];
lerp(type: any, from: any, to: any, f: any, value: any): any;
}
declare class Animation {
constructor(animator: any, time: any, type: any, options: any);
animator: any;
time: any;
type: any;
options: any;
value: any;
target: any;
queue: any[];
dispose(): any;
set(...args: any[]): any;
getTime(): any;
cancel(from: any): void;
notify(): any;
immediate(value: any, options: any): number;
update(time: any): any;
}
export {};
| cchudzicki/mathbox | build/esm/stage/animator.d.ts | TypeScript | mit | 676 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
import * as Ease from "../util/ease.js";
export class Animator {
constructor(context) {
this.context = context;
this.anims = [];
}
make(type, options) {
const anim = new Animation(this, this.context.time, type, options);
this.anims.push(anim);
return anim;
}
unmake(anim) {
return (this.anims = Array.from(this.anims).filter((a) => a !== anim));
}
update() {
const { time } = this.context;
return (this.anims = (() => {
const result = [];
for (const anim of Array.from(this.anims)) {
if (anim.update(time) !== false) {
result.push(anim);
}
}
return result;
})());
}
lerp(type, from, to, f, value) {
if (value == null) {
value = type.make();
}
// Use the most appropriate interpolation method for the type
// Direct lerp operator
if (type.lerp) {
value = type.lerp(from, to, value, f);
// Substitute emitter
}
else if (type.emitter) {
const fromE = from.emitterFrom;
const toE = to.emitterTo;
if (fromE != null && toE != null && fromE === toE) {
fromE.lerp(f);
return fromE;
}
else {
const emitter = type.emitter(from, to);
from.emitterFrom = emitter;
to.emitterTo = emitter;
emitter.lerp(f);
return emitter;
}
// Generic binary operator
}
else if (type.op) {
const lerp = function (a, b) {
if (a === +a && b === +b) {
// Lerp numbers
return a + (b - a) * f;
}
else {
// No lerp
if (f > 0.5) {
return b;
}
else {
return a;
}
}
};
value = type.op(from, to, value, lerp);
// No lerp
}
else {
value = f > 0.5 ? to : from;
}
return value;
}
}
class Animation {
constructor(animator, time, type, options) {
this.animator = animator;
this.time = time;
this.type = type;
this.options = options;
this.value = this.type.make();
this.target = this.type.make();
this.queue = [];
}
dispose() {
return this.animator.unmake(this);
}
set() {
let { target } = this;
let value = arguments.length > 1 ? [].slice.call(arguments) : arguments[0];
let invalid = false;
value = this.type.validate(value, target, () => (invalid = true));
if (!invalid) {
target = value;
}
this.cancel();
this.target = this.value;
this.value = target;
return this.notify();
}
getTime() {
const { clock } = this.options;
const time = clock ? clock.getTime() : this.time;
if (this.options.realtime) {
return time.time;
}
else {
return time.clock;
}
}
cancel(from) {
let stage;
if (from == null) {
from = this.getTime();
}
const { queue } = this;
const cancelled = (() => {
const result = [];
for (stage of Array.from(queue)) {
if (stage.end >= from) {
result.push(stage);
}
}
return result;
})();
this.queue = (() => {
const result1 = [];
for (stage of Array.from(queue)) {
if (stage.end < from) {
result1.push(stage);
}
}
return result1;
})();
for (stage of Array.from(cancelled)) {
if (typeof stage.complete === "function") {
stage.complete(false);
}
}
if (typeof this.options.complete === "function") {
this.options.complete(false);
}
}
notify() {
return typeof this.options.step === "function"
? this.options.step(this.value)
: undefined;
}
immediate(value, options) {
const { duration, delay, ease, step, complete } = options;
const time = this.getTime();
const start = time + delay;
const end = start + duration;
let invalid = false;
let target = this.type.make();
value = this.type.validate(value, target, function () {
invalid = true;
return null;
});
if (value !== undefined && !invalid) {
target = value;
}
this.cancel(start);
return this.queue.push({
from: null,
to: target,
start,
end,
ease,
step,
complete,
});
}
update(time) {
this.time = time;
if (this.queue.length === 0) {
return true;
}
const clock = this.getTime();
let { value } = this;
const { queue } = this;
let active = false;
while (!active) {
const stage = queue[0];
let { from } = stage;
const { to, start, end, step, complete, ease } = stage;
if (from == null) {
from = stage.from = this.type.clone(this.value);
}
let f = Ease.clamp((clock - start) / Math.max(0.00001, end - start) || 0, 0, 1);
if (f === 0) {
return;
} // delayed animation not yet active
const method = (() => {
switch (ease) {
case "linear":
case 0:
return null;
case "cosine":
case 1:
return Ease.cosine;
case "binary":
case 2:
return Ease.binary;
case "hold":
case 3:
return Ease.hold;
default:
return Ease.cosine;
}
})();
if (method != null) {
f = method(f);
}
active = f < 1;
value = active ? this.animator.lerp(this.type, from, to, f, value) : to;
//console.log 'animation step', f, from, to, value
if (typeof step === "function") {
step(value);
}
if (!active) {
if (typeof complete === "function") {
complete(true);
}
if (typeof this.options.complete === "function") {
this.options.complete(true);
}
queue.shift();
if (queue.length === 0) {
break;
} // end of queue
}
}
this.value = value;
return this.notify();
}
}
| cchudzicki/mathbox | build/esm/stage/animator.js | JavaScript | mit | 7,750 |
export class API {
constructor(_context: any, _up: any, _targets: any);
v2(): API;
_context: any;
_up: any;
_targets: any;
isRoot: boolean;
isLeaf: boolean;
length: any;
select(selector: any): API;
eq(index: any): API;
filter(callback: any): API;
map(callback: any): any[];
map(callback: any): any;
each(callback: any): API;
add(type: any, options: any, binds: any): any;
remove(selector: any): any;
set(key: any, value: any): API;
getAll(key: any): any[];
get(key: any): any;
evaluate(key: any, time: any): any;
bind(key: any, value: any): API;
unbind(key: any): API;
end(): any;
_push(targets: any): API;
_pop(): any;
_reset(): any;
on(...args: any[]): API;
off(...args: any[]): API;
toString(): any;
toMarkup(): any;
print(): API;
debug(): any;
inspect(selector: any, trait: any, print: any): {
nodes: any;
renderables: never[];
renders: never[];
shaders: never[];
};
}
| cchudzicki/mathbox | build/esm/stage/api.d.ts | TypeScript | mit | 1,041 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS104: Avoid inline assignments
* DS202: Simplify dynamic range loops
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
import * as Pretty from "../util/pretty.js";
import * as ShaderGraph from "shadergraph";
export class API {
v2() {
return this;
}
constructor(_context, _up, _targets) {
this._context = _context;
this._up = _up;
this._targets = _targets;
const root = this._context.controller.getRoot();
if (this._targets == null) {
this._targets = [root];
}
this.isRoot = this._targets.length === 1 && this._targets[0] === root;
this.isLeaf =
this._targets.length === 1 && this._targets[0].children == null;
// Look like an array
for (let i = 0; i < this._targets.length; i++) {
const t = this._targets[i];
this[i] = t;
}
this.length = this._targets.length;
// Primitive factory. This is where all API methods are assigned.
for (const type of Array.from(this._context.controller.getTypes())) {
if (!["root"].includes(type)) {
this[type] = (options, binds) => this.add(type, options, binds);
}
}
}
select(selector) {
const targets = this._context.model.select(selector, !this.isRoot ? this._targets : null);
return this._push(targets);
}
eq(index) {
if (this._targets.length > index) {
return this._push([this._targets[index]]);
}
return this._push([]);
}
filter(callback) {
if (typeof callback === "string") {
const matcher = this._context.model._matcher(callback);
callback = (x) => matcher(x);
}
return this._push(this._targets.filter(callback));
}
map(callback) {
return __range__(0, this.length, false).map((i) => callback(this[i], i, this));
}
each(callback) {
for (let i = 0, end = this.length, asc = 0 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
callback(this[i], i, this);
}
return this;
}
add(type, options, binds) {
// Make node/primitive
const { controller } = this._context;
// Auto-pop if targeting leaf
if (this.isLeaf) {
return this._pop().add(type, options, binds);
}
// Add to target
const nodes = [];
for (const target of this._targets) {
const node = controller.make(type, options, binds);
controller.add(node, target);
nodes.push(node);
}
// Return changed selection
return this._push(nodes);
}
remove(selector) {
if (selector) {
return this.select(selector).remove();
}
for (const target of Array.from(this._targets.slice().reverse())) {
this._context.controller.remove(target);
}
return this._pop();
}
set(key, value) {
for (const target of Array.from(this._targets)) {
this._context.controller.set(target, key, value);
}
return this;
}
getAll(key) {
return Array.from(this._targets).map((target) => this._context.controller.get(target, key));
}
get(key) {
return this._targets[0] != null ? this._targets[0].get(key) : undefined;
}
evaluate(key, time) {
return this._targets[0] != null
? this._targets[0].evaluate(key, time)
: undefined;
}
bind(key, value) {
for (const target of Array.from(this._targets)) {
this._context.controller.bind(target, key, value);
}
return this;
}
unbind(key) {
for (const target of Array.from(this._targets)) {
this._context.controller.unbind(target, key);
}
return this;
}
end() {
return (this.isLeaf ? this._pop() : this)._pop();
}
_push(targets) {
return new API(this._context, this, targets);
}
_pop() {
return this._up != null ? this._up : this;
}
_reset() {
let left;
return (left = this._up != null ? this._up.reset() : undefined) != null
? left
: this;
}
// TODO is this okay??
// eslint-disable-next-line no-dupe-class-members
map(callback) {
return this._targets.map(callback);
}
on() {
const args = arguments;
this._targets.map((x) => x.on.apply(x, args));
return this;
}
off() {
const args = arguments;
this._targets.map((x) => x.off.apply(x, args));
return this;
}
toString() {
const tags = this._targets.map((x) => x.toString());
if (this._targets.length > 1) {
return `[${tags.join(", ")}]`;
}
else {
return tags[0];
}
}
toMarkup() {
const tags = this._targets.map((x) => x.toMarkup());
return tags.join("\n\n");
}
print() {
Pretty.print(this._targets.map((x) => x.toMarkup()).join("\n\n"));
return this;
}
debug() {
const info = this.inspect();
console.log("Renderables: ", info.renderables);
console.log("Renders: ", info.renders);
console.log("Shaders: ", info.shaders);
const getName = (owner) => owner.constructor.toString().match("function +([^(]*)")[1];
const shaders = [];
for (const shader of Array.from(info.shaders)) {
const name = getName(shader.owner);
shaders.push(`${name} - Vertex`);
shaders.push(shader.vertex);
shaders.push(`${name} - Fragment`);
shaders.push(shader.fragment);
}
return ShaderGraph.inspect(shaders);
}
inspect(selector, trait, print) {
let self;
if (typeof trait === "boolean") {
print = trait;
trait = null;
}
if (print == null) {
print = true;
}
// Recurse tree and extract all inserted renderables
const map = (node) => (node.controller != null ? node.controller.objects : undefined) != null
? node.controller != null
? node.controller.objects
: undefined
: [];
const recurse = (self = function (node, list) {
if (list == null) {
list = [];
}
if (!trait || node.traits.hash[trait]) {
list.push(map(node));
}
if (node.children != null) {
for (const child of Array.from(node.children)) {
self(child, list);
}
}
return list;
});
// Flatten arrays
const flatten = function (list) {
list = list.reduce((a, b) => a.concat(b), []);
return (list = list.filter((x, i) => x != null && list.indexOf(x) === i));
};
// Render descriptor
const make = function (renderable, render) {
const d = {};
d.owner = renderable;
d.geometry = render.geometry;
d.material = render.material;
d.vertex = render.userData.vertexGraph;
d.fragment = render.userData.fragmentGraph;
return d;
};
const info = {
nodes: this._targets.slice(),
renderables: [],
renders: [],
shaders: [],
};
// Inspect all targets
for (const target of Array.from(this._targets)) {
let renderables;
if (print) {
target.print(selector, "info");
}
const _info = {
renderables: (renderables = flatten(recurse(target))),
renders: flatten(renderables.map((x) => x.renders)),
shaders: flatten(renderables.map((x) => x.renders != null ? x.renders.map((r) => make(x, r)) : undefined)),
};
for (const k in _info) {
info[k] = info[k].concat(_info[k]);
}
}
return info;
}
}
function __range__(left, right, inclusive) {
const range = [];
const ascending = left < right;
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
range.push(i);
}
return range;
}
| cchudzicki/mathbox | build/esm/stage/api.js | JavaScript | mit | 8,822 |
export class Controller {
constructor(model: any, primitives: any);
model: any;
primitives: any;
getRoot(): any;
getTypes(): any;
make(type: any, options: any, binds: any): any;
get(node: any, key: any): any;
set(node: any, key: any, value: any): any;
bind(node: any, key: any, expr: any): any;
unbind(node: any, key: any): any;
add(node: any, target: any): any;
remove(node: any): any;
}
| cchudzicki/mathbox | build/esm/stage/controller.d.ts | TypeScript | mit | 437 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
export class Controller {
constructor(model, primitives) {
this.model = model;
this.primitives = primitives;
}
getRoot() {
return this.model.getRoot();
}
getTypes() {
return this.primitives.getTypes();
}
make(type, options, binds) {
return this.primitives.make(type, options, binds);
}
get(node, key) {
return node.get(key);
}
set(node, key, value) {
try {
return node.set(key, value);
}
catch (e) {
node.print(null, "warn");
return console.error(e);
}
}
bind(node, key, expr) {
try {
return node.bind(key, expr);
}
catch (e) {
node.print(null, "warn");
return console.error(e);
}
}
unbind(node, key) {
try {
return node.unbind(key);
}
catch (e) {
node.print(null, "warn");
return console.error(e);
}
}
add(node, target) {
if (target == null) {
target = this.model.getRoot();
}
return target.add(node);
}
remove(node) {
const target = node.parent;
if (target) {
return target.remove(node);
}
}
}
| cchudzicki/mathbox | build/esm/stage/controller.js | JavaScript | mit | 1,659 |
export * from "./animator.js";
export * from "./api.js";
export * from "./controller.js";
| cchudzicki/mathbox | build/esm/stage/index.d.ts | TypeScript | mit | 90 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
export * from "./animator.js";
export * from "./api.js";
export * from "./controller.js";
| cchudzicki/mathbox | build/esm/stage/index.js | JavaScript | mit | 199 |
export {};
| cchudzicki/mathbox | build/esm/test/primitives/types/types.spec.d.ts | TypeScript | mit | 11 |
import type * as TT from "./node_types";
import type { Alignments, Axes, AxesWithZero, BlendingModes, Optional } from "./primitives/types/types_typed";
export * from "./node_types";
export type { Alignments, Axes, AxesWithZero, BlendingModes, Optional };
export declare type Props = {
area: TT.AreaProps;
array: TT.ArrayProps;
axis: TT.AxisProps;
camera: TT.CameraProps;
cartesian: TT.CartesianProps;
cartesian4: TT.Cartesian4Props;
clamp: TT.ClampProps;
clock: TT.ClockProps;
compose: TT.ComposeProps;
dom: TT.DomProps;
face: TT.FaceProps;
format: TT.FormatProps;
fragment: TT.FragmentProps;
grid: TT.GridProps;
group: TT.GroupProps;
grow: TT.GrowProps;
html: TT.HtmlProps;
inherit: TT.InheritProps;
interval: TT.IntervalProps;
join: TT.JoinProps;
label: TT.LabelProps;
layer: TT.LayerProps;
lerp: TT.LerpProps;
line: TT.LineProps;
mask: TT.MaskProps;
matrix: TT.MatrixProps;
memo: TT.MemoProps;
move: TT.MoveProps;
now: TT.NowProps;
play: TT.PlayProps;
point: TT.PointProps;
polar: TT.PolarProps;
present: TT.PresentProps;
readback: TT.ReadbackProps;
repeat: TT.RepeatProps;
resample: TT.ResampleProps;
retext: TT.RetextProps;
reveal: TT.RevealProps;
root: TT.RootProps;
rtt: TT.RttProps;
scale: TT.ScaleProps;
shader: TT.ShaderProps;
slice: TT.SliceProps;
slide: TT.SlideProps;
spherical: TT.SphericalProps;
split: TT.SplitProps;
spread: TT.SpreadProps;
step: TT.StepProps;
stereographic: TT.StereographicProps;
stereographic4: TT.Stereographic4Props;
strip: TT.StripProps;
subdivide: TT.SubdivideProps;
surface: TT.SurfaceProps;
swizzle: TT.SwizzleProps;
text: TT.TextProps;
ticks: TT.TicksProps;
transform: TT.TransformProps;
transform4: TT.Transform4Props;
transpose: TT.TransposeProps;
unit: TT.UnitProps;
vector: TT.VectorProps;
vertex: TT.VertexProps;
view: TT.ViewProps;
volume: TT.VolumeProps;
voxel: TT.VoxelProps;
};
export declare type PropsNoramlized = {
area: TT.AreaPropsNormalized;
array: TT.ArrayPropsNormalized;
axis: TT.AxisPropsNormalized;
camera: TT.CameraPropsNormalized;
cartesian: TT.CartesianPropsNormalized;
cartesian4: TT.Cartesian4PropsNormalized;
clamp: TT.ClampPropsNormalized;
clock: TT.ClockPropsNormalized;
compose: TT.ComposePropsNormalized;
dom: TT.DomPropsNormalized;
face: TT.FacePropsNormalized;
format: TT.FormatPropsNormalized;
fragment: TT.FragmentPropsNormalized;
grid: TT.GridPropsNormalized;
group: TT.GroupPropsNormalized;
grow: TT.GrowPropsNormalized;
html: TT.HtmlPropsNormalized;
inherit: TT.InheritPropsNormalized;
interval: TT.IntervalPropsNormalized;
join: TT.JoinPropsNormalized;
label: TT.LabelPropsNormalized;
layer: TT.LayerPropsNormalized;
lerp: TT.LerpPropsNormalized;
line: TT.LinePropsNormalized;
mask: TT.MaskPropsNormalized;
matrix: TT.MatrixPropsNormalized;
memo: TT.MemoPropsNormalized;
move: TT.MovePropsNormalized;
now: TT.NowPropsNormalized;
play: TT.PlayPropsNormalized;
point: TT.PointPropsNormalized;
polar: TT.PolarPropsNormalized;
present: TT.PresentPropsNormalized;
readback: TT.ReadbackPropsNormalized;
repeat: TT.RepeatPropsNormalized;
resample: TT.ResamplePropsNormalized;
retext: TT.RetextPropsNormalized;
reveal: TT.RevealPropsNormalized;
root: TT.RootPropsNormalized;
rtt: TT.RttPropsNormalized;
scale: TT.ScalePropsNormalized;
shader: TT.ShaderPropsNormalized;
slice: TT.SlicePropsNormalized;
slide: TT.SlidePropsNormalized;
spherical: TT.SphericalPropsNormalized;
split: TT.SplitPropsNormalized;
spread: TT.SpreadPropsNormalized;
step: TT.StepPropsNormalized;
stereographic: TT.StereographicPropsNormalized;
stereographic4: TT.Stereographic4PropsNormalized;
strip: TT.StripPropsNormalized;
subdivide: TT.SubdividePropsNormalized;
surface: TT.SurfacePropsNormalized;
swizzle: TT.SwizzlePropsNormalized;
text: TT.TextPropsNormalized;
ticks: TT.TicksPropsNormalized;
transform: TT.TransformPropsNormalized;
transform4: TT.Transform4PropsNormalized;
transpose: TT.TransposePropsNormalized;
unit: TT.UnitPropsNormalized;
vector: TT.VectorPropsNormalized;
vertex: TT.VertexPropsNormalized;
view: TT.ViewPropsNormalized;
volume: TT.VolumePropsNormalized;
voxel: TT.VoxelPropsNormalized;
};
export declare type NodeType = keyof Props;
/**
* MathBox (virtual)-DOM Nodes.
*
* Usually one interacts with these via a selection.
*/
export interface MathboxNode<T extends NodeType = NodeType> {
type: string;
props: PropsNoramlized[T];
}
/**
* @typeParam Type The type(s) of MathBox nodes in this selection.
*/
export interface MathboxSelection<Type extends NodeType> {
/**
* Set properties on all nodes in this selection.
*/
set(props: Props[Type]): MathboxSelection<Type>;
/**
* Set a single property on all nodes in this selection
*/
set<P extends keyof Props[Type]>(prop: P, value: Props[Type][P]): MathboxSelection<Type>;
/**
* Return all props for the first node in this node.
*/
get(): PropsNoramlized[Type];
/**
* Retrieve a specific property value for the first node in this selection.
*/
get<P extends keyof PropsNoramlized[Type]>(prop: P): PropsNoramlized[Type][P];
/**
* Return an array of props for all nodes in this node.
*/
getAll(): PropsNoramlized[Type][];
remove: () => void;
print: () => MathboxSelection<Type>;
select: (query: string) => MathboxSelection<NodeType>;
/**
* Print (in the console) the DOM nodes in this selection.
* Called automatically on first load.
*/
inspect(): void;
/** Display a visual representation of all shader snippets, how they are wired, with the GLSL available on mouseover. */
debug(): void;
[index: number]: MathboxNode<Type>;
/**
* The number of nodes contained in this selection.
*/
length: number;
/**
* Iterate over a selection's nodes in document order and discard the return
* values. Returns the original selection.
*/
each(cb: (node: MathboxNode<Type>, i?: number, selection?: MathboxSelection<Type>) => void): MathboxSelection<Type>;
/**
* Iterate over a selection's nodes in document order and return the resulting
* values as an array.
* */
map<S>(cb: (node: MathboxNode<Type>, i?: number, selection?: MathboxSelection<Type>) => S): S[];
/**
* Return the ith node in this selection, indexed from 0.
*/
eq(i: number): MathboxSelection<Type>;
/**
* Create new `area` node.
*
* See also {@link AreaProps} and {@link AreaPropsNormalized}.
*
* @category data
*/
area(props?: TT.AreaProps): MathboxSelection<"area">;
/**
* Create new `array` node.
*
* See also {@link ArrayProps} and {@link ArrayPropsNormalized}.
*
* @category data
*/
array(props?: TT.ArrayProps): MathboxSelection<"array">;
/**
* Create new `axis` node.
*
* See also {@link AxisProps} and {@link AxisPropsNormalized}.
*
* @category draw
*/
axis(props?: TT.AxisProps): MathboxSelection<"axis">;
/**
* Create new `camera` node.
*
* See also {@link CameraProps} and {@link CameraPropsNormalized}.
*
* @category camera
*/
camera(props?: TT.CameraProps): MathboxSelection<"camera">;
/**
* Create new `cartesian` node.
*
* See also {@link CartesianProps} and {@link CartesianPropsNormalized}.
*
* @category view
*/
cartesian(props?: TT.CartesianProps): MathboxSelection<"cartesian">;
/**
* Create new `cartesian4` node.
*
* See also {@link Cartesian4Props} and {@link Cartesian4PropsNormalized}.
*
* @category view
*/
cartesian4(props?: TT.Cartesian4Props): MathboxSelection<"cartesian4">;
/**
* Create new `clamp` node.
*
* See also {@link ClampProps} and {@link ClampPropsNormalized}.
*
* @category operator
*/
clamp(props?: TT.ClampProps): MathboxSelection<"clamp">;
/**
* Create new `clock` node.
*
* See also {@link ClockProps} and {@link ClockPropsNormalized}.
*
* @category time
*/
clock(props?: TT.ClockProps): MathboxSelection<"clock">;
/**
* Create new `compose` node.
*
* See also {@link ComposeProps} and {@link ComposePropsNormalized}.
*
* @category rtt
*/
compose(props?: TT.ComposeProps): MathboxSelection<"compose">;
/**
* Create new `dom` node.
*
* See also {@link DomProps} and {@link DomPropsNormalized}.
*
* @category overlay
*/
dom(props?: TT.DomProps): MathboxSelection<"dom">;
/**
* Create new `face` node.
*
* See also {@link FaceProps} and {@link FacePropsNormalized}.
*
* @category draw
*/
face(props?: TT.FaceProps): MathboxSelection<"face">;
/**
* Create new `format` node.
*
* See also {@link FormatProps} and {@link FormatPropsNormalized}.
*
* @category text
*/
format(props?: TT.FormatProps): MathboxSelection<"format">;
/**
* Create new `fragment` node.
*
* See also {@link FragmentProps} and {@link FragmentPropsNormalized}.
*
* @category transform
*/
fragment(props?: TT.FragmentProps): MathboxSelection<"fragment">;
/**
* Create new `grid` node.
*
* See also {@link GridProps} and {@link GridPropsNormalized}.
*
* @category draw
*/
grid(props?: TT.GridProps): MathboxSelection<"grid">;
/**
* Create new `group` node.
*
* See also {@link GroupProps} and {@link GroupPropsNormalized}.
*
* @category base
*/
group(props?: TT.GroupProps): MathboxSelection<"group">;
/**
* Create new `grow` node.
*
* See also {@link GrowProps} and {@link GrowPropsNormalized}.
*
* @category operator
*/
grow(props?: TT.GrowProps): MathboxSelection<"grow">;
/**
* Create new `html` node.
*
* See also {@link HtmlProps} and {@link HtmlPropsNormalized}.
*
* @category overlay
*/
html(props?: TT.HtmlProps): MathboxSelection<"html">;
/**
* Create new `inherit` node.
*
* See also {@link InheritProps} and {@link InheritPropsNormalized}.
*
* @category base
*/
inherit(props?: TT.InheritProps): MathboxSelection<"inherit">;
/**
* Create new `interval` node.
*
* See also {@link IntervalProps} and {@link IntervalPropsNormalized}.
*
* @category data
*/
interval(props?: TT.IntervalProps): MathboxSelection<"interval">;
/**
* Create new `join` node.
*
* See also {@link JoinProps} and {@link JoinPropsNormalized}.
*
* @category operator
*/
join(props?: TT.JoinProps): MathboxSelection<"join">;
/**
* Create new `label` node.
*
* See also {@link LabelProps} and {@link LabelPropsNormalized}.
*
* @category text
*/
label(props?: TT.LabelProps): MathboxSelection<"label">;
/**
* Create new `layer` node.
*
* See also {@link LayerProps} and {@link LayerPropsNormalized}.
*
* @category transform
*/
layer(props?: TT.LayerProps): MathboxSelection<"layer">;
/**
* Create new `lerp` node.
*
* See also {@link LerpProps} and {@link LerpPropsNormalized}.
*
* @category operator
*/
lerp(props?: TT.LerpProps): MathboxSelection<"lerp">;
/**
* Create new `line` node.
*
* See also {@link LineProps} and {@link LinePropsNormalized}.
*
* @category draw
*/
line(props?: TT.LineProps): MathboxSelection<"line">;
/**
* Create new `mask` node.
*
* See also {@link MaskProps} and {@link MaskPropsNormalized}.
*
* @category transform
*/
mask(props?: TT.MaskProps): MathboxSelection<"mask">;
/**
* Create new `matrix` node.
*
* See also {@link MatrixProps} and {@link MatrixPropsNormalized}.
*
* @category data
*/
matrix(props?: TT.MatrixProps): MathboxSelection<"matrix">;
/**
* Create new `memo` node.
*
* See also {@link MemoProps} and {@link MemoPropsNormalized}.
*
* @category operator
*/
memo(props?: TT.MemoProps): MathboxSelection<"memo">;
/**
* Create new `move` node.
*
* See also {@link MoveProps} and {@link MovePropsNormalized}.
*
* @category present
*/
move(props?: TT.MoveProps): MathboxSelection<"move">;
/**
* Create new `now` node.
*
* See also {@link NowProps} and {@link NowPropsNormalized}.
*
* @category time
*/
now(props?: TT.NowProps): MathboxSelection<"now">;
/**
* Create new `play` node.
*
* See also {@link PlayProps} and {@link PlayPropsNormalized}.
*
* @category present
*/
play(props?: TT.PlayProps): MathboxSelection<"play">;
/**
* Create new `point` node.
*
* See also {@link PointProps} and {@link PointPropsNormalized}.
*
* @category draw
*/
point(props?: TT.PointProps): MathboxSelection<"point">;
/**
* Create new `polar` node.
*
* See also {@link PolarProps} and {@link PolarPropsNormalized}.
*
* @category view
*/
polar(props?: TT.PolarProps): MathboxSelection<"polar">;
/**
* Create new `present` node.
*
* See also {@link PresentProps} and {@link PresentPropsNormalized}.
*
* @category present
*/
present(props?: TT.PresentProps): MathboxSelection<"present">;
/**
* Create new `readback` node.
*
* See also {@link ReadbackProps} and {@link ReadbackPropsNormalized}.
*
* @category operator
*/
readback(props?: TT.ReadbackProps): MathboxSelection<"readback">;
/**
* Create new `repeat` node.
*
* See also {@link RepeatProps} and {@link RepeatPropsNormalized}.
*
* @category operator
*/
repeat(props?: TT.RepeatProps): MathboxSelection<"repeat">;
/**
* Create new `resample` node.
*
* See also {@link ResampleProps} and {@link ResamplePropsNormalized}.
*
* @category operator
*/
resample(props?: TT.ResampleProps): MathboxSelection<"resample">;
/**
* Create new `retext` node.
*
* See also {@link RetextProps} and {@link RetextPropsNormalized}.
*
* @category text
*/
retext(props?: TT.RetextProps): MathboxSelection<"retext">;
/**
* Create new `reveal` node.
*
* See also {@link RevealProps} and {@link RevealPropsNormalized}.
*
* @category present
*/
reveal(props?: TT.RevealProps): MathboxSelection<"reveal">;
/**
* Create new `root` node.
*
* See also {@link RootProps} and {@link RootPropsNormalized}.
*
* @category base
*/
root(props?: TT.RootProps): MathboxSelection<"root">;
/**
* Create new `rtt` node.
*
* See also {@link RttProps} and {@link RttPropsNormalized}.
*
* @category rtt
*/
rtt(props?: TT.RttProps): MathboxSelection<"rtt">;
/**
* Create new `scale` node.
*
* See also {@link ScaleProps} and {@link ScalePropsNormalized}.
*
* @category data
*/
scale(props?: TT.ScaleProps): MathboxSelection<"scale">;
/**
* Create new `shader` node.
*
* See also {@link ShaderProps} and {@link ShaderPropsNormalized}.
*
* @category shader
*/
shader(props?: TT.ShaderProps): MathboxSelection<"shader">;
/**
* Create new `slice` node.
*
* See also {@link SliceProps} and {@link SlicePropsNormalized}.
*
* @category operator
*/
slice(props?: TT.SliceProps): MathboxSelection<"slice">;
/**
* Create new `slide` node.
*
* See also {@link SlideProps} and {@link SlidePropsNormalized}.
*
* @category present
*/
slide(props?: TT.SlideProps): MathboxSelection<"slide">;
/**
* Create new `spherical` node.
*
* See also {@link SphericalProps} and {@link SphericalPropsNormalized}.
*
* @category view
*/
spherical(props?: TT.SphericalProps): MathboxSelection<"spherical">;
/**
* Create new `split` node.
*
* See also {@link SplitProps} and {@link SplitPropsNormalized}.
*
* @category operator
*/
split(props?: TT.SplitProps): MathboxSelection<"split">;
/**
* Create new `spread` node.
*
* See also {@link SpreadProps} and {@link SpreadPropsNormalized}.
*
* @category operator
*/
spread(props?: TT.SpreadProps): MathboxSelection<"spread">;
/**
* Create new `step` node.
*
* See also {@link StepProps} and {@link StepPropsNormalized}.
*
* @category present
*/
step(props?: TT.StepProps): MathboxSelection<"step">;
/**
* Create new `stereographic` node.
*
* See also {@link StereographicProps} and {@link StereographicPropsNormalized}.
*
* @category view
*/
stereographic(props?: TT.StereographicProps): MathboxSelection<"stereographic">;
/**
* Create new `stereographic4` node.
*
* See also {@link Stereographic4Props} and {@link Stereographic4PropsNormalized}.
*
* @category view
*/
stereographic4(props?: TT.Stereographic4Props): MathboxSelection<"stereographic4">;
/**
* Create new `strip` node.
*
* See also {@link StripProps} and {@link StripPropsNormalized}.
*
* @category draw
*/
strip(props?: TT.StripProps): MathboxSelection<"strip">;
/**
* Create new `subdivide` node.
*
* See also {@link SubdivideProps} and {@link SubdividePropsNormalized}.
*
* @category operator
*/
subdivide(props?: TT.SubdivideProps): MathboxSelection<"subdivide">;
/**
* Create new `surface` node.
*
* See also {@link SurfaceProps} and {@link SurfacePropsNormalized}.
*
* @category draw
*/
surface(props?: TT.SurfaceProps): MathboxSelection<"surface">;
/**
* Create new `swizzle` node.
*
* See also {@link SwizzleProps} and {@link SwizzlePropsNormalized}.
*
* @category operator
*/
swizzle(props?: TT.SwizzleProps): MathboxSelection<"swizzle">;
/**
* Create new `text` node.
*
* See also {@link TextProps} and {@link TextPropsNormalized}.
*
* @category text
*/
text(props?: TT.TextProps): MathboxSelection<"text">;
/**
* Create new `ticks` node.
*
* See also {@link TicksProps} and {@link TicksPropsNormalized}.
*
* @category draw
*/
ticks(props?: TT.TicksProps): MathboxSelection<"ticks">;
/**
* Create new `transform` node.
*
* See also {@link TransformProps} and {@link TransformPropsNormalized}.
*
* @category transform
*/
transform(props?: TT.TransformProps): MathboxSelection<"transform">;
/**
* Create new `transform4` node.
*
* See also {@link Transform4Props} and {@link Transform4PropsNormalized}.
*
* @category transform
*/
transform4(props?: TT.Transform4Props): MathboxSelection<"transform4">;
/**
* Create new `transpose` node.
*
* See also {@link TransposeProps} and {@link TransposePropsNormalized}.
*
* @category operator
*/
transpose(props?: TT.TransposeProps): MathboxSelection<"transpose">;
/**
* Create new `unit` node.
*
* See also {@link UnitProps} and {@link UnitPropsNormalized}.
*
* @category base
*/
unit(props?: TT.UnitProps): MathboxSelection<"unit">;
/**
* Create new `vector` node.
*
* See also {@link VectorProps} and {@link VectorPropsNormalized}.
*
* @category draw
*/
vector(props?: TT.VectorProps): MathboxSelection<"vector">;
/**
* Create new `vertex` node.
*
* See also {@link VertexProps} and {@link VertexPropsNormalized}.
*
* @category transform
*/
vertex(props?: TT.VertexProps): MathboxSelection<"vertex">;
/**
* Create new `view` node.
*
* See also {@link ViewProps} and {@link ViewPropsNormalized}.
*
* @category view
*/
view(props?: TT.ViewProps): MathboxSelection<"view">;
/**
* Create new `volume` node.
*
* See also {@link VolumeProps} and {@link VolumePropsNormalized}.
*
* @category data
*/
volume(props?: TT.VolumeProps): MathboxSelection<"volume">;
/**
* Create new `voxel` node.
*
* See also {@link VoxelProps} and {@link VoxelPropsNormalized}.
*
* @category data
*/
voxel(props?: TT.VoxelProps): MathboxSelection<"voxel">;
}
export declare function mathBox(opts?: any): MathboxSelection<"root">;
| cchudzicki/mathbox | build/esm/types.d.ts | TypeScript | mit | 21,255 |
export * from "./node_types";
| cchudzicki/mathbox | build/esm/types.js | JavaScript | mit | 30 |
export function setOrigin(vec: any, dimensions: any, origin: any): any;
export function addOrigin(vec: any, dimension: any, origin: any): any;
export function setDimension(vec: any, dimension: any): any;
export function setDimensionNormal(vec: any, dimension: any): any;
export function recenterAxis(x: any, dx: any, bend: any, f: any): number[];
| cchudzicki/mathbox | build/esm/util/axis.d.ts | TypeScript | mit | 347 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
import { Vector4 } from "three/src/math/Vector4.js";
export const setOrigin = function (vec, dimensions, origin) {
if (+dimensions === dimensions) {
dimensions = [dimensions];
}
const x = Array.from(dimensions).includes(1) ? 0 : origin.x;
const y = Array.from(dimensions).includes(2) ? 0 : origin.y;
const z = Array.from(dimensions).includes(3) ? 0 : origin.z;
const w = Array.from(dimensions).includes(4) ? 0 : origin.w;
return vec.set(x, y, z, w);
};
export const addOrigin = (function () {
const v = new Vector4();
return function (vec, dimension, origin) {
setOrigin(v, dimension, origin);
return vec.add(v);
};
})();
export const setDimension = function (vec, dimension) {
const x = dimension === 1 ? 1 : 0;
const y = dimension === 2 ? 1 : 0;
const z = dimension === 3 ? 1 : 0;
const w = dimension === 4 ? 1 : 0;
return vec.set(x, y, z, w);
};
export const setDimensionNormal = function (vec, dimension) {
const x = dimension === 1 ? 1 : 0;
const y = dimension === 2 ? 1 : 0;
const z = dimension === 3 ? 1 : 0;
const w = dimension === 4 ? 1 : 0;
return vec.set(y, z + x, w, 0);
};
export const recenterAxis = (function () {
const axis = [0, 0];
return function (x, dx, bend, f) {
if (f == null) {
f = 0;
}
if (bend > 0) {
const x1 = x;
const x2 = x + dx;
const abs = Math.max(Math.abs(x1), Math.abs(x2));
const fabs = abs * f;
const min = Math.min(x1, x2);
const max = Math.max(x1, x2);
x = min + (-abs + fabs - min) * bend;
dx = max + (abs + fabs - max) * bend - x;
}
axis[0] = x;
axis[1] = dx;
return axis;
};
})();
| cchudzicki/mathbox | build/esm/util/axis.js | JavaScript | mit | 2,209 |
export function getSizes(data: any): any[];
export function getDimensions(data: any, spec: any): {
items: any;
channels: any;
width: any;
height: any;
depth: any;
};
export function repeatCall(call: any, times: any): (() => any) | undefined;
export function makeEmitter(thunk: any, items: any, channels: any): (emit: any) => any;
export function getThunk(data: any): (() => any) | undefined;
export function getStreamer(array: any, samples: any, channels: any, items: any): {
emit: ((x: any, y: any, z: any, w: any) => void) | undefined;
consume: ((emit: any) => void) | undefined;
skip: ((n: any) => void) | undefined;
count: () => any;
done: () => boolean;
reset: () => number;
};
export function getLerpEmitter(expr1: any, expr2: any): (emit: any, x: any, y: any, z: any, w: any, i: any, j: any, k: any, l: any, d: any, t: any) => any[];
export function getLerpThunk(data1: any, data2: any): Float32Array;
| cchudzicki/mathbox | build/esm/util/data.d.ts | TypeScript | mit | 953 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS104: Avoid inline assignments
* DS202: Simplify dynamic range loops
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
export const getSizes = function (data) {
const sizes = [];
let array = data;
while (typeof array !== "string" &&
(array != null ? array.length : undefined) != null) {
sizes.push(array.length);
array = array[0];
}
return sizes;
};
export const getDimensions = function (data, spec) {
let left;
if (spec == null) {
spec = {};
}
const { items, channels, width, height, depth } = spec;
const dims = {};
if (!data || !data.length) {
return {
items,
channels,
width: width != null ? width : 0,
height: height != null ? height : 0,
depth: depth != null ? depth : 0,
};
}
const sizes = getSizes(data);
const nesting = sizes.length;
dims.channels = channels !== 1 && sizes.length > 1 ? sizes.pop() : channels;
dims.items = items !== 1 && sizes.length > 1 ? sizes.pop() : items;
dims.width = width !== 1 && sizes.length > 1 ? sizes.pop() : width;
dims.height = height !== 1 && sizes.length > 1 ? sizes.pop() : height;
dims.depth = depth !== 1 && sizes.length > 1 ? sizes.pop() : depth;
let levels = nesting;
if (channels === 1) {
levels++;
}
if (items === 1 && levels > 1) {
levels++;
}
if (width === 1 && levels > 2) {
levels++;
}
if (height === 1 && levels > 3) {
levels++;
}
let n = (left = sizes.pop()) != null ? left : 1;
if (levels <= 1) {
n /= dims.channels != null ? dims.channels : 1;
}
if (levels <= 2) {
n /= dims.items != null ? dims.items : 1;
}
if (levels <= 3) {
n /= dims.width != null ? dims.width : 1;
}
if (levels <= 4) {
n /= dims.height != null ? dims.height : 1;
}
n = Math.floor(n);
if (dims.width == null) {
dims.width = n;
n = 1;
}
if (dims.height == null) {
dims.height = n;
n = 1;
}
if (dims.depth == null) {
dims.depth = n;
n = 1;
}
return dims;
};
export const repeatCall = function (call, times) {
switch (times) {
case 0:
return () => true;
case 1:
return () => call();
case 2:
return function () {
call();
return call();
};
case 3:
return function () {
call();
call();
call();
return call();
};
case 4:
return function () {
call();
call();
call();
return call();
};
case 6:
return function () {
call();
call();
call();
call();
call();
return call();
};
case 8:
return function () {
call();
call();
call();
call();
call();
return call();
};
}
};
export const makeEmitter = function (thunk, items, channels) {
let outer;
const inner = (() => {
switch (channels) {
case 0:
return () => true;
case 1:
return (emit) => emit(thunk());
case 2:
return (emit) => emit(thunk(), thunk());
case 3:
return (emit) => emit(thunk(), thunk(), thunk());
case 4:
return (emit) => emit(thunk(), thunk(), thunk(), thunk());
case 6:
return (emit) => emit(thunk(), thunk(), thunk(), thunk(), thunk(), thunk());
case 8:
return (emit) => emit(thunk(), thunk(), thunk(), thunk(), thunk(), thunk(), thunk(), thunk());
}
})();
let next = null;
while (items > 0) {
const n = Math.min(items, 8);
outer = (() => {
switch (n) {
case 1:
return (emit) => inner(emit);
case 2:
return function (emit) {
inner(emit);
return inner(emit);
};
case 3:
return function (emit) {
inner(emit);
inner(emit);
return inner(emit);
};
case 4:
return function (emit) {
inner(emit);
inner(emit);
inner(emit);
return inner(emit);
};
case 5:
return function (emit) {
inner(emit);
inner(emit);
inner(emit);
inner(emit);
return inner(emit);
};
case 6:
return function (emit) {
inner(emit);
inner(emit);
inner(emit);
inner(emit);
inner(emit);
return inner(emit);
};
case 7:
return function (emit) {
inner(emit);
inner(emit);
inner(emit);
inner(emit);
inner(emit);
inner(emit);
return inner(emit);
};
case 8:
return function (emit) {
inner(emit);
inner(emit);
inner(emit);
inner(emit);
inner(emit);
inner(emit);
inner(emit);
return inner(emit);
};
}
})();
if (next != null) {
next = ((outer, next) => function (emit) {
outer(emit);
return next(emit);
})(outer, next);
}
else {
next = outer;
}
items -= n;
}
outer = next != null ? next : () => true;
outer.reset = thunk.reset;
outer.rebind = thunk.rebind;
return outer;
};
export const getThunk = function (data) {
let thunk;
let j, k, l, m;
let sizes = getSizes(data);
const nesting = sizes.length;
let a = sizes.pop();
let b = sizes.pop();
let c = sizes.pop();
const d = sizes.pop();
let i, first, second, third, fourth;
switch (nesting) {
case 0:
thunk = () => 0;
thunk.reset = function () { };
break;
case 1:
i = 0;
thunk = () => data[i++];
thunk.reset = () => (i = 0);
break;
case 2:
i = j = 0;
first = data[j] != null ? data[j] : [];
thunk = function () {
const x = first[i++];
if (i === a) {
i = 0;
j++;
first = data[j] != null ? data[j] : [];
}
return x;
};
thunk.reset = function () {
i = j = 0;
first = data[j] != null ? data[j] : [];
};
break;
case 3:
i = j = k = 0;
second = data[k] != null ? data[k] : [];
first = second[j] != null ? second[j] : [];
thunk = function () {
const x = first[i++];
if (i === a) {
i = 0;
j++;
if (j === b) {
j = 0;
k++;
second = data[k] != null ? data[k] : [];
}
first = second[j] != null ? second[j] : [];
}
return x;
};
thunk.reset = function () {
i = j = k = 0;
second = data[k] != null ? data[k] : [];
first = second[j] != null ? second[j] : [];
};
break;
case 4:
i = j = k = l = 0;
third = data[l] != null ? data[l] : [];
second = third[k] != null ? third[k] : [];
first = second[j] != null ? second[j] : [];
thunk = function () {
const x = first[i++];
if (i === a) {
i = 0;
j++;
if (j === b) {
j = 0;
k++;
if (k === c) {
k = 0;
l++;
third = data[l] != null ? data[l] : [];
}
second = third[k] != null ? third[k] : [];
}
first = second[j] != null ? second[j] : [];
}
return x;
};
thunk.reset = function () {
i = j = k = l = 0;
third = data[l] != null ? data[l] : [];
second = third[k] != null ? third[k] : [];
first = second[j] != null ? second[j] : [];
};
break;
case 5:
i = j = k = l = m = 0;
fourth = data[m] != null ? data[m] : [];
third = fourth[l] != null ? fourth[l] : [];
second = third[k] != null ? third[k] : [];
first = second[j] != null ? second[j] : [];
thunk = function () {
const x = first[i++];
if (i === a) {
i = 0;
j++;
if (j === b) {
j = 0;
k++;
if (k === c) {
k = 0;
l++;
if (l === d) {
l = 0;
m++;
fourth = data[m] != null ? data[m] : [];
}
third = fourth[l] != null ? fourth[l] : [];
}
second = third[k] != null ? third[k] : [];
}
first = second[j] != null ? second[j] : [];
}
return x;
};
thunk.reset = function () {
i = j = k = l = m = 0;
fourth = data[m] != null ? data[m] : [];
third = fourth[l] != null ? fourth[l] : [];
second = third[k] != null ? third[k] : [];
first = second[j] != null ? second[j] : [];
};
break;
}
thunk.rebind = function (d) {
data = d;
sizes = getSizes(data);
if (sizes.length) {
a = sizes.pop();
}
if (sizes.length) {
b = sizes.pop();
}
if (sizes.length) {
c = sizes.pop();
}
if (sizes.length) {
return (d = sizes.pop());
}
};
return thunk;
};
export const getStreamer = function (array, samples, channels, items) {
let i, j;
let limit = (i = j = 0);
const reset = function () {
limit = samples * channels * items;
return (i = j = 0);
};
const count = () => j;
const done = () => limit - i <= 0;
const skip = (() => {
switch (channels) {
case 1:
return function (n) {
i += n;
j += n;
};
case 2:
return function (n) {
i += n * 2;
j += n;
};
case 3:
return function (n) {
i += n * 3;
j += n;
};
case 4:
return function (n) {
i += n * 4;
j += n;
};
}
})();
const consume = (() => {
switch (channels) {
case 1:
return function (emit) {
emit(array[i++]);
++j;
};
case 2:
return function (emit) {
emit(array[i++], array[i++]);
++j;
};
case 3:
return function (emit) {
emit(array[i++], array[i++], array[i++]);
++j;
};
case 4:
return function (emit) {
emit(array[i++], array[i++], array[i++], array[i++]);
++j;
};
}
})();
const emit = (() => {
switch (channels) {
case 1:
return function (x) {
array[i++] = x;
++j;
};
case 2:
return function (x, y) {
array[i++] = x;
array[i++] = y;
++j;
};
case 3:
return function (x, y, z) {
array[i++] = x;
array[i++] = y;
array[i++] = z;
++j;
};
case 4:
return function (x, y, z, w) {
array[i++] = x;
array[i++] = y;
array[i++] = z;
array[i++] = w;
++j;
};
}
})();
consume.reset = reset;
emit.reset = reset;
reset();
return { emit, consume, skip, count, done, reset };
};
export const getLerpEmitter = function (expr1, expr2) {
let emitter, lerp2, q, r, s;
const scratch = new Float32Array(4096);
let lerp1 = (lerp2 = 0.5);
let p = (q = r = s = 0);
const emit1 = function (x, y, z, w) {
r++;
scratch[p++] = x * lerp1;
scratch[p++] = y * lerp1;
scratch[p++] = z * lerp1;
return (scratch[p++] = w * lerp1);
};
const emit2 = function (x, y, z, w) {
s++;
scratch[q++] += x * lerp2;
scratch[q++] += y * lerp2;
scratch[q++] += z * lerp2;
return (scratch[q++] += w * lerp2);
};
const args = Math.max(expr1.length, expr2.length);
if (args <= 3) {
emitter = function (emit, x, i) {
p = q = r = s = 0;
expr1(emit1, x, i);
expr2(emit2, x, i);
const n = Math.min(r, s);
let l = 0;
return __range__(0, n, false).map((_k) => emit(scratch[l++], scratch[l++], scratch[l++], scratch[l++]));
};
}
else if (args <= 5) {
emitter = function (emit, x, y, i, j) {
p = q = r = s = 0;
expr1(emit1, x, y, i, j);
expr2(emit2, x, y, i, j);
const n = Math.min(r, s);
let l = 0;
return __range__(0, n, false).map((_k) => emit(scratch[l++], scratch[l++], scratch[l++], scratch[l++]));
};
}
else if (args <= 7) {
emitter = function (emit, x, y, z, i, j, k) {
p = q = r = s = 0;
expr1(emit1, x, y, z, i, j, k);
expr2(emit2, x, y, z, i, j, k);
const n = Math.min(r, s);
let l = 0;
return (() => {
let asc, end;
const result = [];
for (k = 0, end = n, asc = 0 <= end; asc ? k < end : k > end; asc ? k++ : k--) {
result.push(emit(scratch[l++], scratch[l++], scratch[l++], scratch[l++]));
}
return result;
})();
};
}
else if (args <= 9) {
emitter = function (emit, x, y, z, w, i, j, k, l) {
p = q = r = s = 0;
expr1(emit1, x, y, z, w, i, j, k, l);
expr2(emit2, x, y, z, w, i, j, k, l);
const n = Math.min(r, s);
l = 0;
return (() => {
let asc, end;
const result = [];
for (k = 0, end = n, asc = 0 <= end; asc ? k < end : k > end; asc ? k++ : k--) {
result.push(emit(scratch[l++], scratch[l++], scratch[l++], scratch[l++]));
}
return result;
})();
};
}
else {
emitter = function (emit, x, y, z, w, i, j, k, l, d, t) {
p = q = 0;
expr1(emit1, x, y, z, w, i, j, k, l, d, t);
expr2(emit2, x, y, z, w, i, j, k, l, d, t);
const n = Math.min(r, s);
l = 0;
return (() => {
let asc, end;
const result = [];
for (k = 0, end = n, asc = 0 <= end; asc ? k < end : k > end; asc ? k++ : k--) {
result.push(emit(scratch[l++], scratch[l++], scratch[l++], scratch[l++]));
}
return result;
})();
};
}
emitter.lerp = function (f) {
let ref;
return ([lerp1, lerp2] = Array.from((ref = [1 - f, f]))), ref;
};
return emitter;
};
export const getLerpThunk = function (data1, data2) {
// Get sizes
const n1 = getSizes(data1).reduce((a, b) => a * b);
const n2 = getSizes(data2).reduce((a, b) => a * b);
const n = Math.min(n1, n2);
// Create data thunks to copy (multi-)array
const thunk1 = getThunk(data1);
const thunk2 = getThunk(data2);
// Create scratch array
const scratch = new Float32Array(n);
scratch.lerp = function (f) {
thunk1.reset();
thunk2.reset();
let i = 0;
return (() => {
const result = [];
while (i < n) {
const a = thunk1();
const b = thunk2();
result.push((scratch[i++] = a + (b - a) * f));
}
return result;
})();
};
return scratch;
};
function __range__(left, right, inclusive) {
const range = [];
const ascending = left < right;
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
range.push(i);
}
return range;
}
| cchudzicki/mathbox | build/esm/util/data.js | JavaScript | mit | 19,206 |
export function clamp(x: any, a: any, b: any): number;
export function cosine(x: any): number;
export function binary(x: any): number;
export function hold(x: any): number;
| cchudzicki/mathbox | build/esm/util/ease.d.ts | TypeScript | mit | 173 |
export function clamp(x, a, b) {
return Math.max(a, Math.min(b, x));
}
export function cosine(x) {
return 0.5 - 0.5 * Math.cos(clamp(x, 0, 1) * Math.PI);
}
export function binary(x) {
return +(x >= 0.5);
}
export function hold(x) {
return +(x >= 1);
}
| cchudzicki/mathbox | build/esm/util/ease.js | JavaScript | mit | 268 |
export function toType(type: any): any;
export function mapByte2FloatOffset(stretch: any): string;
export function sample2DArray(textures: any): string;
export function binaryOperator(type: any, op: any, curry: any): string;
export function extendVec(from: any, to: any, value: any): any;
export function truncateVec(from: any, to: any): any;
export function injectVec4(order: any): string;
export function swizzleVec4(order: any, size?: null): string;
export function invertSwizzleVec4(order: any): string;
export function identity(type: any, ...args: any[]): string;
export function constant(type: any, value: any): string;
| cchudzicki/mathbox | build/esm/util/glsl.d.ts | TypeScript | mit | 626 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const letters = "xyzw".split("");
const index = {
0: -1,
x: 0,
y: 1,
z: 2,
w: 3,
};
const parseOrder = function (order) {
if (order === "" + order) {
order = order.split("");
}
if (order === +order) {
order = [order];
}
return order;
};
export const toType = function (type) {
if (type === +type) {
type = "vec" + type;
}
if (type === "vec1") {
type = "float";
}
return type;
};
const toFloatString = function (value) {
value = "" + value;
if (value.indexOf(".") < 0) {
return (value += ".0");
}
};
// Helper for float to byte conversion on the w axis, for readback
export const mapByte2FloatOffset = function (stretch) {
if (stretch == null) {
stretch = 4;
}
const factor = toFloatString(stretch);
return `\
vec4 float2ByteIndex(vec4 xyzw, out float channelIndex) {
float relative = xyzw.w / ${factor};
float w = floor(relative);
channelIndex = (relative - w) * ${factor};
return vec4(xyzw.xyz, w);
}\
`;
};
// Sample data texture array
export const sample2DArray = function (textures) {
const divide = function (a, b) {
let out;
if (a === b) {
out = `\
return texture2D(dataTextures[${a}], uv);\
`;
}
else {
const mid = Math.ceil(a + (b - a) / 2);
out = `\
if (z < ${mid - 0.5}) {
${divide(a, mid - 1)}
}
else {
${divide(mid, b)}
}\
`;
}
return (out = out.replace(/\n/g, "\n "));
};
const body = divide(0, textures - 1);
return `\
uniform sampler2D dataTextures[${textures}];
vec4 sample2DArray(vec2 uv, float z) {
${body}
}\
`;
};
// Binary operator
export const binaryOperator = function (type, op, curry) {
type = toType(type);
if (curry != null) {
return `\
${type} binaryOperator(${type} a) {
return a ${op} ${curry};
}\
`;
}
else {
return `\
${type} binaryOperator(${type} a, ${type} b) {
return a ${op} b;
}\
`;
}
};
// Extend to n-vector with zeroes
export const extendVec = function (from, to, value) {
if (value == null) {
value = 0;
}
if (from > to) {
return truncateVec(from, to);
}
const diff = to - from;
from = toType(from);
to = toType(to);
value = toFloatString(value);
const parts = __range__(0, diff, true).map(function (x) {
if (x) {
return value;
}
else {
return "v";
}
});
const ctor = parts.join(",");
return `\
${to} extendVec(${from} v) { return ${to}(${ctor}); }\
`;
};
// Truncate n-vector
export const truncateVec = function (from, to) {
if (from < to) {
return extendVec(from, to);
}
const swizzle = "." + "xyzw".substr(0, to);
from = toType(from);
to = toType(to);
return `\
${to} truncateVec(${from} v) { return v${swizzle}; }\
`;
};
// Inject float into 4-component vector
export const injectVec4 = function (order) {
const swizzler = ["0.0", "0.0", "0.0", "0.0"];
order = parseOrder(order);
order = order.map(function (v) {
if (v === "" + v) {
return index[v];
}
else {
return v;
}
});
for (let i = 0; i < order.length; i++) {
const channel = order[i];
swizzler[channel] = ["a", "b", "c", "d"][i];
}
const mask = swizzler.slice(0, 4).join(", ");
const args = ["float a", "float b", "float c", "float d"].slice(0, order.length);
return `\
vec4 inject(${args}) {
return vec4(${mask});
}\
`;
};
// Apply 4-component vector swizzle
export const swizzleVec4 = function (order, size = null) {
const lookup = ["0.0", "xyzw.x", "xyzw.y", "xyzw.z", "xyzw.w"];
if (size == null) {
size = order.length;
}
order = parseOrder(order);
order = order.map(function (v) {
if (Array.from([0, 1, 2, 3, 4]).includes(+v)) {
v = +v;
}
if (v === "" + v) {
v = index[v] + 1;
}
return lookup[v];
});
while (order.length < size) {
order.push("0.0");
}
const mask = order.join(", ");
return `\
vec${size} swizzle(vec4 xyzw) {
return vec${size}(${mask});
}\
`.replace(/vec1/g, "float");
};
// Invert full or truncated swizzles for pointer lookups
export const invertSwizzleVec4 = function (order) {
const swizzler = ["0.0", "0.0", "0.0", "0.0"];
order = parseOrder(order);
order = order.map(function (v) {
if (v === +v) {
return letters[v - 1];
}
else {
return v;
}
});
for (let i = 0; i < order.length; i++) {
const letter = order[i];
const src = letters[i];
const j = index[letter];
swizzler[j] = `xyzw.${src}`;
}
const mask = swizzler.join(", ");
return `\
vec4 invertSwizzle(vec4 xyzw) {
return vec4(${mask});
}\
`;
};
export const identity = function (type) {
let args = [].slice.call(arguments);
if (args.length > 1) {
args = args.map((t, i) => ["inout", t, String.fromCharCode(97 + i)].join(" "));
args = args.join(", ");
return `\
void identity(${args}) { }\
`;
}
else {
return `\
${type} identity(${type} x) {
return x;
}\
`;
}
};
export const constant = (type, value) => `\
${type} constant() {
return ${value};
}\
`;
function __range__(left, right, inclusive) {
const range = [];
const ascending = left < right;
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
range.push(i);
}
return range;
}
| cchudzicki/mathbox | build/esm/util/glsl.js | JavaScript | mit | 6,095 |
export const Axis: typeof axis;
export const Data: typeof data;
export const Ease: typeof ease;
export const GLSL: typeof glsl;
export const JS: typeof js;
export const Pretty: typeof pretty;
export const Three: typeof three;
export const Ticks: typeof ticks;
export const VDOM: typeof vdom;
import * as axis from "./axis.js";
import * as data from "./data.js";
import * as ease from "./ease.js";
import * as glsl from "./glsl.js";
import * as js from "./js.js";
import * as pretty from "./pretty.js";
import * as three from "./three.js";
import * as ticks from "./ticks.js";
import * as vdom from "./vdom.js";
| cchudzicki/mathbox | build/esm/util/index.d.ts | TypeScript | mit | 611 |
import * as axis from "./axis.js";
import * as data from "./data.js";
import * as ease from "./ease.js";
import * as glsl from "./glsl.js";
import * as js from "./js.js";
import * as pretty from "./pretty.js";
import * as three from "./three.js";
import * as ticks from "./ticks.js";
import * as vdom from "./vdom.js";
export const Axis = axis;
export const Data = data;
export const Ease = ease;
export const GLSL = glsl;
export const JS = js;
export const Pretty = pretty;
export const Three = three;
export const Ticks = ticks;
export const VDOM = vdom;
| cchudzicki/mathbox | build/esm/util/index.js | JavaScript | mit | 557 |
export function merge(...args: any[]): {};
export function clone(o: any): any;
export function parseQuoted(str: any): any[];
| cchudzicki/mathbox | build/esm/util/js.d.ts | TypeScript | mit | 125 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Merge multiple objects
export const merge = function () {
const x = {};
for (const obj of Array.from(arguments)) {
for (const k in obj) {
const v = obj[k];
x[k] = v;
}
}
return x;
};
export const clone = (o) => JSON.parse(JSON.serialize(o));
export const parseQuoted = function (str) {
let accum = "";
const unescape = (str) => (str = str.replace(/\\/g, ""));
const munch = function (next) {
if (accum.length) {
list.push(unescape(accum));
}
return (accum = next != null ? next : "");
};
str = str.split(/(?=(?:\\.|["' ,]))/g);
let quote = false;
const list = [];
for (const chunk of Array.from(str)) {
const char = chunk[0];
const token = chunk.slice(1);
switch (char) {
case '"':
case "'":
if (quote) {
if (quote === char) {
quote = false;
munch(token);
}
else {
accum += chunk;
}
}
else {
if (accum !== "") {
throw new Error(`ParseError: String \`${str}\` does not contain comma-separated quoted tokens.`);
}
quote = char;
accum += token;
}
break;
case " ":
case ",":
if (!quote) {
munch(token);
}
else {
accum += chunk;
}
break;
default:
accum += chunk;
}
}
munch();
return list;
};
| cchudzicki/mathbox | build/esm/util/js.js | JavaScript | mit | 2,196 |
export namespace JSX {
export { prettyJSXProp as prop };
export { prettyJSXBind as bind };
}
declare function prettyJSXProp(k: any, v: any): string;
declare function prettyJSXBind(k: any, v: any): string;
declare function prettyMarkup(markup: any): any[];
declare function prettyNumber(options: any): (v: any) => any;
declare function prettyPrint(markup: any, level: any): any;
declare function prettyFormat(str: any, ...args: any[]): string;
export { prettyMarkup as markup, prettyNumber as number, prettyPrint as print, prettyFormat as format };
| cchudzicki/mathbox | build/esm/util/pretty.d.ts | TypeScript | mit | 556 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const NUMBER_PRECISION = 5;
const NUMBER_THRESHOLD = 0.0001;
const checkFactor = (v, f) => Math.abs(v / f - Math.round(v / f)) < NUMBER_THRESHOLD;
const checkUnit = (v) => checkFactor(v, 1);
const formatMultiple = function (v, f, k, compact) {
const d = Math.round(v / f);
if (d === 1) {
return `${k}`;
}
if (d === -1) {
return `-${k}`;
}
if (k === "1") {
return `${d}`;
}
if (compact) {
return `${d}${k}`;
}
else {
return `${d}*${k}`;
}
};
const formatFraction = function (v, f, k, compact) {
let d = Math.round(v * f);
if (Math.abs(d) === 1) {
d = d < 0 ? "-" : "";
d += k;
}
else if (k !== "1") {
d += compact ? `${k}` : `*${k}`;
}
return `${d}/${f}`;
};
const formatFactors = [
{ 1: 1 },
{ 1: 1, τ: Math.PI * 2 },
{ 1: 1, π: Math.PI },
{ 1: 1, τ: Math.PI * 2, π: Math.PI },
{ 1: 1, e: Math.E },
{ 1: 1, τ: Math.PI * 2, e: Math.E },
{ 1: 1, π: Math.PI, e: Math.E },
{ 1: 1, τ: Math.PI * 2, π: Math.PI, e: Math.E },
];
const formatPrimes = [
// denominators 1-30 + interesting multiples
[2 * 2 * 3 * 5 * 7, [2, 3, 5, 7]],
[2 * 2 * 2 * 3 * 3 * 5 * 5 * 7 * 7, [2, 3, 5, 7]],
[2 * 2 * 3 * 5 * 7 * 11 * 13, [2, 3, 5, 7, 11, 13]],
[2 * 2 * 17 * 19 * 23 * 29, [2, 17, 19, 23, 29]],
[256 * 256, [2]],
[1000000, [2, 5]], // Powers of 10
];
const prettyNumber = function (options) {
let cache, compact, e, pi, tau;
if (options) {
({ cache, compact, tau, pi, e } = options);
}
compact = +!!(compact != null ? compact : true);
tau = +!!(tau != null ? tau : true);
pi = +!!(pi != null ? pi : true);
e = +!!(e != null ? e : true);
cache = +!!(cache != null ? cache : true);
const formatIndex = tau + pi * 2 + e * 4;
const numberCache = cache ? {} : null;
return function (v) {
if (numberCache != null) {
let cached;
if ((cached = numberCache[v]) != null) {
return cached;
}
if (v === Math.round(v)) {
return (numberCache[v] = `${v}`);
}
}
let out = `${v}`;
let best = out.length + out.indexOf(".") + 2;
const match = function (x) {
const d = x.length;
if (d <= best) {
out = `${x}`;
return (best = d);
}
};
for (const k in formatFactors[formatIndex]) {
const f = formatFactors[formatIndex][k];
if (checkUnit(v / f)) {
match(`${formatMultiple(v / f, 1, k, compact)}`);
}
else {
// eslint-disable-next-line prefer-const
for (let [denom, list] of Array.from(formatPrimes)) {
let numer = (v / f) * denom;
if (checkUnit(numer)) {
for (const p of Array.from(list)) {
let d, n;
while (checkUnit((n = numer / p)) && checkUnit((d = denom / p))) {
numer = n;
denom = d;
}
}
match(`${formatFraction(v / f, denom, k, compact)}`);
break;
}
}
}
}
if (`${v}`.length > NUMBER_PRECISION) {
match(`${v.toPrecision(NUMBER_PRECISION)}`);
}
if (numberCache != null) {
numberCache[v] = out;
}
return out;
};
};
const prettyPrint = function (markup, level) {
if (level == null) {
level = "info";
}
markup = prettyMarkup(markup);
return console[level].apply(console, markup);
};
const prettyMarkup = function (markup) {
// quick n dirty
const tag = "color:rgb(128,0,128)";
const attr = "color:rgb(144,64,0)";
const str = "color:rgb(0,0,192)";
const obj = "color:rgb(0,70,156)";
const txt = "color:inherit";
let quoted = false;
let nested = 0;
const args = [];
markup = markup.replace(/(\\[<={}> "'])|(=>|[<={}> "'])/g, function (_, escape, char) {
if (escape != null ? escape.length : undefined) {
return escape;
}
if (quoted && !['"', "'"].includes(char)) {
return char;
}
if (nested && !['"', "'", "{", "}"].includes(char)) {
return char;
}
return (() => {
switch (char) {
case "<":
args.push(tag);
return "%c<";
case ">":
args.push(tag);
args.push(txt);
return "%c>%c";
case " ":
args.push(attr);
return " %c";
case "=":
case "=>":
args.push(tag);
return `%c${char}`;
case '"':
case "'":
quoted = !quoted;
if (quoted) {
args.push(nested ? attr : str);
return `${char}%c`;
}
else {
args.push(nested ? obj : tag);
return `%c${char}`;
}
case "{":
if (nested++ === 0) {
args.push(obj);
return `%c${char}`;
}
else {
return char;
}
case "}":
if (--nested === 0) {
args.push(tag);
return `${char}%c`;
}
else {
return char;
}
default:
return char;
}
})();
});
return [markup].concat(args);
};
const prettyJSXProp = (k, v) => prettyJSXPair(k, v, "=");
const prettyJSXBind = (k, v) => prettyJSXPair(k, v, "=>");
const prettyJSXPair = (function () {
const formatNumber = prettyNumber({ compact: false });
return function (k, v, op) {
const key = function (k) {
if (k === "" + +k || k.match(/^[A-Za-z_][A-Za-z0-9]*$/)) {
return k;
}
else {
return JSON.stringify(k);
}
};
const wrap = function (v) {
if (v.match('\n*"')) {
return v;
}
else {
return `{${v}}`;
}
};
const value = function (v) {
if (v instanceof Array) {
return `[${v.map(value).join(", ")}]`;
}
switch (typeof v) {
case "string":
if (v.match("\n")) {
return `"\n${v}"\n`;
}
else {
return `"${v}"`;
}
case "function":
v = `${v}`;
if (v.match("\n")) {
`\n${v}\n`;
}
else {
`${v}`;
}
v = v.replace(/^function (\([^)]+\))/, "$1 =>");
return (v = v.replace(/^(\([^)]+\)) =>\s*{\s*return\s*([^}]+)\s*;\s*}/, "$1 => $2"));
case "number":
return formatNumber(v);
default:
if (v != null && v !== !!v) {
if (v._up != null) {
return value(v.map((v) => v));
}
if (v.toMarkup) {
return v.toString();
}
else {
return ("{" +
(() => {
const result = [];
for (const kk in v) {
const vv = v[kk];
if (Object.prototype.hasOwnProperty.call(v, kk)) {
result.push(`${key(kk)}: ${value(vv)}`);
}
}
return result;
})().join(", ") +
"}");
}
}
else {
return `${JSON.stringify(v)}`;
}
}
};
return [k, op, wrap(value(v))].join("");
};
})();
const escapeHTML = function (str) {
str = str.replace(/&/g, "&");
str = str.replace(/</g, "<");
return (str = str.replace(/"/g, """));
};
const prettyFormat = function (str) {
const args = [].slice.call(arguments);
args.shift();
let out = "<span>";
str = escapeHTML(str);
// eslint-disable-next-line no-unused-vars
for (const _arg of Array.from(args)) {
str = str.replace(/%([a-z])/, function (_, f) {
const v = args.shift();
switch (f) {
case "c":
return `</span><span style="${escapeHTML(v)}">`;
default:
return escapeHTML(v);
}
});
}
out += str;
return (out += "</span>");
};
export const JSX = { prop: prettyJSXProp, bind: prettyJSXBind };
export { prettyMarkup as markup, prettyNumber as number, prettyPrint as print, prettyFormat as format, };
/*
for x in [1, 2, 1/2, 3, 1/3, Math.PI, Math.PI / 2, Math.PI * 2, Math.PI * 3, Math.PI * 4, Math.PI * 3 / 4, Math.E * 100, Math.E / 100]
console.log prettyNumber({})(x)
*/
| cchudzicki/mathbox | build/esm/util/pretty.js | JavaScript | mit | 10,459 |
export function paramToGL(gl: any, p: any): any;
export function paramToArrayStorage(type: any): Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | undefined;
export function swizzleToEulerOrder(swizzle: any): any;
export function transformComposer(): (position: any, rotation: any, quaternion: any, scale: any, matrix: any, eulerOrder: any) => any;
| cchudzicki/mathbox | build/esm/util/three.d.ts | TypeScript | mit | 470 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
import * as CONST from "three/src/constants.js";
import { Euler } from "three/src/math/Euler.js";
import { Matrix4 } from "three/src/math/Matrix4.js";
import { Quaternion } from "three/src/math/Quaternion.js";
import { Vector3 } from "three/src/math/Vector3.js";
export const paramToGL = function (gl, p) {
if (p === CONST.RepeatWrapping) {
return gl.REPEAT;
}
if (p === CONST.ClampToEdgeWrapping) {
return gl.CLAMP_TO_EDGE;
}
if (p === CONST.MirroredRepeatWrapping) {
return gl.MIRRORED_REPEAT;
}
if (p === CONST.NearestFilter) {
return gl.NEAREST;
}
if (p === CONST.NearestMipMapNearestFilter) {
return gl.NEAREST_MIPMAP_NEAREST;
}
if (p === CONST.NearestMipMapLinearFilter) {
return gl.NEAREST_MIPMAP_LINEAR;
}
if (p === CONST.LinearFilter) {
return gl.LINEAR;
}
if (p === CONST.LinearMipMapNearestFilter) {
return gl.LINEAR_MIPMAP_NEAREST;
}
if (p === CONST.LinearMipMapLinearFilter) {
return gl.LINEAR_MIPMAP_LINEAR;
}
if (p === CONST.UnsignedByteType) {
return gl.UNSIGNED_BYTE;
}
if (p === CONST.UnsignedShort4444Type) {
return gl.UNSIGNED_SHORT_4_4_4_4;
}
if (p === CONST.UnsignedShort5551Type) {
return gl.UNSIGNED_SHORT_5_5_5_1;
}
if (p === CONST.ByteType) {
return gl.BYTE;
}
if (p === CONST.ShortType) {
return gl.SHORT;
}
if (p === CONST.UnsignedShortType) {
return gl.UNSIGNED_SHORT;
}
if (p === CONST.IntType) {
return gl.INT;
}
if (p === CONST.UnsignedIntType) {
return gl.UNSIGNED_INT;
}
if (p === CONST.FloatType) {
return gl.FLOAT;
}
if (p === CONST.AlphaFormat) {
return gl.ALPHA;
}
if (p === CONST.RGBAFormat) {
return gl.RGBA;
}
if (p === CONST.LuminanceFormat) {
return gl.LUMINANCE;
}
if (p === CONST.LuminanceAlphaFormat) {
return gl.LUMINANCE_ALPHA;
}
if (p === CONST.AddEquation) {
return gl.FUNC_ADD;
}
if (p === CONST.SubtractEquation) {
return gl.FUNC_SUBTRACT;
}
if (p === CONST.ReverseSubtractEquation) {
return gl.FUNC_REVERSE_SUBTRACT;
}
if (p === CONST.ZeroFactor) {
return gl.ZERO;
}
if (p === CONST.OneFactor) {
return gl.ONE;
}
if (p === CONST.SrcColorFactor) {
return gl.SRC_COLOR;
}
if (p === CONST.OneMinusSrcColorFactor) {
return gl.ONE_MINUS_SRC_COLOR;
}
if (p === CONST.SrcAlphaFactor) {
return gl.SRC_ALPHA;
}
if (p === CONST.OneMinusSrcAlphaFactor) {
return gl.ONE_MINUS_SRC_ALPHA;
}
if (p === CONST.DstAlphaFactor) {
return gl.DST_ALPHA;
}
if (p === CONST.OneMinusDstAlphaFactor) {
return gl.ONE_MINUS_DST_ALPHA;
}
if (p === CONST.DstColorFactor) {
return gl.DST_COLOR;
}
if (p === CONST.OneMinusDstColorFactor) {
return gl.ONE_MINUS_DST_COLOR;
}
if (p === CONST.SrcAlphaSaturateFactor) {
return gl.SRC_ALPHA_SATURATE;
}
return 0;
};
export const paramToArrayStorage = function (type) {
switch (type) {
case CONST.UnsignedByteType:
return Uint8Array;
case CONST.ByteType:
return Int8Array;
case CONST.ShortType:
return Int16Array;
case CONST.UnsignedShortType:
return Uint16Array;
case CONST.IntType:
return Int32Array;
case CONST.UnsignedIntType:
return Uint32Array;
case CONST.FloatType:
return Float32Array;
}
};
export const swizzleToEulerOrder = (swizzle) => swizzle.map((i) => ["", "X", "Y", "Z"][i]).join("");
export const transformComposer = function () {
const euler = new Euler();
const quat = new Quaternion();
const pos = new Vector3();
const scl = new Vector3();
const transform = new Matrix4();
return function (position, rotation, quaternion, scale, matrix, eulerOrder) {
if (eulerOrder == null) {
eulerOrder = "XYZ";
}
if (rotation != null) {
if (eulerOrder instanceof Array) {
eulerOrder = swizzleToEulerOrder(eulerOrder);
}
euler.setFromVector3(rotation, eulerOrder);
quat.setFromEuler(euler);
}
else {
quat.set(0, 0, 0, 1);
}
if (quaternion != null) {
quat.multiply(quaternion);
}
if (position != null) {
pos.copy(position);
}
else {
pos.set(0, 0, 0);
}
if (scale != null) {
scl.copy(scale);
}
else {
scl.set(1, 1, 1);
}
transform.compose(pos, quat, scl);
if (matrix != null) {
transform.multiplyMatrices(transform, matrix);
}
return transform;
};
};
| cchudzicki/mathbox | build/esm/util/three.js | JavaScript | mit | 5,352 |
export function linear(min: any, max: any, n: any, unit: any, base: any, factor: any, start: any, end: any, zero: any, nice: any): any[];
export function log(_min: any, _max: any, _n: any, _unit: any, _base: any, _bias: any, _start: any, _end: any, _zero: any, _nice: any): never;
export function make(type: any, min: any, max: any, n: any, unit: any, base: any, bias: any, start: any, end: any, zero: any, nice: any): any[] | undefined;
| cchudzicki/mathbox | build/esm/util/ticks.d.ts | TypeScript | mit | 438 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS202: Simplify dynamic range loops
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
/*
Generate equally spaced ticks in a range at sensible positions.
@param min/max - Minimum and maximum of range
@param n - Desired number of ticks in range
@param unit - Base unit of scale (e.g. 1 or π).
@param scale - Division scale (e.g. 2 = binary division, or 10 = decimal division).
@param bias - Integer to bias divisions one or more levels up or down (to create nested scales)
@param start - Whether to include a tick at the start
@param end - Whether to include a tick at the end
@param zero - Whether to include zero as a tick
@param nice - Whether to round to a more reasonable interval
*/
export const linear = function (min, max, n, unit, base, factor, start, end, zero, nice) {
let ticks;
let i, f;
if (nice == null) {
nice = true;
}
if (!n) {
n = 10;
}
if (!unit) {
unit = 1;
}
if (!base) {
base = 10;
}
if (!factor) {
factor = 1;
}
// Calculate naive tick size.
const span = max - min;
const ideal = span / n;
// Unsnapped division
if (!nice) {
ticks = (() => {
let asc, end1;
const result = [];
for (i = 0, end1 = n, asc = 0 <= end1; asc ? i <= end1 : i >= end1; asc ? i++ : i--) {
result.push(min + i * ideal);
}
return result;
})();
if (!start) {
ticks.shift();
}
if (!end) {
ticks.pop();
}
if (!zero) {
ticks = ticks.filter((x) => x !== 0);
}
return ticks;
}
// Round to the floor'd power of 'scale'
if (!unit) {
unit = 1;
}
if (!base) {
base = 10;
}
const ref = unit * Math.pow(base, Math.floor(Math.log(ideal / unit) / Math.log(base)));
// Make derived steps at sensible factors.
const factors = base % 2 === 0
? [base / 2, 1, 1 / 2]
: base % 3 === 0
? [base / 3, 1, 1 / 3]
: [1];
const steps = (() => {
const result1 = [];
for (f of Array.from(factors)) {
result1.push(ref * f);
}
return result1;
})();
// Find step size closest to ideal.
let distance = Infinity;
let step = steps.reduce(function (ref, step) {
f = step / ideal;
const d = Math.max(f, 1 / f);
if (d < distance) {
distance = d;
return step;
}
else {
return ref;
}
}, ref);
// Scale final step
step *= factor;
// Renormalize min/max onto aligned steps.
min = Math.ceil(min / step + +!start) * step;
max = (Math.floor(max / step) - +!end) * step;
n = Math.ceil((max - min) / step);
// Generate equally spaced ticks
ticks = (() => {
let asc1, end2;
const result2 = [];
for (i = 0, end2 = n, asc1 = 0 <= end2; asc1 ? i <= end2 : i >= end2; asc1 ? i++ : i--) {
result2.push(min + i * step);
}
return result2;
})();
if (!zero) {
ticks = ticks.filter((x) => x !== 0);
}
return ticks;
};
/*
Generate logarithmically spaced ticks in a range at sensible positions.
*/
export const log = function (_min, _max, _n, _unit, _base, _bias, _start, _end, _zero, _nice) {
throw new Error("Log ticks not yet implemented.");
};
const LINEAR = 0;
const LOG = 1;
export const make = function (type, min, max, n, unit, base, bias, start, end, zero, nice) {
switch (type) {
case LINEAR:
return linear(min, max, n, unit, base, bias, start, end, zero, nice);
case LOG:
return log(min, max, n, unit, base, bias, start, end, zero, nice);
}
};
| cchudzicki/mathbox | build/esm/util/ticks.js | JavaScript | mit | 4,213 |
export const Types: {};
export function hint(n: any): number[];
export function element(type: any, props: any, children: any): any;
export function recycle(el: any): void;
export function apply(el: any, last: any, node: any, parent: any, index: any): any;
export function createClass(prototype: any): any;
| cchudzicki/mathbox | build/esm/util/vdom.d.ts | TypeScript | mit | 306 |
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS104: Avoid inline assignments
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Quick'n'dirty Virtual DOM diffing
// with a poor man's React for components
//
// This is for rendering HTML with data from a GL readback. See DOM examples.
const HEAP = [];
let id = 0;
// Static render components
export const Types = {
/*
* el('example', props, children);
example: MathBox.DOM.createClass({
render: (el, props, children) ->
* VDOM node
return el('span', { className: "foo" }, "Hello World")
})
*/
};
const descriptor = () => ({
id: id++,
type: null,
props: null,
children: null,
rendered: null,
instance: null,
});
export const hint = function (n) {
n *= 2;
n = Math.max(0, HEAP.length - n);
return __range__(0, n, false).map((_i) => HEAP.push(descriptor()));
};
export const element = function (type, props, children) {
const el = HEAP.length ? HEAP.pop() : descriptor();
el.type = type != null ? type : "div";
el.props = props != null ? props : null;
el.children = children != null ? children : null;
// Can't use `arguments` here to pass children as direct args, it de-optimizes label emitters
return el;
};
export const recycle = function (el) {
if (!el.type) {
return;
}
const { children } = el;
el.type = el.props = el.children = el.instance = null;
HEAP.push(el);
if (children != null) {
for (const child of Array.from(children)) {
recycle(child);
}
}
};
export const apply = function (el, last, node, parent, index) {
if (el != null) {
if (last == null) {
// New node
return mount(el, parent, index);
}
else {
// Literal DOM node
let same;
if (el instanceof Node) {
same = el === last;
if (same) {
return;
}
}
else {
// Check compatibility
same =
typeof el === typeof last &&
last !== null &&
el !== null &&
el.type === last.type;
}
if (!same) {
// Not compatible: unmount and remount
unmount(last.instance, node);
node.remove();
return mount(el, parent, index);
}
else {
// Maintain component ref
let key, ref, value;
el.instance = last.instance;
// Check if it's a component
const type = (el.type != null ? el.type.isComponentClass : undefined)
? el.type
: Types[el.type];
// Prepare to diff props and children
const props = last != null ? last.props : undefined;
const nextProps = el.props;
const children = (last != null ? last.children : undefined) != null
? last != null
? last.children
: undefined
: null;
const nextChildren = el.children;
if (nextProps != null) {
nextProps.children = nextChildren;
}
// Component
if (type != null) {
// See if it changed
let dirty = node._COMPONENT_DIRTY;
if ((props != null) !== (nextProps != null)) {
dirty = true;
}
if (children !== nextChildren) {
dirty = true;
}
if (props != null && nextProps != null) {
if (!dirty) {
for (key in props) {
if (!Object.prototype.hasOwnProperty.call(nextProps, key)) {
dirty = true;
}
}
}
if (!dirty) {
for (key in nextProps) {
value = nextProps[key];
if ((ref = props[key]) !== value) {
dirty = true;
}
}
}
}
if (dirty) {
let left;
const comp = last.instance;
if (el.props == null) {
el.props = {};
}
for (const k in comp.defaultProps) {
const v = comp.defaultProps[k];
if (el.props[k] == null) {
el.props[k] = v;
}
}
el.props.children = el.children;
if (typeof comp.willReceiveProps === "function") {
comp.willReceiveProps(el.props);
}
const should = node._COMPONENT_FORCE ||
((left =
typeof comp.shouldUpdate === "function"
? comp.shouldUpdate(el.props)
: undefined) != null
? left
: true);
if (should) {
const nextState = comp.getNextState();
if (typeof comp.willUpdate === "function") {
comp.willUpdate(el.props, nextState);
}
}
const prevProps = comp.props;
const prevState = comp.applyNextState();
comp.props = el.props;
comp.children = el.children;
if (should) {
el = el.rendered =
typeof comp.render === "function"
? comp.render(element, el.props, el.children)
: undefined;
apply(el, last.rendered, node, parent, index);
if (typeof comp.didUpdate === "function") {
comp.didUpdate(prevProps, prevState);
}
}
}
return;
}
else {
// VDOM node
if (props != null) {
for (key in props) {
if (!Object.prototype.hasOwnProperty.call(nextProps, key)) {
unset(node, key, props[key]);
}
}
}
if (nextProps != null) {
for (key in nextProps) {
value = nextProps[key];
if ((ref = props[key]) !== value && key !== "children") {
set(node, key, value, ref);
}
}
}
// Diff children
if (nextChildren != null) {
if (["string", "number"].includes(typeof nextChildren)) {
// Insert text directly
if (nextChildren !== children) {
node.textContent = nextChildren;
}
}
else {
if (nextChildren.type != null) {
// Single child
apply(nextChildren, children, node.childNodes[0], node, 0);
}
else {
// Diff children
let child, i;
const { childNodes } = node;
if (children != null) {
for (i = 0; i < nextChildren.length; i++) {
child = nextChildren[i];
apply(child, children[i], childNodes[i], node, i);
}
}
else {
for (i = 0; i < nextChildren.length; i++) {
child = nextChildren[i];
apply(child, null, childNodes[i], node, i);
}
}
}
}
}
else if (children != null) {
// Unmount all child components
unmount(null, node);
// Remove all children
node.innerHTML = "";
}
}
return;
}
}
}
if (last != null) {
// Removed node
unmount(last.instance, node);
return last.node.remove();
}
};
const mount = function (el, parent, index) {
let node;
if (index == null) {
index = 0;
}
const type = (el.type != null ? el.type.isComponentClass : undefined)
? el.type
: Types[el.type];
// Literal DOM node
if (el instanceof Node) {
node = el;
}
else {
if (type != null) {
// Component
let comp;
const ctor = (el.type != null ? el.type.isComponentClass : undefined)
? el.type
: Types[el.type];
// No component class found
if (!ctor) {
el = el.rendered = element("noscript");
node = mount(el, parent, index);
return node;
}
// Construct component class
el.instance = comp = new ctor(parent);
if (el.props == null) {
el.props = {};
}
for (const k in comp.defaultProps) {
const v = comp.defaultProps[k];
if (el.props[k] == null) {
el.props[k] = v;
}
}
el.props.children = el.children;
// Do initial state transition
comp.props = el.props;
comp.children = el.children;
comp.setState(typeof comp.getInitialState === "function"
? comp.getInitialState()
: undefined);
if (typeof comp.willMount === "function") {
comp.willMount();
}
// Render
el = el.rendered =
typeof comp.render === "function"
? comp.render(element, el.props, el.children)
: undefined;
node = mount(el, parent, index);
// Finish mounting and remember component/node association
if (typeof comp.didMount === "function") {
comp.didMount(el);
}
node._COMPONENT = comp;
return node;
}
else if (["string", "number"].includes(typeof el)) {
// Text
node = document.createTextNode(el);
}
else {
// VDOM Node
node = document.createElement(el.type);
for (const key in el.props) {
const value = el.props[key];
set(node, key, value);
}
}
const { children } = el;
if (children != null) {
if (["string", "number"].includes(typeof children)) {
// Insert text directly
node.textContent = children;
}
else {
if (children.type != null) {
// Single child
mount(children, node, 0);
}
else {
// Insert children
for (let i = 0; i < children.length; i++) {
const child = children[i];
mount(child, node, i);
}
}
}
}
}
parent.insertBefore(node, parent.childNodes[index]);
return node;
};
const unmount = function (comp, node) {
if (comp) {
if (typeof comp.willUnmount === "function") {
comp.willUnmount();
}
for (const k in comp) {
delete comp[k];
}
}
return (() => {
const result = [];
for (const child of Array.from(node.childNodes)) {
unmount(child._COMPONENT, child);
result.push(delete child._COMPONENT);
}
return result;
})();
};
const prop = function (key) {
if (typeof document === "undefined") {
return true;
}
if (document.documentElement.style[key] != null) {
return key;
}
key = key[0].toUpperCase() + key.slice(1);
const prefixes = ["webkit", "moz", "ms", "o"];
for (const prefix of Array.from(prefixes)) {
if (document.documentElement.style[prefix + key] != null) {
return prefix + key;
}
}
};
const map = {};
for (const key of ["transform"]) {
map[key] = prop(key);
}
const set = function (node, key, value, orig) {
if (key === "style") {
for (const k in value) {
const v = value[k];
if ((orig != null ? orig[k] : undefined) !== v) {
node.style[map[k] != null ? map[k] : k] = v;
}
}
return;
}
if (node[key] != null) {
try {
node[key] = value;
}
catch (e1) {
console.log("failed setting " + key);
}
return;
}
if (node instanceof Node) {
node.setAttribute(key, value);
return;
}
};
const unset = function (node, key, orig) {
if (key === "style") {
for (const k in orig) {
node.style[map[k] != null ? map[k] : k] = "";
}
return;
}
if (node[key] != null) {
node[key] = undefined;
}
if (node instanceof Node) {
node.removeAttribute(key);
return;
}
};
/**
* This needs explicit any -> any typings for ts to emit declarations.
* Typescript can't handle class declarations inside functions very well.
*
* @param {any} prototype
* @returns {any}
*/
export const createClass = function (prototype) {
let left;
const aliases = {
willMount: "componentWillMount",
didMount: "componentDidMount",
willReceiveProps: "componentWillReceiveProps",
shouldUpdate: "shouldComponentUpdate",
willUpdate: "componentWillUpdate",
didUpdate: "componentDidUpdate",
willUnmount: "componentWillUnmount",
};
for (const a in aliases) {
const b = aliases[a];
if (prototype[a] == null) {
prototype[a] = prototype[b];
}
}
class Component {
constructor(node, props, state = null, children = null) {
let k, v;
if (props == null) {
props = {};
}
this.props = props;
this.state = state;
this.children = children;
const bind = function (f, self) {
if (typeof f === "function") {
return f.bind(self);
}
else {
return f;
}
};
for (k in prototype) {
v = prototype[k];
this[k] = bind(v, this);
}
let nextState = null;
this.setState = function (state) {
if (nextState == null) {
nextState = state ? (nextState != null ? nextState : {}) : null;
}
for (k in state) {
v = state[k];
nextState[k] = v;
}
node._COMPONENT_DIRTY = true;
};
this.forceUpdate = function () {
node._COMPONENT_FORCE = node._COMPONENT_DIRTY = true;
let el = node;
return (() => {
const result = [];
while ((el = el.parentNode)) {
if (el._COMPONENT) {
result.push((el._COMPONENT_FORCE = true));
}
else {
result.push(undefined);
}
}
return result;
})();
};
this.getNextState = () => nextState;
this.applyNextState = function () {
node._COMPONENT_FORCE = node._COMPONENT_DIRTY = false;
const prevState = this.state;
[nextState, this.state] = Array.from([null, nextState]);
return prevState;
};
}
}
Component.isComponentClass = true;
Component.prototype.defaultProps =
(left =
typeof prototype.getDefaultProps === "function"
? prototype.getDefaultProps()
: undefined) != null
? left
: {};
return Component;
};
function __range__(left, right, inclusive) {
const range = [];
const ascending = left < right;
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
range.push(i);
}
return range;
}
| cchudzicki/mathbox | build/esm/util/vdom.js | JavaScript | mit | 18,492 |
.shadergraph-graph {
font: 12px sans-serif;
line-height: 25px;
position: relative;
}
.shadergraph-graph:after {
content: " ";
display: block;
height: 0;
font-size: 0;
clear: both;
}
.shadergraph-graph svg {
pointer-events: none;
}
.shadergraph-clear {
clear: both;
}
.shadergraph-graph svg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: auto;
height: auto;
}
.shadergraph-column {
float: left;
}
.shadergraph-node .shadergraph-graph {
float: left;
clear: both;
overflow: visible;
}
.shadergraph-node .shadergraph-graph .shadergraph-node {
margin: 5px 15px 15px;
}
.shadergraph-node {
margin: 5px 15px 25px;
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 10px rgba(0, 0, 0, 0.2);
min-height: 35px;
float: left;
clear: left;
position: relative;
}
.shadergraph-type {
font-weight: bold;
}
.shadergraph-header {
font-weight: bold;
text-align: center;
height: 25px;
background: rgba(0, 0, 0, 0.3);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
color: #fff;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
margin-bottom: 5px;
padding: 0 10px;
}
.shadergraph-outlet div {
}
.shadergraph-outlet-in .shadergraph-name {
margin-right: 7px;
}
.shadergraph-outlet-out .shadergraph-name {
margin-left: 7px;
}
.shadergraph-name {
margin: 0 4px;
}
.shadergraph-point {
margin: 6px;
width: 11px;
height: 11px;
border-radius: 7.5px;
background: rgba(255, 255, 255, 1);
}
.shadergraph-outlet-in {
float: left;
clear: left;
}
.shadergraph-outlet-in div {
float: left;
}
.shadergraph-outlet-out {
float: right;
clear: right;
}
.shadergraph-outlet-out div {
float: right;
}
.shadergraph-node-callback {
background: rgba(205, 209, 221, 0.5);
box-shadow: 0 1px 2px rgba(0, 10, 40, 0.2), 0 1px 10px rgba(0, 10, 40, 0.2);
}
.shadergraph-node-callback > .shadergraph-header {
background: rgba(0, 20, 80, 0.3);
}
.shadergraph-graph .shadergraph-graph .shadergraph-node-callback {
background: rgba(0, 20, 80, 0.1);
}
.shadergraph-node-call {
background: rgba(209, 221, 205, 0.5);
box-shadow: 0 1px 2px rgba(10, 40, 0, 0.2), 0 1px 10px rgba(10, 40, 0, 0.2);
}
.shadergraph-node-call > .shadergraph-header {
background: rgba(20, 80, 0, 0.3);
}
.shadergraph-graph .shadergraph-graph .shadergraph-node-call {
background: rgba(20, 80, 0, 0.1);
}
.shadergraph-node-isolate {
background: rgba(221, 205, 209, 0.5);
box-shadow: 0 1px 2px rgba(40, 0, 10, 0.2), 0 1px 10px rgba(40, 0, 10, 0.2);
}
.shadergraph-node-isolate > .shadergraph-header {
background: rgba(80, 0, 20, 0.3);
}
.shadergraph-graph .shadergraph-graph .shadergraph-node-isolate {
background: rgba(80, 0, 20, 0.1);
}
.shadergraph-node.shadergraph-has-code {
cursor: pointer;
}
.shadergraph-node.shadergraph-has-code::before {
position: absolute;
content: " ";
top: 0;
left: 0;
right: 0;
bottom: 0;
display: none;
border: 2px solid rgba(0, 0, 0, 0.25);
border-radius: 5px;
}
.shadergraph-node.shadergraph-has-code:hover::before {
display: block;
}
.shadergraph-code {
z-index: 10000;
display: none;
position: absolute;
background: #fff;
color: #000;
white-space: pre;
padding: 10px;
border-radius: 5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 10px rgba(0, 0, 0, 0.2);
font-family: monospace;
font-size: 10px;
line-height: 12px;
}
.shadergraph-overlay {
position: fixed;
top: 50%;
left: 0;
right: 0;
bottom: 0;
background: #fff;
border-top: 1px solid #ccc;
}
.shadergraph-overlay .shadergraph-view {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: auto;
}
.shadergraph-overlay .shadergraph-inside {
width: 4000px;
min-height: 100%;
box-sizing: border-box;
}
.shadergraph-overlay .shadergraph-close {
position: absolute;
top: 5px;
right: 5px;
padding: 4px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.3);
color: rgba(0, 0, 0, 0.3);
cursor: pointer;
font-size: 24px;
line-height: 24px;
width: 24px;
text-align: center;
vertical-align: middle;
}
.shadergraph-overlay .shadergraph-close:hover {
background: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
}
.shadergraph-overlay .shadergraph-graph {
padding-top: 10px;
overflow: visible;
min-height: 100%;
}
.shadergraph-overlay span {
display: block;
padding: 5px 15px;
margin: 0;
background: rgba(0, 0, 0, 0.1);
font-weight: bold;
font-family: sans-serif;
}
.mathbox-loader {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
padding: 10px;
border-radius: 50%;
background: #fff;
}
.mathbox-loader.mathbox-exit {
opacity: 0;
-webkit-transition: opacity 0.15s ease-in-out;
transition: opacity 0.15s ease-in-out;
}
.mathbox-progress {
height: 10px;
border-radius: 5px;
width: 80px;
margin: 0 auto 20px;
box-shadow: 1px 1px 1px rgba(255, 255, 255, 0.2),
1px -1px 1px rgba(255, 255, 255, 0.2), -1px 1px 1px rgba(255, 255, 255, 0.2),
-1px -1px 1px rgba(255, 255, 255, 0.2);
background: #ccc;
overflow: hidden;
}
.mathbox-progress > div {
display: block;
width: 0px;
height: 10px;
background: #888;
}
.mathbox-logo {
position: relative;
width: 140px;
height: 100px;
margin: 0 auto 10px;
-webkit-perspective: 200px;
perspective: 200px;
}
.mathbox-logo > div {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.mathbox-logo > :nth-child(1) {
-webkit-transform: rotateZ(22deg) rotateX(24deg) rotateY(30deg);
transform: rotateZ(22deg) rotateX(24deg) rotateY(30deg);
}
.mathbox-logo > :nth-child(2) {
-webkit-transform: rotateZ(11deg) rotateX(12deg) rotateY(15deg)
scale3d(0.6, 0.6, 0.6);
transform: rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(0.6, 0.6, 0.6);
}
.mathbox-logo > div > div {
position: absolute;
top: 50%;
left: 50%;
margin-left: -100px;
margin-top: -100px;
width: 200px;
height: 200px;
box-sizing: border-box;
border-radius: 50%;
}
.mathbox-logo > div > :nth-child(1) {
-webkit-transform: scale(0.5, 0.5);
transform: rotateX(30deg) scale(0.5, 0.5);
}
.mathbox-logo > div > :nth-child(2) {
-webkit-transform: rotateX(90deg) scale(0.42, 0.42);
transform: rotateX(90deg) scale(0.42, 0.42);
}
.mathbox-logo > div > :nth-child(3) {
-webkit-transform: rotateY(90deg) scale(0.35, 0.35);
transform: rotateY(90deg) scale(0.35, 0.35);
}
.mathbox-logo > :nth-child(1) > :nth-child(1) {
border: 16px solid #808080;
}
.mathbox-logo > :nth-child(1) > :nth-child(2) {
border: 19px solid #a0a0a0;
}
.mathbox-logo > :nth-child(1) > :nth-child(3) {
border: 23px solid #c0c0c0;
}
.mathbox-logo > :nth-child(2) > :nth-child(1) {
border: 27px solid #808080;
}
.mathbox-logo > :nth-child(2) > :nth-child(2) {
border: 32px solid #a0a0a0;
}
.mathbox-logo > :nth-child(2) > :nth-child(3) {
border: 38px solid #c0c0c0;
}
.mathbox-splash-blue .mathbox-progress {
background: #def;
}
.mathbox-splash-blue .mathbox-progress > div {
background: #1979e7;
}
.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(1) {
border-color: #1979e7;
}
.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(2) {
border-color: #33b0ff;
}
.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(3) {
border-color: #75eaff;
}
.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(1) {
border-color: #18487f;
}
.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(2) {
border-color: #33b0ff;
}
.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(3) {
border-color: #75eaff;
}
.mathbox-overlays {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
pointer-events: none;
transform-style: preserve-3d;
overflow: hidden;
}
.mathbox-overlays > div {
transform-style: preserve-3d;
}
.mathbox-overlay > div {
position: absolute;
will-change: transform, opacity;
}
.mathbox-label {
font-family: sans-serif;
}
.mathbox-outline-1 {
text-shadow: -1px -1px 0px rgb(255, 255, 255), 1px 1px 0px rgb(255, 255, 255),
-1px 1px 0px rgb(255, 255, 255), 1px -1px 0px rgb(255, 255, 255),
1px 0px 1px rgb(255, 255, 255), -1px 0px 1px rgb(255, 255, 255),
0px -1px 1px rgb(255, 255, 255), 0px 1px 1px rgb(255, 255, 255);
}
.mathbox-outline-2 {
text-shadow: 0px -2px 0px rgb(255, 255, 255), 0px 2px 0px rgb(255, 255, 255),
-2px 0px 0px rgb(255, 255, 255), 2px 0px 0px rgb(255, 255, 255),
-1px -2px 0px rgb(255, 255, 255), -2px -1px 0px rgb(255, 255, 255),
-1px 2px 0px rgb(255, 255, 255), -2px 1px 0px rgb(255, 255, 255),
1px 2px 0px rgb(255, 255, 255), 2px 1px 0px rgb(255, 255, 255),
1px -2px 0px rgb(255, 255, 255), 2px -1px 0px rgb(255, 255, 255);
}
.mathbox-outline-3 {
text-shadow: 3px 0px 0px rgb(255, 255, 255), -3px 0px 0px rgb(255, 255, 255),
0px 3px 0px rgb(255, 255, 255), 0px -3px 0px rgb(255, 255, 255),
-2px -2px 0px rgb(255, 255, 255), -2px 2px 0px rgb(255, 255, 255),
2px 2px 0px rgb(255, 255, 255), 2px -2px 0px rgb(255, 255, 255),
-1px -2px 1px rgb(255, 255, 255), -2px -1px 1px rgb(255, 255, 255),
-1px 2px 1px rgb(255, 255, 255), -2px 1px 1px rgb(255, 255, 255),
1px 2px 1px rgb(255, 255, 255), 2px 1px 1px rgb(255, 255, 255),
1px -2px 1px rgb(255, 255, 255), 2px -1px 1px rgb(255, 255, 255);
}
.mathbox-outline-4 {
text-shadow: 4px 0px 0px rgb(255, 255, 255), -4px 0px 0px rgb(255, 255, 255),
0px 4px 0px rgb(255, 255, 255), 0px -4px 0px rgb(255, 255, 255),
-3px -2px 0px rgb(255, 255, 255), -3px 2px 0px rgb(255, 255, 255),
3px 2px 0px rgb(255, 255, 255), 3px -2px 0px rgb(255, 255, 255),
-2px -3px 0px rgb(255, 255, 255), -2px 3px 0px rgb(255, 255, 255),
2px 3px 0px rgb(255, 255, 255), 2px -3px 0px rgb(255, 255, 255),
-1px -2px 1px rgb(255, 255, 255), -2px -1px 1px rgb(255, 255, 255),
-1px 2px 1px rgb(255, 255, 255), -2px 1px 1px rgb(255, 255, 255),
1px 2px 1px rgb(255, 255, 255), 2px 1px 1px rgb(255, 255, 255),
1px -2px 1px rgb(255, 255, 255), 2px -1px 1px rgb(255, 255, 255);
}
.mathbox-outline-fill,
.mathbox-outline-fill * {
color: #fff !important;
}
| cchudzicki/mathbox | build/mathbox.css | CSS | mit | 10,293 |
{
"entryPoints": ["../src/types.ts"],
"out": "../typedoc"
}
| cchudzicki/mathbox | config/typedoc.json | JSON | mit | 64 |
const path = require("path");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
resolve: {
extensions: [".ts", ".js"],
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: "process/browser",
}),
],
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {
configFile: path.resolve(__dirname, "../tsconfig.json"),
},
},
],
},
// Activate source maps for the bundles in order to preserve the original
// source when the user debugs the application
devtool: "source-map",
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
test: /\.min\.js$/,
}),
],
},
};
| cchudzicki/mathbox | config/webpack.config.base.js | JavaScript | mit | 838 |
const { resolve } = require("path");
const baseConfig = require("./webpack.config.base");
module.exports = {
...baseConfig,
entry: resolve(__dirname, "../src/docs/generate.js"),
output: {
path: resolve(__dirname, "../build_docs"),
filename: "generate.js",
},
mode: "development",
};
| cchudzicki/mathbox | config/webpack.config.docs.js | JavaScript | mit | 302 |
const path = require("path");
const baseConfig = require("./webpack.config.base");
const libraryName = "MathBox";
const PATHS = {
entryPoint: path.resolve(__dirname, "../src/index.js"),
bundles: path.resolve(__dirname, "../build/bundle"),
};
const config = {
...baseConfig,
entry: {
mathbox: [PATHS.entryPoint],
"mathbox.min": [PATHS.entryPoint],
},
externals: {
three: "THREE",
"three/src/cameras/PerspectiveCamera.js": "THREE",
"three/src/constants.js": "THREE",
"three/src/core/BufferAttribute.js": "THREE",
"three/src/core/BufferGeometry.js": "THREE",
"three/src/core/Object3D.js": "THREE",
"three/src/geometries/PlaneGeometry.js": "THREE",
"three/src/materials/MeshBasicMaterial.js": "THREE",
"three/src/materials/RawShaderMaterial.js": "THREE",
"three/src/math/Color.js": "THREE",
"three/src/math/Euler.js": "THREE",
"three/src/math/Matrix3.js": "THREE",
"three/src/math/Matrix4.js": "THREE",
"three/src/math/Vector2.js": "THREE",
"three/src/math/Vector3.js": "THREE",
"three/src/math/Vector4.js": "THREE",
"three/src/math/Quaternion.js": "THREE",
"three/src/objects/Mesh.js": "THREE",
"three/src/renderers/WebGLRenderTarget.js": "THREE",
"three/src/scenes/Scene.js": "THREE",
"three/src/textures/Texture.js": "THREE",
},
// The output defines how and where we want the bundles. The special value
// `[name]` in `filename` tell Webpack to use the name we defined above. We
// target a UMD and name it MyLib. When including the bundle in the browser it
// will be accessible at `window.MyLib`
output: {
path: PATHS.bundles,
filename: "[name].js",
libraryTarget: "umd",
library: libraryName,
umdNamedDefine: true,
},
};
module.exports = config;
| cchudzicki/mathbox | config/webpack.config.js | JavaScript | mit | 1,791 |
const { resolve } = require("path");
const baseConfig = require("./webpack.config.base");
module.exports = {
entry: resolve(__dirname, "../test/test_entrypoint.js"),
output: {
path: resolve(__dirname, "../build_testing"),
filename: "spec_bundle.js",
},
mode: "development",
...baseConfig,
};
| cchudzicki/mathbox | config/webpack.config.testing.js | JavaScript | mit | 311 |
## API Overview
The MathBox API uses the concept of selections, similar to D3 or jQuery. The default API object, `mathbox`, returned from the mathBox() constructor, is a selection that points to the `<root />` node.
You can change properties on a selection by calling `.set()`, either to change a single property, or multiple at once:
```javascript
// Single
mathbox.set('focus', 3);
mathbox.set('speed', 2);
// Multiple
mathbox.set({
focus: 3,
speed: 2,
});
```
You can append elements to the root node by calling the matching `.type()` function, passing in its properties, e.g.:
```javascript
mathbox.cartesian({
range: [[-1, 1], [-1, 1]],
})
```
You may also pass in an object containing live expressions as a second parameter, which will be evaluated dynamically every frame, based on the (local) clock:
```javascript
mathbox.line({
// ...
}, {
width: function (time, delta) {
return 2 + Math.sin(time);
}
})
```
This is equivalent to calling `.bind()` after creation, which works similarly to `.set()`:
```javascript
// Single
mathbox.bind("width", function (time, delta) {
return 2 + Math.sin(time);
});
// Multiple
mathbox.bind({
width: function (time, delta) {
return 2 + Math.sin(time);
}
})
```
Here `time` is the elapsed clock time, while `delta` is the difference in time with the previous frame. The default clock is time elapsed since page load, but you may use the `<clock>` and `<now>` primitives to control time hierarchically.
## Functions on Selections
* `select("selector")` - A function on `mathbox` that returns a selection of all the nodes matching the selector. Like CSS, the selector may be the name of a primitive (e.g. `"camera"`), an id (e.g. `"#colors"`), or a class (e.g. `".points"`).
* `get("propName")` - Get the current value of a prop.
* `get()` - Get the current values of all props.
* `set("propName", value)` - Set a prop to the value provided.
* `set({ propName: value, ... })` - Set multiple props to the values provided.
* `bind("propName", function(t, d) { ... })` - Invoke the function every frame and set the prop to its return value.
* `bind({ propName: function(t, d) { ... }, ... })` - Invoke functions every frame to set multiple props to the return values.
Example: `present.set('index', present.get('index') + 1);`
## Additional APIs
* `inspect()` - Print (in the console) the DOM nodes in this selection. Called automatically on first load.
* `debug()` - Display a visual representation of all shader snippets, how they are wired, with the GLSL available on mouseover.
* `orig("propName")` - Return the value of the prop as passed in, i.e. without renormalization. Used mostly for pretty-printing.
* `orig()` - Return the values of all props as passed in, i.e. without renormalization. Used mostly for pretty-printing.
* `end()` - Indicate that subsequent nodes are siblings rather than children of the current node. Example: `group().child().child().end().sibling();`
* `each(function (node) { ... })` - Iterate over a selection's nodes in document order and discard the return values.
* `map(function (node) { return ... })` - Iterate over a selection's nodes in document order and return the resulting values as an array.
* `eq(i)` - Select the i'th node where i is a 0-indexed number of the node in question.
| cchudzicki/mathbox | docs/api.md | Markdown | mit | 3,307 |
### MathBox.Context
See `examples/test/context.html` for a full usage example.
```javascript
var context = new MathBox.Context(renderer, scene, camera);
// Insert / remove from scene and surrounding DOM.
context.init();
context.destroy();
// Basic dimensions
context.resize(size = {viewWidth: WIDTH, viewHeight: HEIGHT});
// OR Give exact dimensions
context.resize(size = {viewWidth: WIDTH, viewHeight: HEIGHT,
renderWidth: WIDTH, renderHeight: HEIGHT,
aspect: WIDTH / HEIGHT, pixelRatio: 1});
// Update one frame
context.frame();
// OR Update with custom clock
context.frame(time = {now, time, delta, clock, step});
// OR Step through update cycle
context.pre(time = {now, time, delta, clock, step});
context.update()
context.render()
context.post()
// now: unix timestamp in s
// time: real time in s
// delta: real time step in s
// clock: adjustable clock in s
// step: adjustable step in s
```
| cchudzicki/mathbox | docs/context.md | Markdown | mit | 957 |
# Glossary
## DOM
* DOM - Document Object Model. In general, refers to the HTML on the page. In MathBox, refers to the virtual DOM of nodes and their hierarchical structure.
* Node - An instance of a primitive, inserted into the MathBox DOM.
* Primitive - One of the basic building blocks of MathBox.
* Prop or Property - An individual value set on a node. Collectively *props*.
* Selection - A subset of the DOM. Can be the entire DOM or all nodes matching a selector. Selections typically match a CSS-like selector, for example the name of a primitive (`"camera"`), an id (`"#colors"`), or a class (`".points"`).
## Graphics
* RTT - Render To Texture. Rather than drawing directly to the screen, renders to an image that can be processed further.
* Shader - A program written in GLSL that runs on the GPU. GLSL syntax is similar to C++.
* [ShaderGraph](https://github.com/unconed/shadergraph) - A component/dependency of MathBox that dynamically compiles small GLSL functions (snippets) into a single shader.
* [Three.js](http://threejs.org/) - A popular library for WebGL. Used by MathBox for cameras and controls.
* [Threestrap](https://github.com/unconed/threestrap) - A bootstrapping tool to set options for Three.js.
* WebGL - JavaScript API for rendering 3D scenes, used by MathBox.
## Data
* `expr` - A prop on data primitives that expects a function, whose arguments are:
* `emit` - Another function. When called, its arguments become data.
* `x, y, z` - Up to three numbers indicating the location of the current point. Interval (1D), Area (2D), and Volume (3D) will evenly sample the current view for these coordinates. If you don't need them, use Array, Matrix, or Voxel, which omit these arguments.
* `i, j, k` - One to three indices of the current point.
* `t` - Time elapsed since program start, in seconds.
* `d` - Time delta since last frame, in seconds.
* Width - The size of the data in the *x* direction, i.e. the number of rows.
* Height - The size of the data in the *y* direction, i.e. the number of columns.
* Depth - The size of the data in the *z* direction, i.e. the number of stacks.
* Items - The size of the data in the *w* direction, i.e. the number of data points per spatial location. The number of times `emit` is called in the `expr` function.
* Channels - How many numbers are associated with a data point. The number of arguments passed to `emit`. This is not an array dimension; it is how many numbers make up one array element.
* History - The process of storing previous 1D or 2D data in an unused dimension.
* Swizzling - The process of isolating, reordering, and/or duplicating elements of a vector, by listing indices. For example, the swizzle `"yxz"` switches x and y. The `swizzle` primitive operates on array elements; the `transpose` primitive operates on the dimensions of the array itself.
| cchudzicki/mathbox | docs/glossary.md | Markdown | mit | 2,853 |
# MathBox Quick Start
### What?
MathBox is a computational graphing library. In simple use cases, it can elegantly draw 2D, 3D or 4D graphs, including points, vectors, labels, wireframes and shaded surfaces.
In more advanced use, data can be processed inside MathBox, compiled into GPU programs which can feed back into themselves. By combining shaders and render-to-texture effects, you can create sophisticated visual effects, including classic Winamp-style music visualizers.
### How?
You create MathBox scenes by composing a MathBox object tree, similar to HTML. Unlike HTML, the DOM is defined in JavaScript. This lets you freely mix the declarative model with custom expressions.
To show anything in MathBox, you need to establish four things:
1) A camera that is looking at...
2) A coordinate system which contains...
3) Geometrical data represented via...
4) A choice of shape to draw it as.
For example, a 2D rectangular view containing an array of points, drawn as a continuous line. Let's do that.

[Download MathBox](http://acko.net/files/mathbox2/mathbox-0.0.5.zip) (ZIP). See [README](/README.md) for more info.
*Note: Open `examples/empty.html` in your text editor and browser to follow along. You can also use the [JSBin](http://jsbin.com/hasuhaw/edit?html,output), but you'll want to turn off "Auto-run" in the top right.*
### Start with the camera
The default 3D camera starts out at `[0, 0, 0]` (i.e. X, Y, Z), right in the middle of our diagram. +Z goes out of the screen and -Z into the screen.
We insert our own camera and pull back its position 3 units to `[0, 0, 3]`. We also set `proxy` to true: this allows interactive camera controls to override our given position.
```javascript
var camera = mathbox.camera({
proxy: true,
position: [0, 0, 3],
});
```
Our mathbox DOM now looks like:
```jsx
<root>
<camera proxy={true} position={[0, 0, 3]} />
</root>
```
*Note: You can look at the state of the DOM at any time by doing `mathbox.print()`.*
The return value, `camera`, is a mathbox selection that points to the `<camera />` element. This is similar to how jQuery selections work. You can also select elements with CSS selectors, e.g. finding our camera:
```javascript
camera = mathbox.select('camera');
```
### Add a coordinate system
Now we're going to set up a simple 2D cartesian coordinate system. We'll make it twice as wide as high.
```javascript
var view = mathbox.cartesian({
range: [[-2, 2], [-1, 1]],
scale: [2, 1],
});
```
The `range` specifies the area we're looking at as an array of pairs, `[-2, 2]` in the X direction, `[-1, 1]` in the Y direction.
The `scale` specifies the projected size of the view, in this case [2, 1], i.e. 2 X units and 1 Y unit.
We'll immediately add two axes and a grid so we can finally see something:
```javascript
view
.axis({
axis: 1,
width: 3,
})
.axis({
axis: 2,
width: 3,
})
.grid({
width: 2,
divideX: 20,
divideY: 10,
});
```
You should see them appear in 50% gray, the default color, at the given widths. The DOM now looks like this:
```jsx
<root>
<camera proxy={true} position={[0, 0, 3]} />
<cartesian range={[[-2, 2], [-1, 1]]} scale={[2, 1]}>
<axis axis={1} width={3} />
<axis axis={2} width={3} />
<grid width={2} divideX={20} divideY={10} />
</cartesian>
</root>
```
You could make your axes black by giving them a `color: "black"`, either by adding the property above, or by setting it after the fact:
```javascript
mathbox.select('axis').set('color', 'black');
```
As the on-screen size of elements depends on the position of the camera, we can calibrate our units by setting the `focus` on the `<root>` to match the camera distance:
```javascript
mathbox.set('focus', 3);
```
Which gives us:
```jsx
<root focus={3}>
<camera proxy={true} position={[0, 0, 3]} />
<cartesian range={[[-2, 2], [-1, 1]]} scale={[2, 1]}>
<axis axis={1} width={3} color="black" />
<axis axis={2} width={3} color="black" />
<grid width={2} divideX={20} divideY={10} />
</cartesian>
</root>
```
*Note: You can use `.get("prop")`/`.set("prop", value)` to set individual properties, or use `.get()` and `.set({ prop: value })` to change multiple properties at once.*
### Add some data and draw it
Now we'll draw a moving sine wave. First we create an `interval`, this is a 1D array, sampled over the cartesian view's range. It contains an `expr`, an expression to generate the data points.
We generate 64 points, each with two `channels`, i.e. X and Y values.
```javascript
var data =
view.interval({
expr: function (emit, x, i, t) {
emit(x, Math.sin(x + t));
},
width: 64,
channels: 2,
});
```
Here, `x` is the sampled X coordinate, `i` is the array index (0-63), and `t` is clock time in seconds, starting from 0. The use of `emit` is similar to `return`ing a value. It is used to allow multiple values to be emitted very efficiently.
Once we have the data, we can draw it, by adding on a `<line />`:
```javascript
var curve =
view.line({
width: 5,
color: '#3090FF',
});
```
Here we use an HTML hex color instead of a named color. CSS syntax like `"rgb(255,128,53)"` works too.
The DOM now looks like:
```jsx
<root focus={3}>
<camera proxy={true} position={[0, 0, 3]} />
<cartesian range={[[-2, 2], [-1, 1]]} scale={[2, 1]}>
<axis axis={1} width={3} color="black" />
<axis axis={2} width={3} color="black" />
<grid width={2} divideX={20} divideY={10} />
<interval expr={(emit, x, i, t) => {
emit(x, Math.sin(x + t));
}} width={64} channels={2} />
<line width={5} color="#3090FF" />
</cartesian>
</root>
```
### Add more shapes
The nice thing about separating data from shape is that you can draw the same data multiple ways. For example, add on `<point />` to draw points as well:
```javascript
var points =
view.point({
size: 8,
color: '#3090FF',
});
```
The different shapes available are documented in `primitives.md`. Points, lines and surfaces are pretty obvious and do what it says on the tin. e.g. Fill a 2D `<area>` will data and pass it to a `<surface>` to draw a solid triangle mesh.
For vectors, faces and strips though, the situation changes. To draw 64 vectors as arrows, you need 128 points: a start and end for each. Thus the data has to change. We set `items` to 2 and emit two points per iteration. We also add on a green `<vector />` to draw the data:
```javascript
var vector =
view.interval({
expr: function (emit, x, i, t) {
emit(x, 0);
emit(x, -Math.sin(x + t));
},
width: 64,
channels: 2,
items: 2,
})
.vector({
end: true,
width: 5,
color: '#50A000',
});
```
```jsx
<root focus={3}>
<camera proxy={true} position={[0, 0, 3]} />
<cartesian range={[[-2, 2], [-1, 1]]} scale={[2, 1]}>
<axis axis={1} width={3} color="black" />
<axis axis={2} width={3} color="black" />
<grid width={2} divideX={20} divideY={10} />
<interval expr={(emit, x, i, t) => {
emit(x, Math.sin(x + t));
}} width={64} channels={2} />
<line width={5} color="#3090FF" />
<point size={8} color="#3090FF" />
<interval expr={(emit, x, i, t) => {
emit(x, 0);
emit(x, -Math.sin(x + t));
}} width={64} channels={2} items={2} />
<vector end={true} width={5} color="#50A000" />
</cartesian>
</root>
```
*Alternatively, you can also supply an array of `data`, either constant or changing, flat or nested. MathBox will iterate over it and emit it for you, picking up any live data. If your data does not change, you can set `live: false` to optimize.*
### Add some floating labels
Finally we'll label our coordinate system. First we need to establish a `<scale />`, which will divide our view into nice intervals.
```javascript
var scale =
view.scale({
divide: 10,
});
```
We can draw our scale as tick marks with `<ticks />`:
```javascript
var ticks =
view.ticks({
width: 5,
size: 15,
color: 'black',
});
```
Now we need to format our numbers into rasterized text:
```javascript
var format =
view.format({
digits: 2,
weight: 'bold',
});
```
And finally draw the text as floating labels:
```javascript
var labels =
view.label({
color: 'red',
zIndex: 1,
});
```
Here we apply `zIndex` similar to CSS to ensure the labels overlap in 2D rather than being placed in 3D. It specifies a layer index, with 0 being the default, and layers 1...n stacking on top. Negative zIndex is not allowed.
*Note: Unlike CSS, large zIndex values are not recommended, as the higher the z-Index, the less depth resolution you have.*
### Make it move
Finally we'll add on a little bit of animation by adding a `<play />` block.
```javascript
var play = mathbox.play({
target: 'cartesian',
pace: 5,
to: 2,
loop: true,
script: [
{props: {range: [[-2, 2], [-1, 1]]}},
{props: {range: [[-4, 4], [-2, 2]]}},
{props: {range: [[-2, 2], [-1, 1]]}},
]
});
```
Here `script` defines the keyframes we'll be animating through. We specify `props` will change, namely the `range`. We pass in the keyframes as an array, which will assign them to evenly spaced keyframes (0, 1, 2).
We set the `pace` of the animation to 5 seconds per step, tell it to play till keyframe time `2` and to `loop` afterwards.
```jsx
<root focus={3}>
<camera proxy={true} position={[0, 0, 3]} />
<cartesian range={[[-2, 2], [-1, 1]]} scale={[2, 1]}>
<axis axis={1} width={3} color="black" />
<axis axis={2} width={3} color="black" />
<grid width={2} divideX={20} divideY={10} />
<interval expr={(emit, x, i, t) => {
emit(x, Math.sin(x + t));
}} width={64} channels={2} />
<line width={5} color="#3090FF" />
<point size={8} color="#3090FF" />
<interval expr={(emit, x, i, t) => {
emit(x, 0);
emit(x, -Math.sin(x + t));
}} width={64} channels={2} items={2} />
<vector end={true} width={5} color="#50A000" />
<scale divide={10} />
<ticks width={5} size={15} color="black" />
<format digits={2} weight="bold" />
<label color="red" zIndex={1} />
</cartesian>
<play target="cartesian" to={2} loop={true} pace={5} script={[{props: {range: [[-2, 2], [-1, 1]]}}, {props: {range: [[-4, 4], [-2, 2]]}}, {props: {range: [[-2, 2], [-1, 1]]}}]} />
</root>
```
When you're done, you can do a `mathbox.remove("*")` to empty out the tree and start with a clean slate, or `mathbox.select('cartesian > *').remove()` to empty out the view only.
---
See `examples/` for more ideas and `examples/test` for specific usage.
| cchudzicki/mathbox | docs/intro.md | Markdown | mit | 10,706 |
## List of MathBox Primitives
*Grouped by module.*
#### base
* [group](#base/group) - Group elements for visibility and activity
* [inherit](#base/inherit) - Inherit and inject a trait from another element
* [root](#base/root) - Tree root
* [unit](#base/unit) - Change unit sizing for drawing ops
#### camera
* [camera](#camera/camera) - Camera instance or proxy
#### data
* [array](#data/array) - 1D array
* [interval](#data/interval) - 1D sampled array
* [matrix](#data/matrix) - 2D matrix
* [area](#data/area) - 2D sampled matrix
* [voxel](#data/voxel) - 3D voxels
* [volume](#data/volume) - 3D sampled voxels
* [scale](#data/scale) - Human-friendly divisions on an axis, subdivided as needed
#### draw
* [axis](#draw/axis) - Draw an axis
* [face](#draw/face) - Draw polygon faces
* [grid](#draw/grid) - Draw a 2D line grid
* [line](#draw/line) - Draw lines
* [point](#draw/point) - Draw points
* [strip](#draw/strip) - Draw triangle strips
* [surface](#draw/surface) - Draw surfaces
* [ticks](#draw/ticks) - Draw ticks
* [vector](#draw/vector) - Draw vectors
#### operator
* [clamp](#operator/clamp) - Clamp out-of-bounds samples to the nearest data point
* [grow](#operator/grow) - Scale data relative to reference data point
* [join](#operator/join) - Join two array dimensions into one by concatenating rows/columns/stacks
* [lerp](#operator/lerp) - Linear interpolation of data
* [memo](#operator/memo) - Memoize data to an array/texture
* [readback](#operator/readback) - Read data back to a binary JavaScript array
* [resample](#operator/resample) - Resample data to new dimensions with a shader
* [repeat](#operator/repeat) - Repeat data in one or more dimensions
* [swizzle](#operator/swizzle) - Swizzle data values
* [spread](#operator/spread) - Spread data values according to array indices
* [split](#operator/split) - Split one array dimension into two by splitting rows/columns/etc
* [slice](#operator/slice) - Select one or more rows/columns/stacks
* [subdivide](#operator/subdivide) - Subdivide data points evenly or with a bevel
* [transpose](#operator/transpose) - Transpose array dimensions
#### overlay
* [html](#overlay/html) - HTML element source
* [dom](#overlay/dom) - HTML DOM injector
#### present
* [move](#present/move) - Move elements in/out on transition
* [play](#present/play) - Play a sequenced animation
* [present](#present/present) - Present a tree of slides
* [reveal](#present/reveal) - Reveal/hide elements on transition
* [slide](#present/slide) - Presentation slide
* [step](#present/step) - Step through a sequenced animation
#### rtt
* [rtt](#rtt/rtt) - Render objects to a texture
* [compose](#rtt/compose) - Full-screen render pass
#### shader
* [shader](#shader/shader) - Custom shader snippet
#### text
* [text](#text/text) - GL text source
* [format](#text/format) - Text formatter
* [label](#text/label) - Draw GL labels
* [retext](#text/retext) - Text atlas resampler
#### time
* [clock](#time/clock) - Relative clock that starts from zero.
* [now](#time/now) - Absolute UNIX time in seconds since 01/01/1970
#### transform
* [transform](#transform/transform) - Transform geometry in 3D
* [transform4](#transform/transform4) - Transform geometry in 4D
* [vertex](#transform/vertex) - Apply custom vertex shader pass
* [fragment](#transform/fragment) - Apply custom fragment shader pass
* [layer](#transform/layer) - Independent 2D layer/overlay
* [mask](#transform/mask) - Apply custom mask pass
#### view
* [view](#view/view) - Adjust view range
* [cartesian](#view/cartesian) - Apply cartesian view
* [cartesian4](#view/cartesian4) - Apply 4D cartesian view
* [polar](#view/polar) - Apply polar view
* [spherical](#view/spherical) - Apply spherical view
* [stereographic](#view/stereographic) - Apply stereographic projection
* [stereographic4](#view/stereographic4) - Apply 4D stereographic projection
---
### Reference
#### <a name="data/area"></a>`data/area`
*2D sampled matrix*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *axes* = `[1, 2]` (swizzle(2) axis) - Axis pair
* *bufferHeight* = `1` (number) - Matrix buffer height
* *bufferWidth* = `1` (number) - Matrix buffer width
* *centeredX* = `false` (bool) - Centered instead of corner sampling
* *centeredY* = `false` (bool) - Centered instead of corner sampling
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *expr* = `null` (nullable emitter) - Data emitter expression, e.g. `function (emit, x, y, i, j, time, delta) { ... }`
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *height* = `1` (nullable number) - Matrix height
* *history* = `1` (number) - Matrix history
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *paddingX* = `0` (number) - Number of samples padding
* *paddingY* = `0` (number) - Number of samples padding
* *rangeX* = `[-1, 1]` (vec2) - Range on axis
* *rangeY* = `[-1, 1]` (vec2) - Range on axis
* *realtime* = `false` (bool) - Run on real time, not clock time
* *type* = `"float"` (type) - Texture data type
* *width* = `1` (nullable number) - Matrix width
#### <a name="data/array"></a>`data/array`
*1D array*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *bufferWidth* = `1` (number) - Array buffer width
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *expr* = `null` (nullable emitter) - Data emitter expression, e.g. `function (emit, i, time, delta) { ... }`
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *history* = `1` (number) - Array history
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *realtime* = `false` (bool) - Run on real time, not clock time
* *type* = `"float"` (type) - Texture data type
* *width* = `1` (nullable number) - Array width
#### <a name="draw/axis"></a>`draw/axis`
*Draw an axis*
* *axis* = `1` (axis) - Axis
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *crossed* = `true` (bool) - UVWO map on matching axis
* *depth* = `1` (number) - Depth scaling
* *detail* = `1` (number) - Geometric detail
* *end* = `true` (bool) - Draw end arrow
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *opacity* = `1` (positive number) - Opacity
* *origin* = `[0, 0, 0, 0]` (vec4) - 4D Origin
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *range* = `[-1, 1]` (vec2) - Range on axis
* *size* = `3` (number) - Arrow size
* *start* = `true` (bool) - Draw start arrow
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `-1` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="camera/camera"></a>`camera/camera`
*Camera instance or proxy*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *eulerOrder* = `"xyz"` (swizzle) - 3D Euler order
* *fov* = `null` (nullable number) - Field-of-view (degrees), e.g. `60`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *lookAt* = `null` (nullable vec3) - 3D Look at, e.g. `[2, 3, 4]`
* *position* = `null` (nullable vec3) - 3D Position, e.g. `[1, 2, 3]`
* *proxy* = `false` (bool) - Re-use existing camera
* *quaternion* = `null` (nullable quat) - 3D Quaternion, e.g. `[0.707, 0, 0, 0.707]`
* *rotation* = `null` (nullable vec3) - 3D Euler rotation, e.g. `[π/2, 0, 0]`
* *up* = `null` (nullable vec3) - 3D Up, e.g. `[0, 1, 0]`
#### <a name="view/cartesian"></a>`view/cartesian`
*Apply cartesian view*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *eulerOrder* = `xyz` (swizzle) - Euler order
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0]` (vec3) - 3D Position
* *quaternion* = `[0, 0, 0, 1]` (quat) - 3D Quaternion
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *rotation* = `[0, 0, 0]` (vec3) - 3D Euler rotation
* *scale* = `[1, 1, 1]` (vec3) - 3D Scale
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="view/cartesian4"></a>`view/cartesian4`
*Apply 4D cartesian view*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0, 0]` (vec4) - 4D Position
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *scale* = `[1, 1, 1, 1]` (vec4) - 4D Scale
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="operator/clamp"></a>`operator/clamp`
*Clamp out-of-bounds samples to the nearest data point*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *source* = `"<"` (select) - Input source
#### <a name="time/clock"></a>`time/clock`
*Relative clock that starts from zero.*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *delay* = `0` (number) - Play delay
* *from* = `0` (number) - Play from
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *loop* = `false` (bool) - Loop
* *pace* = `1` (number) - Play pace
* *realtime* = `false` (bool) - Run on real time, not clock time
* *seek* = `null` (nullable number) - Seek to time, e.g. `4`
* *speed* = `1` (number) - Play speed
* *to* = `Infinity` (number) - Play until
#### <a name="rtt/compose"></a>`rtt/compose`
*Full-screen render pass*
* *alpha* = `false` (bool) - Compose with alpha transparency
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *color* = `"white"` (color) - Color
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *opacity* = `1` (positive number) - Opacity
* *source* = `"<"` (select) - Input source
* *visible* = `true` (bool) - Visibility for rendering
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `false` (bool) - Test Z buffer
* *zWrite* = `false` (bool) - Write Z buffer
#### <a name="overlay/dom"></a>`overlay/dom`
*HTML DOM injector*
* *attributes* = `null` (nullable object) - HTML attributes, e.g. `{"style": {"color": "red"}}`
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *color* = `"rgb(255, 255, 255)"` (color) - Color
* *depth* = `0` (number) - Depth scaling
* *html* = `"<"` (select) - HTML data source
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *offset* = `[0, -20]` (vec2) - 2D offset
* *opacity* = `1` (positive number) - Opacity
* *outline* = `2` (number) - Outline size
* *pointerEvents* = `false` (bool) - Allow pointer events
* *points* = `"<"` (select) - Points data source
* *size* = `16` (number) - Text size
* *snap* = `false` (bool) - Snap to pixel
* *visible* = `true` (bool) - Visibility for rendering
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zoom* = `1` (number) - HTML zoom
#### <a name="draw/face"></a>`draw/face`
*Draw polygon faces*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `1` (number) - Depth scaling
* *fill* = `true` (bool) - Fill mesh
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *line* = `false` (bool) - Draw line
* *lineBias* = `5` (number) - Z-Bias for lines on fill
* *map* = `null` (nullable select) - Texture map source, e.g. `"#map"`
* *opacity* = `1` (positive number) - Opacity
* *points* = `<` (select) - Points data source
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *shaded* = `false` (bool) - Shade mesh
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="text/format"></a>`text/format`
*Text formatter*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable array) - Array of labels, e.g. `["Grumpy", "Sleepy", "Sneezy"]`
* *detail* = `24` (number) - Font detail
* *digits* = `null` (nullable positive number) - Digits of precision, e.g. `2`
* *expr* = `null` (nullable function) - Label formatter expression, e.g. `function (x, y, z, w, i, j, k, l, time, delta) { ... }`
* *font* = `"sans-serif"` (font) - Font family
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"linear"` (filter) - Texture magnification filtering
* *minFilter* = `"linear"` (filter) - Texture minification filtering
* *sdf* = `5` (number) - Signed distance field range
* *source* = `"<"` (select) - Input source
* *style* = `""` (string) - Font style, e.g. `"italic"`
* *type* = `"float"` (type) - Texture data type
* *variant* = `""` (string) - Font variant, e.g. `"small-caps"`
* *weight* = `""` (string) - Font weight, e.g. `"bold"`
#### <a name="transform/fragment"></a>`transform/fragment`
*Apply custom fragment shader pass*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *gamma* = `false` (boolean) - Pass RGBA values in sRGB instead of linear RGB
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"light"` (fragmentPass) - Fragment pass (color, light, rgba)
* *shader* = `"<"` (select) - Shader to use
#### <a name="draw/grid"></a>`draw/grid`
*Draw a 2D line grid*
* *axes* = `[1, 2]` (swizzle(2) axis) - Axis pair
* *baseX* = `10` (number) - Power base for sub/super units
* *baseY* = `10` (number) - Power base for sub/super units
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *closedX* = `false` (bool) - Close X lines
* *closedY* = `false` (bool) - Close Y lines
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *crossed* = `true` (bool) - UVWO map on matching axes
* *crossedX* = `true` (bool) - UVWO map on matching axis
* *crossedY* = `true` (bool) - UVWO map on matching axis
* *depth* = `1` (number) - Depth scaling
* *detailX* = `1` (number) - Geometric detail
* *detailY* = `1` (number) - Geometric detail
* *divideX* = `10` (number) - Number of divisions
* *divideY* = `10` (number) - Number of divisions
* *endX* = `true` (bool) - Include end
* *endY* = `true` (bool) - Include end
* *factorX* = `1` (positive number) - Scale factor
* *factorY* = `1` (positive number) - Scale factor
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *lineX* = `true` (bool) - Draw X lines
* *lineY* = `true` (bool) - Draw Y lines
* *modeX* = `"linear"` (scale) - Scale type
* *modeY* = `"linear"` (scale) - Scale type
* *niceX* = `true` (bool) - Snap to nice numbers
* *niceY* = `true` (bool) - Snap to nice numbers
* *opacity* = `1` (positive number) - Opacity
* *origin* = `[0, 0, 0, 0]` (vec4) - 4D Origin
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *rangeX* = `[-1, 1]` (vec2) - Range on axis
* *rangeY* = `[-1, 1]` (vec2) - Range on axis
* *startX* = `true` (bool) - Include start
* *startY* = `true` (bool) - Include start
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *unitX* = `1` (number) - Reference unit
* *unitY* = `1` (number) - Reference unit
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `1` (positive number) - Line width
* *zBias* = `-2` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
* *zeroX* = `true` (bool) - Include zero
* *zeroY* = `true` (bool) - Include zero
#### <a name="base/group"></a>`base/group`
*Group elements for visibility and activity*
* *active* = `true` (bool) - Updates continuously
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="operator/grow"></a>`operator/grow`
*Scale data relative to reference data point*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable anchor) - Depth alignment
* *height* = `null` (nullable anchor) - Height alignment
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `null` (nullable anchor) - Items alignment
* *scale* = `1` (number) - Scale factor
* *source* = `"<"` (select) - Input source
* *width* = `null` (nullable anchor) - Width alignment
#### <a name="overlay/html"></a>`overlay/html`
*HTML element source*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *bufferDepth* = `1` (number) - Voxel buffer depth
* *bufferHeight* = `1` (number) - Voxel buffer height
* *bufferWidth* = `1` (number) - Voxel buffer width
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *depth* = `1` (nullable number) - Voxel depth
* *expr* = `null` (nullable emitter) - Data emitter expression
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *height* = `1` (nullable number) - Voxel height
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *observe* = `false` (bool) - Pass clock time to data
* *realtime* = `false` (bool) - Run on real time, not clock time
* *width* = `1` (nullable number) - Voxel width
#### <a name="base/inherit"></a>`base/inherit`
*Inherit and inject a trait from another element*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
#### <a name="data/interval"></a>`data/interval`
*1D sampled array*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *axis* = `1` (axis) - Axis
* *bufferWidth* = `1` (number) - Array buffer width
* *centered* = `false` (bool) - Centered instead of corner sampling
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *expr* = `null` (nullable emitter) - Data emitter expression, e.g. `function (emit, x, i, time, delta) { ... }`
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *history* = `1` (number) - Array history
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *padding* = `0` (number) - Number of samples padding
* *range* = `[-1, 1]` (vec2) - Range on axis
* *realtime* = `false` (bool) - Run on real time, not clock time
* *type* = `"float"` (type) - Texture data type
* *width* = `1` (nullable number) - Array width
#### <a name="operator/join"></a>`operator/join`
*Join two array dimensions into one by concatenating rows/columns/stacks*
* *axis* = `null` (nullable axis) - Axis to join, e.g. `x`
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *order* = `"wxyz"` (transpose) - Axis order
* *overlap* = `1` (number) - Tuple overlap
* *source* = `"<"` (select) - Input source
#### <a name="text/label"></a>`text/label`
*Draw GL labels*
* *background* = `"rgb(255, 255, 255)"` (color) - Outline background
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `0` (number) - Depth scaling
* *expand* = `0` (number) - Expand glyphs
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *offset* = `[0, -20]` (vec2) - 2D offset
* *opacity* = `1` (positive number) - Opacity
* *outline* = `2` (number) - Outline size
* *points* = `<` (select) - Points data source
* *size* = `16` (number) - Text size
* *snap* = `false` (bool) - Snap to pixel
* *text* = `"<"` (select) - Text source
* *visible* = `true` (bool) - Visibility for rendering
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="transform/layer"></a>`transform/layer`
*Independent 2D layer/overlay*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `1` (number) - 3D Depth
* *fit* = `y` (fit) - Fit to (contain, cover, x, y)
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
#### <a name="operator/lerp"></a>`operator/lerp`
*Linear interpolation of data*
* *centeredW* = `false` (bool) - Centered instead of corner sampling
* *centeredX* = `false` (bool) - Centered instead of corner sampling
* *centeredY* = `false` (bool) - Centered instead of corner sampling
* *centeredZ* = `false` (bool) - Centered instead of corner sampling
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable number) - Lerp to depth, e.g. `5`
* *height* = `null` (nullable number) - Lerp to height, e.g. `5`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `null` (nullable number) - Lerp to items, e.g. `5`
* *paddingW* = `0` (number) - Number of samples padding
* *paddingX* = `0` (number) - Number of samples padding
* *paddingY* = `0` (number) - Number of samples padding
* *paddingZ* = `0` (number) - Number of samples padding
* *size* = `"absolute"` (mapping) - Scaling mode (relative, absolute)
* *source* = `"<"` (select) - Input source
* *width* = `null` (nullable number) - Lerp to width, e.g. `5`
#### <a name="draw/line"></a>`draw/line`
*Draw lines*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `1` (number) - Depth scaling
* *end* = `true` (bool) - Draw end arrow
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *opacity* = `1` (positive number) - Opacity
* *points* = `<` (select) - Points data source
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *size* = `3` (number) - Arrow size
* *start* = `true` (bool) - Draw start arrow
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="transform/mask"></a>`transform/mask`
*Apply custom mask pass*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *shader* = `"<"` (select) - Shader to use
#### <a name="data/matrix"></a>`data/matrix`
*2D matrix*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *bufferHeight* = `1` (number) - Matrix buffer height
* *bufferWidth* = `1` (number) - Matrix buffer width
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *expr* = `null` (nullable emitter) - Data emitter expression, e.g. `function (emit, i, j, time, delta) { ... }`
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *height* = `1` (nullable number) - Matrix height
* *history* = `1` (number) - Matrix history
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *realtime* = `false` (bool) - Run on real time, not clock time
* *type* = `"float"` (type) - Texture data type
* *width* = `1` (nullable number) - Matrix width
#### <a name="operator/memo"></a>`operator/memo`
*Memoize data to an array/texture*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *source* = `"<"` (select) - Input source
* *type* = `"float"` (type) - Texture data type
#### <a name="present/move"></a>`present/move`
*Move elements in/out on transition*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *delay* = `0` (number) - Transition delay
* *delayEnter* = `null` (nullable number) - Transition enter delay, e.g. `0.3`
* *delayExit* = `null` (nullable number) - Transition exit delay, e.g. `0.3`
* *duration* = `0.3` (number) - Transition duration
* *durationEnter* = `0.3` (number) - Transition enter duration
* *durationExit* = `0.3` (number) - Transition exit duration
* *enter* = `null` (nullable number) - Enter state, e.g. `0.5`
* *exit* = `null` (nullable number) - Exit state, e.g. `0.5`
* *from* = `[0, 0, 0, 0]` (vec4) - Enter from
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *stagger* = `[0, 0, 0, 0]` (vec4) - Stagger dimensions, e.g. `[2, 1, 0, 0]`
* *to* = `[0, 0, 0, 0]` (vec4) - Exit to
#### <a name="time/now"></a>`time/now`
*Absolute UNIX time in seconds since 01/01/1970*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *now* = `null` (nullable timestamp) - Current moment, e.g. `1444094929.619`
* *pace* = `1` (number) - Time pace
* *seek* = `null` (nullable number) - Seek to time
* *speed* = `1` (number) - Time speed
#### <a name="present/play"></a>`present/play`
*Play a sequenced animation*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *delay* = `0` (number) - Play delay
* *ease* = `"cosine"` (ease) - Animation ease (linear, cosine, binary, hold)
* *from* = `0` (number) - Play from
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *loop* = `false` (bool) - Loop
* *pace* = `1` (number) - Play pace
* *realtime* = `false` (bool) - Run on real time, not clock time
* *script* = `{}` (object) - Animation script, e.g. `{ "0": { props: { color: "red" }, expr: { size: function (t) { return Math.sin(t) + 1; }}}, "1": ...}`
* *speed* = `1` (number) - Play speed
* *target* = `"<"` (select) - Animation target
* *to* = `Infinity` (number) - Play until
* *trigger* = `1` (nullable number) - Trigger on step
#### <a name="draw/point"></a>`draw/point`
*Draw points*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `1` (number) - Depth scaling
* *fill* = `true` (bool) - Fill shape
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *opacity* = `1` (positive number) - Opacity
* *optical* = `true` (bool) - Optical or exact sizing
* *points* = `<` (select) - Points data source
* *shape* = `"circle"` (shape) - Point shape (circle, square, diamond, up, down, left, right)
* *size* = `4` (positive number) - Point size
* *sizes* = `null` (nullable select) - Point sizes data source, e.g. `"#sizes"`
* *visible* = `true` (bool) - Visibility for rendering
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="view/polar"></a>`view/polar`
*Apply polar view*
* *bend* = `1` (number) - Amount of polar bend
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *eulerOrder* = `xyz` (swizzle) - Euler order
* *helix* = `0` (number) - Expand into helix
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0]` (vec3) - 3D Position
* *quaternion* = `[0, 0, 0, 1]` (quat) - 3D Quaternion
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *rotation* = `[0, 0, 0]` (vec3) - 3D Euler rotation
* *scale* = `[1, 1, 1]` (vec3) - 3D Scale
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="present/present"></a>`present/present`
*Present a tree of slides*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *directed* = `true` (bool) - Apply directional transitions
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *index* = `1` (number) - Present slide number
* *length* = `0` (number) - Presentation length (computed)
#### <a name="operator/readback"></a>`operator/readback`
*Read data back to a binary JavaScript array*
* *active* = `true` (bool) - Updates continuously
* *channels* = `4` (number) - Readback channels (read only)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `[]` (data) - Readback data buffer (read only)
* *depth* = `1` (nullable number) - Readback depth (read only)
* *expr* = `null` (nullable function) - Readback consume expression, e.g. `function (x, y, z, w, i, j, k, l) { ... }`
* *height* = `1` (nullable number) - Readback height (read only)
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `1` (nullable number) - Readback items (read only)
* *source* = `"<"` (select) - Input source
* *type* = `"float"` (float) - Readback data type (float, unsignedByte)
* *width* = `1` (nullable number) - Readback width (read only)
#### <a name="operator/repeat"></a>`operator/repeat`
*Repeat data in one or more dimensions*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `1` (number) - Repeat depth
* *height* = `1` (number) - Repeat height
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `1` (number) - Repeat items
* *source* = `"<"` (select) - Input source
* *width* = `1` (number) - Repeat width
#### <a name="operator/resample"></a>`operator/resample`
*Resample data to new dimensions with a shader*
* *centeredW* = `false` (bool) - Centered instead of corner sampling
* *centeredX* = `false` (bool) - Centered instead of corner sampling
* *centeredY* = `false` (bool) - Centered instead of corner sampling
* *centeredZ* = `false` (bool) - Centered instead of corner sampling
* *channels* = `4` (number) - Resample channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable number) - Resample factor depth, e.g. `10`
* *height* = `null` (nullable number) - Resample factor height, e.g. `10`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *indices* = `4` (number) - Resample indices
* *items* = `null` (nullable number) - Resample factor items, e.g. `10`
* *paddingW* = `0` (number) - Number of samples padding
* *paddingX* = `0` (number) - Number of samples padding
* *paddingY* = `0` (number) - Number of samples padding
* *paddingZ* = `0` (number) - Number of samples padding
* *sample* = `"relative"` (mapping) - Source sampling (relative, absolute)
* *shader* = `"<"` (select) - Shader to use
* *size* = `"absolute"` (mapping) - Scaling mode (relative, absolute)
* *source* = `"<"` (select) - Input source
* *width* = `null` (nullable number) - Resample factor width, e.g. `10`
#### <a name="text/retext"></a>`text/retext`
*Text atlas resampler*
* *centeredW* = `false` (bool) - Centered instead of corner sampling
* *centeredX* = `false` (bool) - Centered instead of corner sampling
* *centeredY* = `false` (bool) - Centered instead of corner sampling
* *centeredZ* = `false` (bool) - Centered instead of corner sampling
* *channels* = `4` (number) - Resample channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable number) - Resample factor depth, e.g. `10`
* *height* = `null` (nullable number) - Resample factor height, e.g. `10`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *indices* = `4` (number) - Resample indices
* *items* = `null` (nullable number) - Resample factor items, e.g. `10`
* *paddingW* = `0` (number) - Number of samples padding
* *paddingX* = `0` (number) - Number of samples padding
* *paddingY* = `0` (number) - Number of samples padding
* *paddingZ* = `0` (number) - Number of samples padding
* *sample* = `"relative"` (mapping) - Source sampling (relative, absolute)
* *shader* = `"<"` (select) - Shader to use
* *size* = `"absolute"` (mapping) - Scaling mode (relative, absolute)
* *source* = `"<"` (select) - Input source
* *width* = `null` (nullable number) - Resample factor width, e.g. `10`
#### <a name="present/reveal"></a>`present/reveal`
*Reveal/hide elements on transition*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *delay* = `0` (number) - Transition delay
* *delayEnter* = `null` (nullable number) - Transition enter delay, e.g. `0.3`
* *delayExit* = `null` (nullable number) - Transition exit delay, e.g. `0.3`
* *duration* = `0.3` (number) - Transition duration
* *durationEnter* = `0.3` (number) - Transition enter duration
* *durationExit* = `0.3` (number) - Transition exit duration
* *enter* = `null` (nullable number) - Enter state, e.g. `0.5`
* *exit* = `null` (nullable number) - Exit state, e.g. `0.5`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *stagger* = `[0, 0, 0, 0]` (vec4) - Stagger dimensions, e.g. `[2, 1, 0, 0]`
#### <a name="base/root"></a>`base/root`
*Tree root*
* *camera* = `"[camera]"` (select) - Active camera
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *focus* = `1` (nullable number) - Camera focus distance in world units
* *fov* = `null` (nullable number) - (Vertical) Field-of-view to calibrate units for (degrees), e.g. `60`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *scale* = `null` (nullable number) - (Vertical) Reference scale of viewport in pixels, e.g. `720`
* *speed* = `1` (number) - Global speed
#### <a name="rtt/rtt"></a>`rtt/rtt`
*Render objects to a texture*
* *camera* = `"[camera]"` (select) - Active camera
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *height* = `null` (nullable number) - RTT height, e.g. `360`
* *history* = `1` (number) - RTT history
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *magFilter* = `"linear"` (filter) - Texture magnification filtering
* *minFilter* = `"linear"` (filter) - Texture minification filtering
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *speed* = `1` (number) - Global speed
* *type* = `"unsignedByte"` (type) - Texture data type
* *width* = `null` (nullable number) - RTT width, e.g. `640`
#### <a name="data/scale"></a>`data/scale`
*Human-friendly divisions on an axis, subdivided as needed*
* *axis* = `1` (axis) - Axis
* *base* = `10` (number) - Power base for sub/super units
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *divide* = `10` (number) - Number of divisions
* *end* = `true` (bool) - Include end
* *factor* = `1` (positive number) - Scale factor
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *mode* = `"linear"` (scale) - Scale type
* *nice* = `true` (bool) - Snap to nice numbers
* *origin* = `[0, 0, 0, 0]` (vec4) - 4D Origin
* *range* = `[-1, 1]` (vec2) - Range on axis
* *start* = `true` (bool) - Include start
* *unit* = `1` (number) - Reference unit
* *zero* = `true` (bool) - Include zero
#### <a name="shader/shader"></a>`shader/shader`
*Custom shader snippet*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *code* = `""` (string) - Shader code
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *language* = `"glsl"` (string) - Shader language
* *sources* = `null` (nullable select) - Sampler sources, e.g. `["#pressure", "#divergence"]`
* *uniforms* = `null` (nullable object) - Shader uniform objects (three.js style), e.g. `{ time: { type: 'f', value: 3 }}`
#### <a name="operator/slice"></a>`operator/slice`
*Select one or more rows/columns/stacks*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable vec2) - Slice from, to depth (excluding to), e.g. `[2, 4]`
* *height* = `null` (nullable vec2) - Slice from, to height (excluding to), e.g. `[2, 4]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `null` (nullable vec2) - Slice from, to items (excluding to), e.g. `[2, 4]`
* *source* = `"<"` (select) - Input source
* *width* = `null` (nullable vec2) - Slice from, to width (excluding to), e.g. `[2, 4]`
#### <a name="present/slide"></a>`present/slide`
*Presentation slide*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *early* = `0` (number) - Appear early steps
* *from* = `null` (nullable number) - Appear from step, e.g. `2`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *late* = `0` (number) - Stay late steps
* *order* = `0` (nullable number) - Slide order
* *steps* = `1` (number) - Slide steps
* *to* = `null` (nullable number) - Disappear on step, e.g. `4`
#### <a name="view/spherical"></a>`view/spherical`
*Apply spherical view*
* *bend* = `1` (number) - Amount of spherical bend
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *eulerOrder* = `xyz` (swizzle) - Euler order
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0]` (vec3) - 3D Position
* *quaternion* = `[0, 0, 0, 1]` (quat) - 3D Quaternion
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *rotation* = `[0, 0, 0]` (vec3) - 3D Euler rotation
* *scale* = `[1, 1, 1]` (vec3) - 3D Scale
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="operator/split"></a>`operator/split`
*Split one array dimension into two by splitting rows/columns/etc*
* *axis* = `null` (nullable axis) - Axis to split, e.g. `x`
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *length* = `1` (number) - Tuple length
* *order* = `"wxyz"` (transpose) - Axis order
* *overlap* = `1` (number) - Tuple overlap
* *source* = `"<"` (select) - Input source
#### <a name="operator/spread"></a>`operator/spread`
*Spread data values according to array indices*
* *alignDepth* = `0` (anchor) - Depth alignment
* *alignHeight* = `0` (anchor) - Height alignment
* *alignItems* = `0` (anchor) - Items alignment
* *alignWidth* = `0` (anchor) - Width alignment
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable vec4) - Depth offset, e.g. `[1.5, 0, 0, 0]`
* *height* = `null` (nullable vec4) - Height offset, e.g. `[1.5, 0, 0, 0]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `null` (nullable vec4) - Items offset, e.g. `[1.5, 0, 0, 0]`
* *source* = `"<"` (select) - Input source
* *unit* = `"relative"` (mapping) - Spread per item (absolute) or array (relative)
* *width* = `null` (nullable vec4) - Width offset, e.g. `[1.5, 0, 0, 0]`
#### <a name="present/step"></a>`present/step`
*Step through a sequenced animation*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *delay* = `0` (number) - Step delay
* *duration* = `0.3` (number) - Step duration
* *ease* = `"cosine"` (ease) - Animation ease (linear, cosine, binary, hold)
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pace* = `0` (number) - Step pace
* *playback* = `"linear"` (ease) - Playhead ease (linear, cosine, binary, hold)
* *realtime* = `false` (bool) - Run on real time, not clock time
* *rewind* = `2` (number) - Step rewind factor
* *script* = `{}` (object) - Animation script, e.g. `{ "0": { props: { color: "red" }, expr: { size: function (t) { return Math.sin(t) + 1; }}}, "1": ...}`
* *skip* = `true` (bool) - Speed up through skips
* *speed* = `1` (number) - Step speed
* *stops* = `null` (nullable number array) - Playhead stops, e.g. `[0, 1, 3, 5]`
* *target* = `"<"` (select) - Animation target
* *trigger* = `1` (nullable number) - Trigger on step
#### <a name="view/stereographic"></a>`view/stereographic`
*Apply stereographic projection*
* *bend* = `1` (number) - Amount of stereographic bend
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *eulerOrder* = `xyz` (swizzle) - Euler order
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0]` (vec3) - 3D Position
* *quaternion* = `[0, 0, 0, 1]` (quat) - 3D Quaternion
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *rotation* = `[0, 0, 0]` (vec3) - 3D Euler rotation
* *scale* = `[1, 1, 1]` (vec3) - 3D Scale
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="view/stereographic4"></a>`view/stereographic4`
*Apply 4D stereographic projection*
* *bend* = `1` (number) - Amount of stereographic bend
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0, 0]` (vec4) - 4D Position
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *scale* = `[1, 1, 1, 1]` (vec4) - 4D Scale
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="draw/strip"></a>`draw/strip`
*Draw triangle strips*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `1` (number) - Depth scaling
* *fill* = `true` (bool) - Fill mesh
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *line* = `false` (bool) - Draw line
* *lineBias* = `5` (number) - Z-Bias for lines on fill
* *map* = `null` (nullable select) - Texture map source, e.g. `"#map"`
* *opacity* = `1` (positive number) - Opacity
* *points* = `<` (select) - Points data source
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *shaded* = `false` (bool) - Shade mesh
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="operator/subdivide"></a>`operator/subdivide`
*Subdivide data points evenly or with a bevel*
* *bevel* = `1` (number) - Fraction to end outward from vertices
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *depth* = `null` (nullable positive int) - Divisions of depth, e.g. `5`
* *height* = `null` (nullable positive int) - Divisions of height, e.g. `5`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `null` (nullable positive int) - Divisions of items, e.g. `5`
* *lerp* = `true` (boolean) - Interpolate values with computed indices
* *source* = `"<"` (select) - Input source
* *width* = `null` (nullable positive int) - Divisions of width, e.g. `5`
#### <a name="draw/surface"></a>`draw/surface`
*Draw surfaces*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *closedX* = `false` (bool) - Close X lines
* *closedY* = `false` (bool) - Close Y lines
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *crossed* = `true` (bool) - UVWO map on matching axes
* *depth* = `1` (number) - Depth scaling
* *fill* = `true` (bool) - Fill mesh
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *lineBias* = `5` (number) - Z-Bias for lines on fill
* *lineX* = `false` (bool) - Draw X lines
* *lineY* = `false` (bool) - Draw Y lines
* *map* = `null` (nullable select) - Texture map source, e.g. `"#map"`
* *opacity* = `1` (positive number) - Opacity
* *points* = `<` (select) - Points data source
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *shaded* = `false` (bool) - Shade mesh
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="operator/swizzle"></a>`operator/swizzle`
*Swizzle data values*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *order* = `xyzw` (swizzle) - Swizzle order
* *source* = `"<"` (select) - Input source
#### <a name="text/text"></a>`text/text`
*GL text source*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *bufferDepth* = `1` (number) - Voxel buffer depth
* *bufferHeight* = `1` (number) - Voxel buffer height
* *bufferWidth* = `1` (number) - Voxel buffer width
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *depth* = `1` (nullable number) - Voxel depth
* *detail* = `24` (number) - Font detail
* *expr* = `null` (nullable emitter) - Data emitter expression
* *font* = `"sans-serif"` (font) - Font family
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *height* = `1` (nullable number) - Voxel height
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"linear"` (filter) - Texture magnification filtering
* *minFilter* = `"linear"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *realtime* = `false` (bool) - Run on real time, not clock time
* *sdf* = `5` (number) - Signed distance field range
* *style* = `""` (string) - Font style, e.g. `"italic"`
* *type* = `"float"` (type) - Texture data type
* *variant* = `""` (string) - Font variant, e.g. `"small-caps"`
* *weight* = `""` (string) - Font weight, e.g. `"bold"`
* *width* = `1` (nullable number) - Voxel width
#### <a name="draw/ticks"></a>`draw/ticks`
*Draw ticks*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `1` (number) - Depth scaling
* *epsilon* = `0.0001` (number) - Tick epsilon
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *normal* = `true` (bool) - Normal for reference plane
* *opacity* = `1` (positive number) - Opacity
* *points* = `<` (select) - Points data source
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *size* = `10` (number) - Tick size
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="transform/transform"></a>`transform/transform`
*Transform geometry in 3D*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *eulerOrder* = `xyz` (swizzle) - 3D Euler order
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *matrix* = `[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]` (mat4) - 3D Projective Matrix
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0]` (vec3) - 3D Position
* *quaternion* = `[0, 0, 0, 1]` (quat) - 3D Quaternion
* *rotation* = `[0, 0, 0]` (vec3) - 3D Euler rotation
* *scale* = `[1, 1, 1]` (vec3) - 3D Scale
#### <a name="transform/transform4"></a>`transform/transform4`
*Transform geometry in 4D*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *matrix* = `[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]` (mat4) - 4D Affine Matrix
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *position* = `[0, 0, 0, 0]` (vec4) - 4D Position
* *scale* = `[1, 1, 1, 1]` (vec4) - 4D Scale
#### <a name="operator/transpose"></a>`operator/transpose`
*Transpose array dimensions*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *order* = `xyzw` (transpose) - Transpose order
* *source* = `"<"` (select) - Input source
#### <a name="base/unit"></a>`base/unit`
*Change unit sizing for drawing ops*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *focus* = `1` (nullable number) - Camera focus distance in world units
* *fov* = `null` (nullable number) - (Vertical) Field-of-view to calibrate units for (degrees), e.g. `60`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *scale* = `null` (nullable number) - (Vertical) Reference scale of viewport in pixels, e.g. `720`
#### <a name="draw/vector"></a>`draw/vector`
*Draw vectors*
* *blending* = `"normal"` (blending) - Blending mode ('no, normal, add, subtract, multiply)
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *closed* = `false` (bool) - Close line
* *color* = `"rgb(128, 128, 128)"` (color) - Color
* *colors* = `null` (nullable select) - Colors data source, e.g. `"#colors"`
* *depth* = `1` (number) - Depth scaling
* *end* = `true` (bool) - Draw end arrow
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *opacity* = `1` (positive number) - Opacity
* *points* = `<` (select) - Points data source
* *proximity* = `null` (nullable number) - Proximity threshold, e.g. `10`
* *size* = `3` (number) - Arrow size
* *start* = `true` (bool) - Draw start arrow
* *stroke* = `"solid"` (stroke) - Line stroke (solid, dotted, dashed)
* *visible* = `true` (bool) - Visibility for rendering
* *width* = `2` (positive number) - Line width
* *zBias* = `0` (positive number) - Z-Bias (3D stacking)
* *zIndex* = `0` (positive int) - Z-Index (2D stacking)
* *zOrder* = `null` (nullable number) - Z-Order (drawing order), e.g. `2`
* *zTest* = `true` (bool) - Test Z buffer
* *zWrite* = `true` (bool) - Write Z buffer
#### <a name="transform/vertex"></a>`transform/vertex`
*Apply custom vertex shader pass*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *shader* = `"<"` (select) - Shader to use
#### <a name="view/view"></a>`view/view`
*Adjust view range*
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *pass* = `"view"` (vertexPass) - Vertex pass (data, view, world, eye)
* *range* = `[[-1, 1], [-1, 1], [-1, 1], [-1, 1]]` (array vec2) - 4D range in view
* *visible* = `true` (bool) - Visibility for rendering
#### <a name="data/volume"></a>`data/volume`
*3D sampled voxels*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *axes* = `[1, 2, 3]` (swizzle(3) axis) - Axis triplet
* *bufferDepth* = `1` (number) - Voxel buffer depth
* *bufferHeight* = `1` (number) - Voxel buffer height
* *bufferWidth* = `1` (number) - Voxel buffer width
* *centeredX* = `false` (bool) - Centered instead of corner sampling
* *centeredY* = `false` (bool) - Centered instead of corner sampling
* *centeredZ* = `false` (bool) - Centered instead of corner sampling
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *depth* = `1` (nullable number) - Voxel depth
* *expr* = `null` (nullable emitter) - Data emitter expression, e.g. `function (emit, x, y, z, i, j, k, time, delta) { ... }`
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *height* = `1` (nullable number) - Voxel height
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *paddingX* = `0` (number) - Number of samples padding
* *paddingY* = `0` (number) - Number of samples padding
* *paddingZ* = `0` (number) - Number of samples padding
* *rangeX* = `[-1, 1]` (vec2) - Range on axis
* *rangeY* = `[-1, 1]` (vec2) - Range on axis
* *rangeZ* = `[-1, 1]` (vec2) - Range on axis
* *realtime* = `false` (bool) - Run on real time, not clock time
* *type* = `"float"` (type) - Texture data type
* *width* = `1` (nullable number) - Voxel width
#### <a name="data/voxel"></a>`data/voxel`
*3D voxels*
* *aligned* = `false` (bool) - Use (fast) integer lookups
* *bufferDepth* = `1` (number) - Voxel buffer depth
* *bufferHeight* = `1` (number) - Voxel buffer height
* *bufferWidth* = `1` (number) - Voxel buffer width
* *channels* = `4` (number) - Number of channels
* *classes* = `[]` (string array) - Custom classes, e.g. `["big"]`
* *data* = `null` (nullable object) - Data array
* *depth* = `1` (nullable number) - Voxel depth
* *expr* = `null` (nullable emitter) - Data emitter expression, e.g. `function (emit, i, j, k, time, delta) { ... }`
* *fps* = `null` (nullable number) - Frames-per-second update rate, e.g. `60`
* *height* = `1` (nullable number) - Voxel height
* *hurry* = `5` (number) - Maximum frames to hurry per frame
* *id* = `null` (nullable string) - Unique ID, e.g. `"sampler"`
* *items* = `4` (number) - Number of items
* *limit* = `60` (number) - Maximum frames to track
* *live* = `true` (bool) - Update continuously
* *magFilter* = `"nearest"` (filter) - Texture magnification filtering
* *minFilter* = `"nearest"` (filter) - Texture minification filtering
* *observe* = `false` (bool) - Pass clock time to data
* *realtime* = `false` (bool) - Run on real time, not clock time
* *type* = `"float"` (type) - Texture data type
* *width* = `1` (nullable number) - Voxel width
| cchudzicki/mathbox | docs/primitives.md | Markdown | mit | 60,377 |