-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the (in-progress) mpos-precept wiki!
Add DOM elements to the scene based upon tag, tree, and settings. Update from live DOM. Apply view filter, arc.
Methods to grade and transform sets of elements or properties.
-
box
(rect, opts) -- transfers element properties and type into THREE, and may lazily callloader
-
css
(rect, progress) -- toggle ancestors.mp-unset
class (rotate, scale), transform quirks ofbox
matrix, and updaterect.ux
frame transforms -
dom
(selector, opts) -- parse HTML tags to depth (including comments) and updategrade
flat-grade deep-grade update NodeIterator::idx struct::mat atlas/transforms::box - if a
#comment
node begins//_THREE
it willexec()
unlessopts.parse()
is provided - if an unwrapped
#text
node has siblings it will be wrapped.mp-poster
- if a
-
fit
(dummy, group, opts) -- contain outputs -
loader
(source, dummy) -- pass data to THREE.FileLoader, THREE.SVGLoader, OpenCV... -
old
(selector) -- dispose of THREE.Group, resetdata-idx
, release listeners -
opencv
(img, group, dummy) -- WASM Module to image process (kmeans > inrange > contours) and create THREE.ShapeGeometry -
pyr
(width, height, thumb) -- returns dimensions scaled to thumb -
shader
(canvas, texStep) -- texture atlas shader for Instanced Mesh -
src
(el, url, attr) -- sets src
Initialize scene and events in standalone mode, or provide an existing scene
, camera
, and renderer
.
Criteria to filter DOM nodes.
-
allow
--['.mp-allow', …]
DOM selectors for depth and hierarchy -
block
--['.mp-block', …]
DOM selectors to blacklist unsafe elements -
canvas
-- atlas uses this globally -
cors
--['iframe','object','.yt']
DOM selectors for foreign objects, which don't draw inhtml-to-image
-
inPolar
(node, control) -- returns node visibility, to compare with threshold.var.opt.inPolar
false true 1 2 3 4 empty, control !CONTAINS control CONTAINS not empty tag visible in viewport -
index
-- count runs ofmpos.dom
-
manual
--['.mp-loader','.mp-native','.mp-poster']
shortcodes to passmat
type -
native
--['.mp-native', …]
DOM selectors for interactive which is traditionally CSS3D (if cors), or otherwise denoted withux
and coerced toatlas
(which isposter
) -
native3d
--[…]
DOM selectors stub for other 3D scenes -
poster
--['.mp-poster', …]
DOM selectors to draw texture atlas -
unset
--['.mp-offscreen']
shortcodes to passcss
quirks -
update
(grade, dataIdx) -- processqueue
(foratlas
orother
), which passesbox
arect
to add or update (based onmat
andobj
)
User-experience utilities.
-
event
(e) -- handle mouse events, withraycast
metadata -
observer
-- IntersectionObserver willupdate
elements which exceedinPolar
threshold -
raycast
(e) -- instancedatlas
layer maps todata-idx
of element/rect, and updates carot -
reflow
(e) -- lazily enqueueupdate
, fromevent
such as resize or scroll -
render
-- tick a step -
timers
--{ clear(key), frame: [], reflow: [] }
value-1
clears timer,0
draws frame,1+
draws frames each time
Variables commonly referenced.
-
camera
-- THREE.PerspectiveCamera -
caret
-- location of raycast element onatlas
and visibility in regard toinPolar
-
controls
-- THREE.MapControls -
cv
--true
if OpenCV was injected byloader
-
events
--{ target, x, y, position, ux }
current element meta fromraycast
, use byevent
MouseEvent -
fov
--{ w, h, z, max }
viewport, offset, and baseline relative unit -
geo
-- THREE.BoxGeometry -
grade
--{ atlas, group, rects, wait…}
current accumulation of DOM selector's output -
mat
-- THREE.MeshBasicMaterial for sides, cloned for front -
mat_line
-- THREE.LineBasicMaterial for back -
mat_shader
-- THREE.RawShaderMaterial for texture atlas -
mat_shape
-- THREE.MeshBasicMaterial for OpenCV contours -
opt
--{ address, arc, depth, dispose, inPolar, selector, update() }
options fordat.GUI
-
pointer
-- mouse position -
proxy
-- true ifinit
supplied a scene, camera, and renderer -
raycaster
-- THREE.Raycaster -
reflow
-- setTimeout -
renderer
-- THREE.Renderer forrect.mat
if (poster, atlas...) -
rendererCSS
-- THREE.Renderer forrect.mat
if (native, other...) -
scene
-- THREE.Scene -
unset
--{ display, margin, transform, left, right }
reset class forhtml-to-image
Accumulate process data.
-
atlas
-- count ofmat
typeposter
, and coerced ux which is traditionallynative
-
canvas
-- global canvas -
cells
-- sqrt of halfmaxEls
-
el
-- selector -
group
-- THREE.Group for current selector -
inPolar
-- count of elements at or above view threshold -
index
-- count invocations of program -
instanced
-- THREE.InstancedMesh -
key
--{ x, y }
atlas coordinate for empty rect (self, child) -
maxEls
-- count of all selector children -
maxRes
--cells * minRes
or16_384
-
minEls
-- count of elements added, affected byinPolar
and user events -
minRes
-- pow (fov
/fov.max
) * 128 -
osc
-- OffscreenCanvas -
r_
--{ queue, atlas, other }
subset ofrect
elements -
ray
-- update maps arect
data-idx to theinstanceId
for user events -
rects
-- reference element meta bydata-idx
-
scroll
--{ x, y }
-
txt
-- array of #text nodes that were wrapped -
wait
-- true when update is busy
Matches uri and mime against json|svg|gif|jpg|jpeg|png|webp|webm|mp4|ogv
.
-
File
-- manual class.mp-loader
outputs paths viaOpenCV
for mimes matching generic+image. Otherwise, THREE.FileLoader is specified but has no output. -
WEBM|MP4|OGV
-- THREE.VideoTexture -
.JSON
-- THREE.ObjectLoader, expects a valid object mesh -
.SVG
-- THREE.SVGLoader -
.GIF
-- SuperGif, cloned node becomes a CanvasTexture
Media treatment is determined by tag, manual class, and settings.
-
self
-- generic -
child
-- generic -
native
-- CSS3D, for elements of foreign origin (CORS) which html-to-image does not draw -
poster
-- html-to-image, which native is coerced to (for VR?) -
loader
-- File, SVGLoader, OpenCV WASM
Depth of selector tree is determined by a hierarchy of semantics, children, and settings.
-
allow
whitelist --.mp-allow,div,main,section,article,nav,header,footer,aside,tbody,tr,th,td,li,ul,ol,menu,figure,address
-
block
blacklist --.mp-block,canvas[data-engine~='three.js'],head,style,script,link,meta,applet,param,map,br,wbr,template,iframe:not([src])
-
native
CSS3DRenderer --.mp-native,a,canvas,iframe,frame,object,embed,svg,table,details,form,label,button,input,select,textarea,output,dialog,video,audio[controls]
-
poster
html-to-image --.mp-poster,canvas,picture,img,h1,h2,h3,h4,h5,h6,p,ul,ol,li,th,td,summary,caption,dt,dd,code,span,root
-
native3d
environment --model-viewer,a-scene,babylon,three-d-viewer,#stl_cont,#root,.sketchfab-embed-wrapper,StandardReality
-
cors
foreign --iframe,object,.yt
-
unset
quirks --.mp-offscreen
-
manual
user --.mp-loader,.mp-native,.mp-poster
Properties of DOM element.
-
atlas
-- FIFO index for InstancedMesh shader -
bound
-- DomRect withclient:{w,h}
updated fromcss
to compare forux
change -
css
--{ degree, radian, scale, style: CSSStyleDeclaration, transform }
-
el
-- DOM element -
frame
-- last update fromtimer
, prevents duplicate transforms -
inPolar
-- view threshold of element -
mat
-- fine label, derived from precept lists and manual classes -
r_
-- coarse label, may beatlas
orother
, largely derived frommat
-
ux
--{ i, o, u }
priority hint from (in) element type, (out+in) css state including pseudo, (update css/box/both) frame differs -
x
-- atlas x%/100 -
y
-- atlas y%/100 -
z
-- z-Index if set