documentation writing and API doc update

This commit is contained in:
2025-02-04 07:37:10 -06:00
parent ede899e9a3
commit 5e7c946d43
40 changed files with 1791 additions and 769 deletions

View File

@@ -1,140 +1,10 @@
# Color
#### white
**array**
# color Module
[
1,
1,
1,
1
]
#### black
**array**
[
0,
0,
0,
1
]
#### blue
**array**
[
0.32941176470588235,
0.43137254901960786,
1,
1
]
#### green
**array**
[
0.47058823529411764,
1,
0.0392156862745098,
1
]
#### yellow
**array**
[
0.984313725490196,
1,
0.16862745098039217,
1
]
#### red
**array**
[
1,
0.1411764705882353,
0.0784313725490196,
1
]
#### teal
**array**
[
0.3764705882352941,
0.9882352941176471,
0.9294117647058824,
1
]
#### gray
**array**
[
0.7098039215686275,
0.7098039215686275,
0.7098039215686275,
1
]
#### cyan
**array**
[
0,
1,
1,
1
]
#### purple
**array**
[
0.6352941176470588,
0.36470588235294116,
0.8901960784313725,
1
]
#### editor
**object**
## Color
#### tohtml(v)
#### Arkanoid
**object**
#### Gameboy
**object**
#### Apple
**object**
#### Debug
**object**
#### Editor
**object**
#### normalize(c)
## esc
## ColorMap

View File

@@ -1,23 +1,19 @@
# Event
#### events
**object**
# event Module
## push_event
> Push a custom user event into SDL's queue, passing a callback function.
```
function push_event()
```
## engine_input
#### observe(name, obj, fn)
#### unobserve(name, obj)
#### rm_obj(obj)
#### notify(name, ...args)
> Poll all system events (keyboard, mouse, etc.) and call the given function with each event object.
```
function engine_input()
```

View File

@@ -1,78 +1,51 @@
# Resources
#### replpath(str, path)
# resources Module
## scripts
#### replstrs(path)
## images
#### scripts
**array**
[
"jsoc",
"jsc",
"jso",
"js"
]
#### images
**array**
[
"png",
"gif",
"jpg",
"jpeg"
]
#### sounds
**array**
[
"wav",
"flac",
"mp3",
"qoa"
]
#### is_image(path)
## sounds
#### find_image(file)
## fonts
#### find_sound(file)
## lib
## canonical
#### find_script(file)
```
function canonical(file)
```
## find_image
#### is_sound(path)
```
function find_image(...args)
```
## find_sound
#### is_animation(path)
```
function find_sound(...args)
```
## find_script
#### is_path(str)
#### texture
**object**
#### gif
**object**
```
function find_script(...args)
```
## find_font
```
function find_font(...args)
```

View File

@@ -1,67 +1,19 @@
# Spline
#### sample_angle(type, points, angle)
# spline Module
## catmull
> Perform Catmull-Rom spline sampling on an array of 2D points, returning an array of samples.
```
function catmull()
```
## bezier
#### bezier_loop(cp)
#### bezier_node_count(cp)
#### is_bezier(t)
#### is_catmull(t)
#### bezier2catmull(b)
#### catmull2bezier(c)
Given a set of control points C for a camtull-rom type curve, return a set of cubic bezier points to give the same curve.
#### catmull_loop(cp)
#### catmull_caps(cp)
Given a set of control points cp, return the necessary caps added to the spline.
#### type
**object**
#### bezier_tan_partner(points, i)
#### bezier_cp_mirror(points, i)
#### bezier_point_handles(points, i)
#### bezier_nodes(points)
#### bezier_is_node(points, i)
#### bezier_is_handle(points, i)
> Perform a Bezier spline (or catmull) sampling on 2D points, returning an array of sampled points.
```
function bezier()
```

View File

