Dw

Dw
Static Members
EasyCam
DampedAction
Interpolation
Rotation
Vec3
Scalar

INFO

EasyCam Library Info

INFO
Static Members
LIBRARY
VERSION
AUTHOR
SOURCE

EasyCam

EasyCam


  new Dw.EasyCam(p5.RendererGL, {
    distance : z,                 // scalar
    center   : [x, y, z],         // vector
    rotation : [q0, q1, q2, q3],  // quaternion
    viewport : [x, y, w, h],      // array
  }

new EasyCam(renderer: p5.RendererGL, args: Object)
Parameters
renderer (p5.RendererGL) p5 WEBGL renderer
args (Object) {distance, center, rotation, viewport}
Static Members
INFO
Instance Members
setCanvas(renderer)
getCanvas()
attachMouseListeners(renderer)
removeMouseListeners()
dispose()
getAutoUpdate()
setAutoUpdate(status, the)
update()
apply(renderer)
setViewport(viewport, the)
getViewport()
mouseWheelZoom()
mouseDragZoom()
mouseDragPan()
mouseDragRotate()
getZoomMult()
getPanMult()
getRotationMult()
zoom(dz)
panX(dx)
panY(dy)
pan(dx, dy)
rotateX(rx)
rotateY(ry)
rotateZ(rz)
rotate(axis, angle)
setInterpolatedDistance(valA, valB, t)
setInterpolatedCenter(valA, valB, t)
setInterpolatedRotation(valA, valB, t)
setDistanceMin(distance_min)
setDistanceMax(distance_max)
setDistance(distance, duration, new, animation)
getDistance()
setCenter(center, duration, new, animation)
getCenter()
setRotation(rotation, duration, new, animation)
getRotation()
getPosition(dst)
getUpVector(dst)
getState()
setState(other, duration, a, animation)
pushResetState()
reset(duration)
setRotationScale(scale_rotation)
setPanScale(scale_pan)
setZoomScale(scale_zoom)
setWheelScale(wheelScale)
getRotationScale()
getPanScale()
getZoomScale()
getWheelScale()
setDamping(damping)
setDefaultInterpolationTime(duration)
setRotationConstraint(yaw, pitch, roll)
beginHUD(renderer, w, h)
endHUD(renderer)

dampedCallback

Damped callback, that accepts the resulting damped/smooth value.

dampedCallback(value: double)

Type: Function

Parameters
value (double) the damped/smoothed value

DampedAction

DampedAction, for smoothly changing a value to zero.

new DampedAction(cb: dampedCallback)
Parameters
cb (dampedCallback) callback that accepts the damped value as argument.
Instance Members
addForce(force)
update()
stop()

Interpolation

Interpolation, for smoothly changing a value by interpolating it over time.

new Interpolation(cb: interpolationCallback)
Parameters
cb (interpolationCallback) callback for interpolating between two values.
Instance Members
start(valA, valB, duration, actions)
update()
stop()

interpolationCallback

Interpolation callback, that implements any form of interpolation between two values A and B and the interpolationparameter t.

  linear: A * (1-t) + B * t
  smooth, etc...
interpolationCallback(A: Object, B: Object, t: double)

Type: Function

Parameters
A (Object) First Value
B (Object) Second Value
t (double) interpolation parameter [ 0, 1 ]

Rotation

Rotation as Quaternion [q0, q1, q2, q3]

Note: Only functions that were required for the EasyCam to work are implemented.

Rotation
Static Members
identity()
applyToVec3(rot, vec, dst)
applyToRotation(rotA, rotB, dst)
slerp(rotA, rotB, t, dst)
create(def, dst)

Scalar

Scalar as a simple number.

Note: Only functions that were required for the EasyCam to work are implemented.

Scalar
Static Members
mix(a, b, t)
smoothstep(x)
smootherstep(t)

Vec3

Vec3 as a 3D vector (Array)

Vec3
Static Members
add(a, b, dst)
mult(a, b, dst)
magSq(a)
mag(a)
dot(a, b)
cross(a, b, dst)
angle(v1, v2)
mix(a, b, t, dst)

p5

p5
Instance Members
createEasyCam()
ortho(left, right, bottom, top, near, far)