@@ -1,34 +1,43 @@
# actor
#### spawn(script, config, callback)
# actor Module
Create a new actor, using this actor as the master, initializing it with 'script' and with data (as a JSON or Nota file) from 'config'.
## all_objects
#### rm_pawn(pawn)
```
function all_objects(fn, startobj = world)
```
## find_object
#### timers
**array**
[]
#### kill()
Remove this actor and all its padawans from existence.
#### interval(fn, seconds)
```
function find_object(fn, startobj = world)
```
## tag_add
#### delay(fn, seconds)
Call 'fn' after 'seconds' with 'this' set to the actor.
#### padawans
**array**
[
{}
]
```
function tag_add(tag, obj)
```
## tag_rm
```
function tag_rm(tag, obj)
```
## tag_clear_guid
```
function tag_clear_guid(obj)
```
## objects_with_tag
```
function objects_with_tag(tag)
```

1
docs/api/base.md Normal file
View File

@@ -0,0 +1 @@
# base Module

1
docs/api/cmd.md Normal file
View File

@@ -0,0 +1 @@
# cmd Module

22
docs/api/doc.md Normal file
View File

@@ -0,0 +1,22 @@
# doc Module
## print_api
```
function print_api(obj)
```
## print_modules
```
function print_modules()
```
## write_modules
```
function write_modules()
```

85
docs/api/draw2d.md Normal file
View File

@@ -0,0 +1,85 @@
# draw2d Module
## point
```
function point(pos, size, color = Color.blue)
```
## line
```
function line(points, color = Color.white, thickness = 1, pipeline)
```
## cross
```
function cross(pos, size, color = Color.red, thickness = 1, pipe)
```
## arrow
```
function arrow(start, end, color = Color.red, wingspan = 4, wingangle = 10, pipe)
```
## rectangle
```
function rectangle(rect, color = Color.white, pipeline)
```
## tile
```
function tile(image, rect, color = Color.white, tile = tile_def, pipeline)
```
## slice9
```
function slice9(image, rect = [0,0], slice = 0, color = Color.white, info = slice9_info, pipeline)
```
## image
```
function image(image, rect = [0,0], rotation = 0, color, pipeline)
```
## images
```
function images(image, rects, config)
```
## sprites
```
function sprites(sprites, sort = 0, pipeline)
```
## circle
```
function circle(pos, radius, color, inner_radius = 1, pipeline)
```
## text
```
function text(text, rect, font = sysfont, size = 0, color = Color.white, wrap = 0, pipeline)
```

1
docs/api/engine.md Normal file
View File

@@ -0,0 +1 @@
# engine Module

130
docs/api/geometry.md Normal file
View File

@@ -0,0 +1,130 @@
# geometry Module
## rect_intersection
> Return the intersection of two rectangles (x,y,w,h). The result may be empty if no intersection.
```
function rect_intersection()
```
## rect_intersects
> Return a boolean indicating if two rectangles overlap.
```
function rect_intersects()
```
## rect_expand
> Merge or combine two rectangles, returning their bounding rectangle.
```
function rect_expand()
```
## rect_inside
> Return true if the first rectangle is completely inside the second.
```
function rect_inside()
```
## rect_random
> Return a random point within the given rectangle (uniform distribution).
```
function rect_random()
```
## cwh2rect
> Helper: convert a center point and width/height vector to a rect object.
```
function cwh2rect()
```
## rect_point_inside
> Return true if the given point is inside the given rectangle.
```
function rect_point_inside()
```
## rect_pos
> Return just the (x,y) position of a rectangle as a 2D array.
```
function rect_pos()
```
## rect_move
> Offset a rectangle by a 2D vector.
```
function rect_move()
```
## box
```
function box(w, h)
```
## sphere
## circle
## ngon
```
function ngon(radius, n)
```
## arc
```
function arc(radius, angle, n, start = 0)
```
## corners2points
```
function corners2points(ll, ur)
```
## sortpointsccw
```
function sortpointsccw(points)
```
## points2cm
```
function points2cm(points)
```

171
docs/api/graphics.md Normal file
View File

@@ -0,0 +1,171 @@
# graphics Module
## make_sprite_mesh
> Given an array of sprites, build a single geometry mesh for rendering them.
```
function make_sprite_mesh()
```
## make_sprite_queue
> Given an array of sprites, optionally sort them and build a queue of pipeline commands.
```
function make_sprite_queue()
```
## make_text_buffer
> Generate a GPU buffer mesh of text quads for rendering with a font, etc.
```
function make_text_buffer()
```
## rectpack
> Perform a rectangle packing using the stbrp library. Return positions for each rect.
```
function rectpack()
```
## make_rtree
> Create a new R-Tree for quickly querying many rectangles or sprite bounds.
```
function make_rtree()
```
## make_texture
> Convert raw image bytes (PNG, JPG) into an SDL_Surface object.
```
function make_texture()
```
## make_gif
> Load a GIF from an array of bytes, returning an object with frames[] of surfaces.
```
function make_gif()
```
## make_aseprite
> Load an Aseprite/ASE file from an array of bytes, returning frames or animations.
```
function make_aseprite()
```
## cull_sprites
> Filter an array of sprites to only those visible in the provided camera's view.
```
function cull_sprites()
```
## rects_to_sprites
> Convert an array of rect coords into sprite objects referencing an image.
```
function rects_to_sprites()
```
## make_surface
> Create a blank RGBA surface with the given dimensions. For software rendering or icons.
```
function make_surface()
```
## make_cursor
> Create an SDL_Cursor from an existing surface and a given hotspot location.
```
function make_cursor()
```
## make_font
> Load a font from TTF/OTF data (an ArrayBuffer) at the given pixel size.
```
function make_font()
```
## make_sprite
> Create a new sprite object, which has rect, color, layer, and image references.
```
function make_sprite()
```
## make_line_prim
> Build a GPU mesh representing a thick polyline from an array of points, using parsl.
```
function make_line_prim()
```
## is_image
```
function is_image(obj)
```
## texture
```
function texture(path)
```
## tex_hotreload
```
function tex_hotreload(file)
```
## get_font
```
function get_font(path,size)
```
## queue_sprite_mesh
```
function queue_sprite_mesh(queue)
```

View File

@@ -1,75 +1,100 @@
# input
#### show_keyboard()
# input Module
## mouse_show
> Show or hide the mouse cursor. Pass true to show, false to hide.
```
function mouse_show()
```
## mouse_lock
#### keyboard_shown()
> Capture or release the mouse. Pass true to lock, false to unlock.
```
function mouse_lock()
```
## cursor_set
#### mouse_mode()
> Set the given cursor (created by os.make_cursor) as the active mouse cursor.
```
function cursor_set()
```
## keyname
#### mouse_cursor()
> Given a numeric keycode, return the corresponding key name (e.g., from SDL).
```
function keyname()
```
## keymod
#### cursor_img()
> Return an object describing the current modifier keys, e.g. {shift:true, ctrl:true}.
```
function keymod()
```
#### keycodes
**object**
## mouse
#### codekeys
**object**
## keyboard
## print_pawn_kbm
#### mouse
**object**
[object Object]
#### keyboard
**object**
```
function print_pawn_kbm(pawn)
```
## procdown
#### state2str(state)
```
function procdown()
```
## print_md_kbm
#### print_pawn_kbm(pawn)
```
function print_md_kbm(pawn)
```
## has_bind
#### procdown()
```
function has_bind(pawn, bind)
```
#### print_md_kbm(pawn)
## action
## tabcomplete
#### has_bind(pawn, bind)
```
function tabcomplete(val, list)
```
## do_uncontrol
#### action
**object**
#### tabcomplete(val, list)
#### do_uncontrol(pawn)
```
function do_uncontrol(pawn)
```
## player

View File

@@ -1,84 +1,154 @@
# io
Functions for filesystem input/output commands.
#### exists()
# io Module
Returns true if a file exists.
## rm
#### ls()
> Remove the file or empty directory at the given path.
List contents of the game directory.
#### cp(f1,f2)
Copy file f1 to f2.
#### mv()
Rename file f1 to f2.
#### rm(f)
Remove file f.
#### chdir()
```
function rm()
```
## mkdir
#### mkdir()
> Create a directory at the given path.
Make dir.
#### chmod(file,mode)
```
function mkdir()
```
## stat
#### slurp(path)
> Return an object describing file metadata for the given path. The object includes filesize, modtime, createtime, and accesstime. Throw an error if the path does not exist.
Returns the contents of given file as a string.
#### slurpbytes(path)
Return the contents of a file as a byte array.
#### slurpwrite(path, c)
Write a given string to a given file.
#### save_qoa()
```
function stat()
```
## globfs
#### pack_start()
> Return an array of files matching any glob patterns provided. Recursively enumerates the filesystem within PHYSFS.
```
function globfs()
```
## match
#### pack_add()
> Return boolean indicating whether the given path[1] matches the provided wildcard pattern[2].
```
function match()
```
## exists
#### pack_end()
> Return a boolean indicating whether the file or directory at the given path exists.
```
function exists()
```
## mount
#### mod()
> Mount a directory or archive[1] at the specified mount point[2]. An undefined mount point mounts to '/'. Throw on error.
```
function mount()
```
## unmount
#### dumpfolder
**string**
> Unmount a previously mounted directory or archive. Throw on error.
```
function unmount()
```
## slurp
#### mkpath(dir)
> Read the entire file at the given path as a string. Throw on error.
```
function slurp()
```
## slurpbytes
#### extensions(ext)
> Read the entire file at the given path as a raw ArrayBuffer. Throw on error.
```
function slurpbytes()
```
## slurpwrite
#### glob(pat)
> Write data[1] (string or ArrayBuffer) to the given file path[2]. Overwrite if it exists. Throw on error.
Glob files in game directory.
```
function slurpwrite()
```
## writepath
> Set the write directory. Subsequent writes will go here by default. Throw on error.
```
function writepath()
```
## basedir
> Return the application's base directory (where the executable is located).
```
function basedir()
```
## userdir
> Return the user's directory, often used for saving data.
```
function userdir()
```
## realdir
> Return the actual, real directory (on the host filesystem) that contains the given file path. Return undefined if not found.
```
function realdir()
```
## open
> Open a file for writing, returning a file object that can be used for further operations. Throw on error.
```
function open()
```
## searchpath
> Return an array of all directories in the current paths.
```
function searchpath()
```

100
docs/api/js.md Normal file
View File

@@ -0,0 +1,100 @@
# js Module
## dump_mem
> Return a string summarizing memory usage in the QuickJS runtime.
```
function dump_mem()
```
## dump_shapes
> Return a debug string describing the internal shape hierarchy used by QuickJS.
```
function dump_shapes()
```
## dump_atoms
> Return a debug string describing all currently registered atoms in the QuickJS runtime.
```
function dump_atoms()
```
## calc_mem
> Return the approximate memory usage of a single JS value.
```
function calc_mem()
```
## mem
> Return a comprehensive memory usage object for the current QuickJS runtime.
```
function mem()
```
## mem_limit
> Set (in bytes) the maximum memory the QuickJS runtime will attempt to use.
```
function mem_limit()
```
## gc_threshold
> Set the threshold at which garbage collection triggers automatically, in bytes.
```
function gc_threshold()
```
## max_stacksize
> Set the maximum allowed stack size for QuickJS. Exceeding it can cause errors.
```
function max_stacksize()
```
## memstate
> Return simpler memory usage (malloc sizes, etc.) for the QuickJS runtime.
```
function memstate()
```
## gc
> Force a full garbage collection immediately.
```
function gc()
```
## eval
> Evaluate the given JavaScript source string with an optional filename, returning the result.
```
function eval()
```

View File

@@ -1,15 +1,15 @@
# json
json implementation.
#### encode(value, replacer, space = 1)
# json Module
Encode a value to json.
## encode
#### decode(text, reviver)
Decode a json string to a value.
#### readout(obj)
Encode an object fully, including function definitions.
```
function encode(val,space,replacer,whitelist)
```
## decode
```
function decode(text,reviver)
```

8
docs/api/loop.md Normal file
View File

@@ -0,0 +1,8 @@
# loop Module
## step
```
function step()
```

271
docs/api/math.md Normal file
View File

@@ -0,0 +1,271 @@
# math Module
## dot
> Compute the dot product between two numeric arrays, returning a scalar. Extra elements are ignored.
```
function dot()
```
## project
> Project one vector onto another, returning a new array of the same dimension.
```
function project()
```
## rotate
> Rotate a 2D point (or array of length 2) by the given angle (in turns) around an optional pivot.
```
function rotate()
```
## midpoint
> Compute the midpoint of two arrays of numbers. Only the first two entries are used if 2D is intended.
```
function midpoint()
```
## reflect
> Reflect a vector across a plane normal. Both arguments must be numeric arrays.
```
function reflect()
```
## distance
> Compute the Euclidean distance between two numeric arrays of matching length.
```
function distance()
```
## direction
> Compute the normalized direction vector from the first array to the second.
```
function direction()
```
## angle
> Given a 2D vector, return its angle from the X-axis in radians or some chosen units.
```
function angle()
```
## norm
> Return a normalized copy of the given numeric array. For 2D/3D/4D or arbitrary length.
```
function norm()
```
## angle_between
> Compute the angle between two vectors (2D/3D/4D).
```
function angle_between()
```
## lerp
> Linear interpolation between two numbers: lerp(a, b, t).
```
function lerp()
```
## gcd
> Compute the greatest common divisor of two integers.
```
function gcd()
```
## lcm
> Compute the least common multiple of two integers.
```
function lcm()
```
## clamp
> Clamp a number between low and high. clamp(value, low, high).
```
function clamp()
```
## angledist
> Compute the signed distance between two angles in 'turn' units, e.g. 0..1 range.
```
function angledist()
```
## jitter
> Apply a random +/- percentage noise to a number. Example: jitter(100, 0.05) -> ~95..105.
```
function jitter()
```
## mean
> Compute the arithmetic mean of an array of numbers.
```
function mean()
```
## sum
> Sum all elements of an array of numbers.
```
function sum()
```
## sigma
> Compute standard deviation of an array of numbers.
```
function sigma()
```
## median
> Compute the median of an array of numbers.
```
function median()
```
## length
> Return the length of a vector (i.e. sqrt of sum of squares).
```
function length()
```
## from_to
> Return an array of points from a start to an end, spaced out by a certain distance.
```
function from_to()
```
## rand
> Return a random float in [0,1).
```
function rand()
```
## randi
> Return a random 32-bit integer.
```
function randi()
```
## srand
> Seed the random number generator with the given integer, or with current time if none.
```
function srand()
```
## TAU
## deg2rad
```
function deg2rad(deg)
```
## rad2deg
```
function rad2deg(rad)
```
## turn2rad
```
function turn2rad(x)
```
## rad2turn
```
function rad2turn(x)
```
## turn2deg
```
function turn2deg(x)
```
## deg2turn
```
function deg2turn(x)
```

View File

@@ -1,149 +1,226 @@
# os
#### cwd()
# os Module
Get the absolute path of the current working directory.
## make_transform
#### env()
> Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.
Return the value of the environment variable v.
```
function make_transform()
```
#### sys()
## clean_transforms
> Force an update on all transforms to remove dangling references or perform house-keeping.
#### system()
```
function clean_transforms()
```
## platform
#### quit()
> Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.
```
function platform()
```
#### exit()
## arch
> Return the CPU architecture string for this system (e.g. 'x64', 'arm64').
```
function arch()
```
#### reindex_static()
## totalmem
> Return the total system RAM in bytes.
#### gc()
```
function totalmem()
```
## freemem
#### eval()
> Return the amount of free system RAM in bytes, if known.
```
function freemem()
```
#### make_body()
## hostname
> Return the system's hostname, or an empty string if not available.
```
function hostname()
```
#### make_circle2d()
## version
> Return the OS or kernel version string, if the platform provides it.
#### make_poly2d()
```
function version()
```
## kill
#### make_seg2d()
> Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.
```
function kill()
```
#### make_texture()
## exit
> Exit the application with the specified exit code.
```
function exit()
```
#### make_tex_data()
## now
> Return current time (in seconds as a float) with high resolution.
#### make_font()
```
function now()
```
## openurl
#### make_model()
> Open the provided URL in the default web browser, if possible.
```
function openurl()
```
#### make_transform()
## make_timer
> Create a new timer object that will call a specified function after a certain delay.
```
function make_timer()
```
#### make_emitter()
## update_timers
> Advance all timers by the provided time delta (in seconds).
#### make_buffer()
```
function update_timers()
```
## sleep
#### make_line_prim()
> Block execution for the specified number of seconds.
```
function sleep()
```
#### make_cylinder()
## battery_pct
> Return the battery level (percentage) or negative if unknown.
```
function battery_pct()
```
#### make_cone()
## battery_voltage
> Return the current battery voltage in volts, if available.
#### make_disk()
```
function battery_voltage()
```
## battery_seconds
#### make_torus()
> Return the estimated remaining battery time in seconds, or negative if unknown.
```
function battery_seconds()
```
#### make_sphere()
## power_state
> Return a string describing power status: 'on battery', 'charging', 'charged', etc.
```
function power_state()
```
#### make_klein_bottle()
## on
> Register a global callback for certain engine-wide or system-level events.
#### make_trefoil_knot()
```
function on()
```
## rt_info
#### make_hemisphere()
> Return internal QuickJS runtime info, such as object counts.
```
function rt_info()
```
#### make_plane()
## rusage
> Return resource usage stats for this process, if the platform supports it.
```
function rusage()
```
#### make_video()
## mallinfo
> Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.
#### platform
**string**
```
function mallinfo()
```
## env
#### user
**string**
> Fetch the value of a given environment variable, or undefined if it doesn't exist.
```
function env()
```
#### home
**string**
#### prefpath()
#### openurl(url)
## system
> Execute a shell command using the system() call. Returns the command's exit code.
```
function system()
```

View File

@@ -1,189 +1,66 @@
# render
Draw shapes in screen space.
#### flushtext()
# render Module
## _main
#### camera_screen2world()
## device
## toggles
#### viewport()
## stencil_writer
```
function stencil_writer(...args)
```
#### end_pass()
## fillmask
```
function fillmask(ref)
```
#### commit()
## mask
```
function mask(image, pos, scale, rotation = 0, ref = 1)
```
#### glue_pass()
## viewport
```
function viewport(rect)
```
#### text_size()
## scissor
```
function scissor(rect)
```
#### text_ssbo()
## queue
```
function queue(cmd)
```
#### set_camera()
## setup_draw
#### pipeline()
#### setuniv3()
#### setuniv()
#### spdraw()
#### setuniproj()
#### setuniview()
#### setunivp()
#### setunim4()
#### setuniv2()
#### setuniv4()
#### setpipeline()
#### screencolor()
#### imgui_new()
#### gfx_gui()
#### imgui_end()
#### imgui_init()
#### poly_prim(verts)
#### make_shader(shader)
#### shader_apply_material(shader, material = {})
#### sg_bind(shader, mesh = {}, material = {}, ssbo)
#### device
**object**
Device resolutions given as [x,y,inches diagonal].
#### init()
#### circle(pos, radius, color)
#### poly(points, color, transform)
#### line(points, color = Color.white, thickness = 1, transform)
#### point(pos,size,color = Color.blue)
#### cross(pos, size, color = Color.red)
Draw a cross centered at pos, with arm length size.
#### arrow(start, end, color = Color.red, wingspan = 4, wingangle = 10)
Draw an arrow from start to end, with wings of length wingspan at angle wingangle.
#### coordinate(pos, size, color)
#### boundingbox(bb, color = Color.white)
#### rectangle(lowerleft, upperright, color)
Draw a rectangle, with its corners at lowerleft and upperright.
#### box(pos, wh, color = Color.white)
#### window(pos, wh, color)
#### text(str, pos, size = 1, color = Color.white, wrap = -1, anchor = [0,1], cursor = -1)
#### image(tex, pos, scale = 1, rotation = 0, color = Color.white, dimensions = [tex.width, tex.height])
#### fontcache
**object**
#### set_font(path, size)
```
function setup_draw()
```
## setup_hud
```
function setup_hud()
```

32
docs/api/sound.md Normal file
View File

@@ -0,0 +1,32 @@
# sound Module
## undefined
## pcm
```
function pcm(file)
```
## play
```
function play(file)
```
## cry
```
function cry(file)
```
## music
```
function music(file, fade = 0.5)
```

View File

@@ -1,115 +1,137 @@
# time
Functions for manipulating time.
#### now()
# time Module
Get the time now.
## now
#### computer_dst()
> Return the current system time as a floating-point number of seconds with microsecond precision.
Return true if the computer is in daylight savings.
#### computer_zone()
Get the time zone of the running computer.
#### hour2minute()
```
function now()
```
## computer_dst
#### day2hour()
> Return true if the local system time is currently in Daylight Savings Time, otherwise false.
```
function computer_dst()
```
## computer_zone
#### minute2second()
> Return the local time zone offset from UTC in hours, e.g. -5 for EST.
```
function computer_zone()
```
## hour2minute
#### week2day()
```
function hour2minute()
```
## day2hour
#### strparse
**object**
```
function day2hour()
```
## minute2second
#### second
**number**
Earth-seconds in a second.
#### minute
**number**
Seconds in a minute.
#### hour
**number**
Seconds in an hour.
#### day
**number**
Seconds in a day.
#### week
**number**
Seconds in a week.
#### weekdays
**array**
Names of the days of the week.
#### monthstr
**array**
Full names of the months of the year.
#### epoch
**number**
Times are expressed in terms of day 0 at hms 0 of this year.
#### isleap(year)
Return true if the given year is a leapyear.
#### yearsize(y)
Given a year, return the number of days in that year.
#### timecode(t, fps = 24)
```
function minute2second()
```
## week2day
#### monthdays
**array**
Number of days in each month.
#### zones
**object**
```
function week2day()
```
#### record(num, zone = this.computer_zone()
Given a time, return an object with time fields.
#### number(rec)
Return the number representation of a given time.
#### fmt
**string**
Default format for time.
#### text(num, fmt = this.fmt, zone)
Return a text formatted time.
## strparse
## doc
## second
## minute
## hour
## day
## week
## weekdays
## monthstr
## epoch
## isleap
```
function isleap(year)
```
## yearsize
```
function yearsize(y)
```
## timecode
```
function timecode(t, fps = 24)
```
## monthdays
## zones
## record
```
function record(num, zone = this.computer_zone()
```
## number
```
function number(rec)
```
## fmt
## text
```
function text(num, fmt = this.fmt, zone)
```

14
docs/api/tween.md Normal file
View File

@@ -0,0 +1,14 @@
# tween Module
## Tween
## Ease
## tween
```
function tween(from, to, time, fn, cb)
```

103
docs/api/util.md Normal file
View File

@@ -0,0 +1,103 @@
# util Module
## guid
> Return a random 32-character hexadecimal UUID-like string.
```
function guid()
```
## insertion_sort
> In-place insertion sort of an array using a comparison function cmp(a,b)->Number.
```
function insertion_sort()
```
## deepfreeze
```
function deepfreeze(obj)
```
## dainty_assign
```
function dainty_assign(target, source)
```
## get
```
function get(obj, path, defValue)
```
## isObject
```
function isObject(o)
```
## isEmpty
```
function isEmpty(o)
```
## dig
```
function dig(obj, path, def = {})
```
## access
```
function access(obj, name)
```
## mergekey
```
function mergekey(o1, o2, k)
```
## merge
```
function merge(target, ...objs)
```
## copy
```
function copy(proto, ...objs)
```
## obj_lerp
```
function obj_lerp(a,b,t)
```
## normalizeSpacing
```
function normalizeSpacing(spacing)
```

10
docs/api/video.md Normal file
View File

@@ -0,0 +1,10 @@
# video Module
## make_video
> Decode a video file (MPEG, etc.) from an ArrayBuffer, returning a datastream object.
```
function make_video()
```