zimjs
Version:
JavaScript Canvas Framework - Code Creativity!<br> https://zimjs.com
786 lines (756 loc) • 316 kB
TypeScript
// Type definitions for ZIM at https://zimjs.com
// Definitions by: Dan Zen (Dr. Abstract)
// with thanks to Yoan Herrera, Lucas Joel, Manthan224, Geoffrey Nwachukwu, Kenil Domadia, and a lost teacher
// Documentation : https://zimjs.com/docs.html
///<reference types="../createjs-lib" />
///<reference types="../easeljs" />
///<reference types="../preloadjs" />
///<reference types="../soundjs" />
///<reference types="../tweenjs" />
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// INSTRUCTIONS
// Use index.d.ts provides TypeScript typings for ZIM.
// FYI - these are created by parser
// The ZIM Typings need the CreateJS typings (bundled) as seen above.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// FIXES
// If you have any issues using the typing please contact us on GitHub
// https://github.com/danzen/zimjs/issues/26
// Or join our Forum and post in the requests channel:
// https://forum.zimjs.com
declare global {
// CONSTANTS
var orange: string
var green: string
var pink: string
var blue: string
var brown: string
var yellow: string
var purple: string
var red: string
var salmon: string
var interstellar: string
var black: string
var darker: string
var licorice: string
var dark: string
var charcoal: string
var grey: string
var gray: string
var granite: string
var tin: string
var pewter: string
var silver: string
var fog: string
var mist: string
var light: string
var moon: string
var lighter: string
var white: string
var faint: string
var clear: string
var F: zim.Frame
var S: zim.Stage
var W: number
var H: number
var FIT: string
var FILL: string
var FULL: string
var LEFT: string
var RIGHT: string
var CENTER: string
var MIDDLE: string
var START: string
var END: string
var TOP: string
var BOTTOM: string
var BOT: string
var HORIZONTAL: string
var VERTICAL: string
var BOTH: string
var GET: string
var POST: string
var LOCALSTORAGE: string
var SOCKET: string
var TO: string
var FROM: string
var UP: string
var DOWN: string
var NEXT: string
var PREV: string
var AUTO: string
var DEFAULT: string
var NONE: string
var AVE: string
var SINE: string
var SQUARE: string
var TRIANGLE: string
var SAW: string
var ZAP: string
var TAU: number
var DEG: number
var RAD: number
// ZIM WRAP - global functions
// The wrap module contains global functions
// These were always global and are not available in the zim namespace
function zog(item1: any, ...item2: any): string
function zogr(item1: any, ...item2: any): string
function zogb(item1: any, ...item2: any): string
function zogy(item1: any, ...item2: any): string
function zogg(item1: any, ...item2: any): string
function zogp(item1: any, ...item2: any): string
function zogo(item1: any, ...item2: any): string
function zogs(item1: any, ...item2: any): string
function zid(id: string): HTMLElement
function zss(id: string): CSSStyleDeclaration
function zgo(url: string, target?: string, width?: number, height?: number, fullscreen?: boolean, modal?: boolean): void
function zum(string: string): number
function zot(value: any): boolean
function zop(e: any): void
function zil(): [Function]
function zet(selector: string): {}
function zob(func: Function, args: any, sig: string, scope: Function): boolean
function zik(arg: any): any
function zta(item: any): any
function zor(...items: any[]): any
function zimify(obj: createjs.DisplayObject, list?: Boolean): zim.DisplayObject
function zimplify(exclude?: string | string[]): void
}
// END GLOBALS
declare namespace zim {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// TYPES AND INTERFACES
// A ZIM VEE expression can be evaluated in the receiving function with zik (pick) to delay random selection
// See https://zimjs.com/docs.html?item=zik
// The basic parameter type should be used first then | zimVee to get the zik options
// Example: interval(time:number|zimVee, function:Function, etc.)
type zimVee = {} | Function | any[]
// So, any time we see {}|Function|[any] in the code hints (probably after a number, boolean or string) it means ZIM VEE
// Below is the full type but it complicates the code tips too much:
// type zimVee = {min?:number, max?:number, integer?:boolean, negative?:boolean, noZick?:[any]|Function}|Function|[any]
type color = string | GradientColor | RadialColor | BitmapColor
// ZIM DISPLAY OBJECTS
// All ZIM Display Objects extend from a DisplayObject at some point through inheritance
// There is no zim.DisplayObject but when we use the term we are referring to:
// zim.Container, zim.Bitmap, zim.Shape, zim.Sprite and zim.MovieClip at the top level
// and then all the objects that extend from the zim.Container:
// such as the ZIM Shapes (Rectangle, Circle, Triangle, Squiggle, Blob)
// and all the ZIM Components (Label, Button, CheckBox, RadioButton, etc.)
// In many places we want the value to be typed as a DisplayObject
// but if we hint a DisplayObject then that might mislead people to thinking it can't be a ZIM Display Object
// so this interface will provide a more generic name to handle both CreateJS and ZIM Display Objects
interface DisplayObject extends createjs.DisplayObject { }
// ZIM 4TH Display members set all of the original ZIM functions as methods on the ZIM Display objects
// ZIM also adds width, height, widthOnly, heightOnly, depth and blendMode properties to all as well as a read only type property
// and as of ZIM Cat 03 adds effects, hue, saturation, brightness, contrast
interface zimDisplay {
// ZIM Display Interface
// ZIM 4TH Methods
movement(call: Function): this
noMovement(): this
tap(call: Function, distance?: number, time?: number, once?: boolean, dbl?: boolean, dblTime?: number, call2?: Function): this
noTap(): this
hold(call: Function, distance?: number, time?: number, once?: boolean): this
noHold(): this
drag(config_or_boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number } | DisplayObject, axis?: string, overCursor?: string, dragCursor?: string, all?: boolean, swipe?: boolean, localBoundary?: boolean, onTop?: boolean, surround?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, reg?: boolean, removeTweens?: boolean, startBounds?: boolean, rect?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, currentTarget?: boolean, offStage?: boolean, immediateBoundary?: boolean, singleTouch?: boolean, dropTargets?: DisplayObject | [DisplayObject], dropCopy?: boolean, dropSnap?: boolean, dropBack?: boolean, dropEnd?: boolean, dropFull?: boolean, dropHitTest?: string, dropScale?: number, dropWidth?: number, dropHeight?: number): this
drag(config: { boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number } | DisplayObject, axis?: string, overCursor?: string, dragCursor?: string, all?: boolean, swipe?: boolean, localBoundary?: boolean, onTop?: boolean, surround?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, reg?: boolean, removeTweens?: boolean, startBounds?: boolean, rect?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, currentTarget?: boolean, offStage?: boolean, immediateBoundary?: boolean, singleTouch?: boolean, dropTargets?: DisplayObject | [DisplayObject], dropCopy?: boolean, dropSnap?: boolean, dropBack?: boolean, dropEnd?: boolean, dropFull?: boolean, dropHitTest?: string, dropScale?: number, dropWidth?: number, dropHeight?: number}): this
noDrag(): this
change(call: Function): this
dragBoundary(boundary: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }): this
dragRect(boundary: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }): this
mouse(): this
noMouse(): this
effect(effect: createjs.Filter, x?: number, y?: number, width?: number, height?: number): this
updateEffects(): this
noEffect(effects?: string, cache?: boolean): this
wire(config_or_target: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string, mID?: string): this
wire(config: { target: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string, mID?: string }): this
noWire(config_or_target: DisplayObject, prop?: string, input?: string, mID?: string): this
noWire(config: { target: DisplayObject, prop?: string, input?: string, mID?: string }): this
wired(config_or_source: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string, mID?: string): this
wired(config: { source: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string, mID?: string }): this
noWired(config_or_source: DisplayObject, prop?: string, input?: string, mID?: string): this
noWired(config: { source: DisplayObject, prop?: string, input?: string, mID?: string }): this
bind(config_or_id: string, props?: [any] | {} | string, extra?: string | number, filter?: Function, bindObj?: Bind): this
bind(config: { id: string, props?: [any] | {} | string, extra?: string | number, filter?: Function, bindObj?: Bind }): this
noBind(config_or_props?: [any] | {} | string, removeConnectionData?: boolean, call?: Function, bindObj?: Bind): this
noBind(config: { props?: [any] | {} | string, removeConnectionData?: boolean, call?: Function, bindObj?: Bind }): this
transform(config_or_move?: boolean, stretchX?: boolean, stretchY?: boolean, scale?: boolean, rotate?: boolean, allowToggle?: boolean, visible?: boolean, onTop?: boolean, showStretch?: boolean, showRotate?: boolean, showScale?: boolean, showReg?: boolean, showBorder?: boolean, borderColor?: color, borderWidth?: number, dashed?: boolean | [number], customCursors?: boolean, handleSize?: number, regSize?: number, snapDistance?: number, snapRotation?: number, cache?: boolean, events?: boolean, ghostColor?: color, ghostWidth?: number, ghostDashed?: boolean, ghostHidden?: boolean, container?: Container): this
transform(config: { move?: boolean, stretchX?: boolean, stretchY?: boolean, scale?: boolean, rotate?: boolean, allowToggle?: boolean, visible?: boolean, onTop?: boolean, showStretch?: boolean, showRotate?: boolean, showScale?: boolean, showReg?: boolean, showBorder?: boolean, borderColor?: color, borderWidth?: number, dashed?: boolean | [number], customCursors?: boolean, handleSize?: number, regSize?: number, snapDistance?: number, snapRotation?: number, cache?: boolean, events?: boolean, ghostColor?: color, ghostWidth?: number, ghostDashed?: boolean, ghostHidden?: boolean, container?: Container }): this
setSwipe(swipe?: boolean): this
gesture(config_or_move?: boolean, scale?: boolean, rotate?: boolean, boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, minScale?: number, maxScale?: number, snapRotate?: number, localBounds?: boolean, slide?: boolean, slideEffect?: number, regControl?: boolean, onTop?: boolean, surround?: boolean, circularBounds?: boolean, rect?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }): this
gesture(config: { move?: boolean, scale?: boolean, rotate?: boolean, boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, minScale?: number, maxScale?: number, snapRotate?: number, localBounds?: boolean, slide?: boolean, slideEffect?: number, regControl?: boolean, onTop?: boolean, surround?: boolean, circularBounds?: boolean, rect?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number } }): this
noGesture(config_or_move?: boolean, scale?: boolean, rotate?: boolean): this
noGesture(config: { move?: boolean, scale?: boolean, rotate?: boolean }): this
gestureBoundary(boundary: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, update?: boolean): this
addPhysics(config_or_dynamic?: boolean, contract?: number, shape?: string, friction?: number, linear?: number, angular?: number, density?: number, bounciness?: number, maskBits?: number, categoryBits?: number, physics?: Physics, restitution?: number, sensor?: boolean): this
addPhysics(config: { dynamic?: boolean, contract?: number, shape?: string, friction?: number, linear?: number, angular?: number, density?: number, bounciness?: number, maskBits?: number, categoryBits?: number, physics?: Physics, restitution?: number, sensor?: boolean }): this
removePhysics(): this
impulse(x?: number, y?: number, targetX?: number, targetY?: number): this
force(x?: number, y?: number, targetX?: number, targetY?: number): this
torque(amount?: number): this
sleep(): this
wake(): this
follow(config_or_damp?: number, dampY?: number, leftOffset?: number, rightOffset?: number, upOffset?: number, downOffset?: number, offsetDamp?: number, offsetDampY?: number, horizontal?: boolean, vertical?: boolean, borderLock?: boolean, borderOriginal?: boolean): this
follow(config: { damp?: number, dampY?: number, leftOffset?: number, rightOffset?: number, upOffset?: number, downOffset?: number, offsetDamp?: number, offsetDampY?: number, horizontal?: boolean, vertical?: boolean, borderLock?: boolean, borderOriginal?: boolean }): this
control(config_or_type?: string, speed?: number, speedY?: number, horizontal?: boolean, vertical?: boolean): this
control(config: { type?: string, speed?: number, speedY?: number, horizontal?: boolean, vertical?: boolean }): this
noControl(): this
contact(call: Function): this
contactEnd(call: Function): this
noContact(): this
noContactEnd(): this
puppet(o: DisplayObject): this
noPuppet(): this
hitTestPoint(x: number, y: number, boundsCheck?: boolean): boolean
hitTestReg(other: DisplayObject): boolean
hitTestRect(other: DisplayObject, num?: number, boundsCheck?: boolean, inside?: boolean): boolean
hitTestRectPoint(x: number, y: number, margin?: number): boolean
hitTestCircle(other: DisplayObject, num?: number, boundsCheck?: boolean, inside?: boolean): boolean
hitTestCirclePoint(x: number, y: number, margin?: number): boolean
hitTestCircleRect(other: DisplayObject, margin?: number): boolean
hitTestCircles(other: DisplayObject, margin?: number): boolean
hitTestBounds(other: DisplayObject, margin?: number, boundsShape?: boolean): boolean
boundsToGlobal(rect: createjs.Rectangle | { x: number, y: number, width: number, height: number }, flip?: boolean): createjs.Rectangle
resetBounds(width_or_boundsX?: number, height_or_boundsY?: number, width?: number, height?: number): this
hitTestPath(other: DisplayObject, num?: number, showPoints?: boolean): boolean
hitTestGrid(width?: number, height?: number, cols?: number, rows?: number, x?: number, y?: number, offsetX?: number, offsetY?: number, spacingX?: number, spacingY?: number, local?: boolean, type?: string): any
animate(config_or_props: {} | [{}], time?: number | zimVee, ease?: string | zimVee, call?: Function, params?: any, wait?: number | zimVee, waitedCall?: Function, waitedParams?: any, loop?: boolean, loopCount?: number | zimVee, loopWait?: number | zimVee, loopCall?: Function, loopParams?: any, loopWaitCall?: Function, loopWaitParams?: any, loopPick?: boolean, rewind?: boolean | zimVee, rewindWait?: number | zimVee, rewindCall?: Function, rewindParams?: any, rewindWaitCall?: Function, rewindWaitParams?: any, rewindTime?: number | zimVee, rewindEase?: string | zimVee, sequence?: number, sequenceCall?: Function, sequenceParams?: any, sequenceReverse?: boolean | zimVee, ticker?: boolean, cjsProps?: {}, css?: boolean, protect?: boolean, override?: boolean, from?: boolean | zimVee, set?: {} | zimVee, id?: string, events?: boolean, sequenceTarget?: any, dynamic?: boolean, drag?: boolean, clamp?: boolean, startPaused?: boolean, clean?: boolean, obj?: {} | [{}], seriesWait?: any, sequenceWait?: any, rate?: number | zimVee, pauseOnBlur?: boolean, easeAmount?: number | zimVee, easeFrequency?: number | zimVee, timeUnit?: string, timeCheck?: boolean, noAnimateCall?: boolean): this
animate(config: { props: {} | [{}], time?: number | zimVee, ease?: string | zimVee, call?: Function, params?: any, wait?: number | zimVee, waitedCall?: Function, waitedParams?: any, loop?: boolean, loopCount?: number | zimVee, loopWait?: number | zimVee, loopCall?: Function, loopParams?: any, loopWaitCall?: Function, loopWaitParams?: any, loopPick?: boolean, rewind?: boolean | zimVee, rewindWait?: number | zimVee, rewindCall?: Function, rewindParams?: any, rewindWaitCall?: Function, rewindWaitParams?: any, rewindTime?: number | zimVee, rewindEase?: string | zimVee, sequence?: number, sequenceCall?: Function, sequenceParams?: any, sequenceReverse?: boolean | zimVee, ticker?: boolean, cjsProps?: {}, css?: boolean, protect?: boolean, override?: boolean, from?: boolean | zimVee, set?: {} | zimVee, id?: string, events?: boolean, sequenceTarget?: any, dynamic?: boolean, drag?: boolean, clamp?: boolean, startPaused?: boolean, clean?: boolean, obj?: {} | [{}], seriesWait?: any, sequenceWait?: any, rate?: number | zimVee, pauseOnBlur?: boolean, easeAmount?: number | zimVee, easeFrequency?: number | zimVee, timeUnit?: string, timeCheck?: boolean, noAnimateCall?: boolean }): this
stopAnimate(ids?: string | [string], toEnd?: boolean): this
pauseAnimate(state?: boolean, ids?: string | [string]): this
wiggle(config_or_property: string, baseAmount: number | zimVee, minAmount?: number | zimVee, maxAmount?: number | zimVee, minTime?: number | zimVee, maxTime?: number | zimVee, totalTime?: number, type?: string, ease?: string, integer?: boolean, id?: string, startType?: string, ticker?: boolean, wait?: number): this
wiggle(config: { property: string, baseAmount: number | zimVee, minAmount?: number | zimVee, maxAmount?: number | zimVee, minTime?: number | zimVee, maxTime?: number | zimVee, totalTime?: number, type?: string, ease?: string, integer?: boolean, id?: string, startType?: string, ticker?: boolean, wait?: number }): this
copyMatrix(source: DisplayObject): this
cur(type?: string): this
sha(color_or_shadow?: string | createjs.Shadow, offsetX?: number, offsetY?: number, blur?: number): this
pos(config_or_x?: number, y?: number, right?: boolean | string, bottom?: boolean | string, container?: Container | Stage, index?: number, add?: boolean, reg?: boolean, regX?: boolean, regY?: boolean): this
pos(config: { x?: number, y?: number, right?: boolean | string, bottom?: boolean | string, container?: Container | Stage, index?: number, add?: boolean, reg?: boolean, regX?: boolean, regY?: boolean }): this
loc(config_or_target_or_x?: {} | [] | DisplayObject | Point | number, y?: number, container?: Container | Stage, index?: number, add?: boolean, localToLocal?: boolean, x?: number): this
loc(config: { target_or_x?: {} | [] | DisplayObject | Point | number, y?: number, container?: Container | Stage, index?: number, add?: boolean, localToLocal?: boolean, x?: number }): this
mov(x: number, y?: number): this
top(): this
bot(): this
ord(num: number): this
dep(depth: number): this
alp(alpha: number): this
vis(visible: boolean): this
ble(color: color): this
dye(blendMode: string): this
hov(value?: any, prop?: string): this
rot(rotation: number): this
siz(width: number, height?: number, only?: boolean): this
ske(skewx: number, skewY?: number): this
reg(regx: number | string, regY?: number | string, still?: boolean): this
sca(scale: number, scaleY?: number): this
scaleTo(boundObj?: DisplayObject, percentX?: number, percentY?: number, type?: string, boundsOnly?: boolean): this
fit(left?: number, top?: number, width?: number, height?: number, inside?: boolean): {}
outline(color?: color, size?: number, boundsOnly?: boolean, reg?: boolean, origin?: boolean, whiteSize?: number): this
addTo(config_or_container?: Container | Stage, index?: number, localToLocal?: boolean): this
addTo(config: { container?: Container | Stage, index?: number, localToLocal?: boolean }): this
removeFrom(container?: Container | Stage): this
added(call: Function, interval?: number, maxTime?: number): string
centerReg(config_or_container?: Container | Stage, index?: number, add?: boolean): this
centerReg(config: { container?: Container | Stage, index?: number, add?: boolean }): this
center(config_or_container?: Container | Stage, index?: number, add?: boolean): this
center(config: { container?: Container | Stage, index?: number, add?: boolean }): this
place(id?: string): this
placeReg(id?: string): this
expand(padding?: number, paddingV?: number, paddingRight?: number, paddingBottom?: number): this
duplicate(exact?: boolean): this
setMask(mask: DisplayObject, dynamic?: boolean): this
toggle(state?: boolean): this
outlineToggle(state?: boolean): this
// animate adds these:
endTween(callType?: string): this
resetTween(): this
replayTween(): this
// ZIM 4TH Properties
readonly type: string
width: number
height: number
widthOnly: number
heightOnly: number
marginLeft: number
marginRight: number
marginTop: number
marginBottom: number
level: number
depth: number
name: string
draggable: boolean
effects: { string: createjs.Filter }
hue: number
saturation: number
brightness: number
contrast: number
hueBatch: number
saturationBatch: number
brightnessBatch: number
contrastBatch: number
blendMode: string
readonly paused: boolean
readonly toggled: boolean
readonly outlineToggled: boolean
group: string
dynamic: boolean
dragPaused: boolean
// animate properties
readonly animating: boolean
readonly waiting: boolean
readonly tweenState: {}
percentSpeed: number
rate: number
percentComplete: number
zimLastMouseEnabled: boolean
// END ZIM Display Interface
}
interface zimShape {
// ZIM Shape Interface
readonly shape: Shape
color: color
colorRange: number
readonly colorCommand: createjs.Graphics.Fill
borderColor: color
readonly borderColorCommand: createjs.Graphics.Stroke
borderWidth: number
readonly borderDashedCommand: any
setColorRange(color1?: color, color2?: color): this
cloneAll(exact?: boolean, style?: boolean, group?: string, inherit?: {}): this
linearGradient(colors: [any], ratios: [any], x0: number, y0: number, x1: number, y1: number): this
radialGradient(colors: [any], ratios: [any], x0: number, y0: number, radius0: number, x1: number, y1: number, radius1: number): this
readonly veeObj: zimVee
// END ZIM Shape Interface
}
interface zimComponent {
// ZIM Component Interface
// dispose():boolean // now added to Container, etc.
enabled: boolean
// END ZIM Component Interface
}
// export function makeGlobals(exceptions?: string[]): void
export function scrollX(num?: number, time?: number): number
export function scrollY(num?: number, time?: number): number
export class Blob extends Container implements zimShape {
constructor(config_or_color?: color | zimVee, borderColor?: color | zimVee, borderWidth?: number, points?: number | any[] | string | Rectangle | Circle | Triangle | Flare, radius?: number, controlLength?: number, controlType?: string, lockControlType?: string, showControls?: boolean, lockControls?: boolean, handleSize?: number, allowToggle?: boolean, move?: boolean, ctrlclick?: boolean, dashed?: boolean | [number], onTop?: boolean, circleColor?: color, circleBorderColor?: color, stickColor?: color, selectColor?: color, selectPoints?: boolean, editPoints?: string | boolean, interactive?: boolean, strokeObj?: {}, style?: boolean, group?: string, inherit?: {})
constructor(config: { color?: color | zimVee, borderColor?: color | zimVee, borderWidth?: number, points?: number | any[] | string | Rectangle | Circle | Triangle | Flare, radius?: number, controlLength?: number, controlType?: string, lockControlType?: string, showControls?: boolean, lockControls?: boolean, handleSize?: number, allowToggle?: boolean, move?: boolean, ctrlclick?: boolean, dashed?: boolean | [number], onTop?: boolean, circleColor?: color, circleBorderColor?: color, stickColor?: color, selectColor?: color, selectPoints?: boolean, editPoints?: string | boolean, interactive?: boolean, strokeObj?: {}, style?: boolean, group?: string, inherit?: {} })
// ZIM Shape Interface
readonly shape: Shape
color: color
colorRange: number
readonly colorCommand: createjs.Graphics.Fill
borderColor: color
readonly borderColorCommand: createjs.Graphics.Stroke
borderWidth: number
readonly borderDashedCommand: any
setColorRange(color1?: color, color2?: color): this
cloneAll(exact?: boolean, style?: boolean, group?: string, inherit?: {}): this
linearGradient(colors: [any], ratios: [any], x0: number, y0: number, x1: number, y1: number): this
radialGradient(colors: [any], ratios: [any], x0: number, y0: number, radius0: number, x1: number, y1: number, radius1: number): this
readonly veeObj: zimVee
// END ZIM Shape Interface
approximateBounds(num?: number, showPoints?: boolean): this
addPoint(percent?: number, controlType?: string): this
addPoints(num?: number, controlType?: string, startPoint?: number, spread?: boolean, dataOnly?: boolean, points?: any[]): this
interpolate(num?: number, startPoint?: number, spread?: boolean): any[]
setColorRange(color1?: color, color2?: color): this
recordData(toJSON?: boolean): { x: number, y: number, points: any[][], color: color, borderColor: color, borderWidth: number, move: boolean, toggle: boolean, controls: boolean }
setData(data: string | { x: number, y: number, points: any[][], color: color, borderColor: color, borderWidth: number, move: boolean, toggle: boolean, controls: boolean }, fromJSON?: boolean): this
recordPoints(popup: boolean): any[][]
setPoints(data: any[][]): this
selectPoint(index: number, state?: boolean, multiple?: boolean): this
changeControl(config_or_index: number, type?: string, rect1X?: number, rect1Y?: number, rect2X?: number, rect2Y?: number, circleX?: number, circleY?: number, update?: boolean): this
changeControl(config: { index: number, type?: string, rect1X?: number, rect1Y?: number, rect2X?: number, rect2Y?: number, circleX?: number, circleY?: number, update?: boolean }): this
transformPoints(transformType: string, amount: number, x?: number, y?: number): this
reversePoints(points: [any]): this
makeSquiggle(index?: number): Squiggle
splitBlob(point1:Point, point2:Point, num?:number, clean?:boolean): [Blob]
update(normalized?: boolean): this
showControls(): this
hideControls(): this
traverse(obj: DisplayObject, start?: number, end?: number, time?: number): this
removePoint(index: number): this
readonly num: number
points: number | any[] | string | Rectangle | Circle | Triangle
pointsAdjusted: [any]
pointObjects: [any]
readonly segmentPoints: any[]
readonly segmentRatios: any[]
getPointAngle(index: number): number
getSegmentPoint(point1: any[], point2: any[]): any[]
getCurvePoint(ratio?: number, segmentRatios?: any[], segmentPoints?: any[], getAngle?: boolean): {}
stickColor: color
readonly controls: Container
readonly sticks: Container
readonly lastSelected: Container
readonly lastSelectedIndex: number
readonly selectionManager: SelectionManager
readonly selectedBalls: SelectionSet
readonly selectedRect1s: SelectionSet
readonly selectedRect2s: SelectionSet
controlsVisible: boolean
types: string[]
lockControls: boolean
lockControlType: boolean
allowToggle: boolean
move: boolean
ctrlclick: boolean
addPointFactor: number
addMinDistance: number
}
// Window cannot be added to global namespace because duplicates JavaScript Window
export class Window extends Container implements zimComponent {
constructor(width?: number, height?: number, content?: string | number | {} | DisplayObject, backgroundColor?: color, borderColor?: color, borderWidth?: number, padding?: number, corner?: number | any[], swipe?: boolean, scrollBarActive?: boolean, scrollBarDrag?: boolean, scrollBarColor?: color, scrollBarAlpha?: number, scrollBarFade?: boolean, scrollBarH?: boolean, scrollBarV?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, interactive?: boolean, shadowColor?: color, shadowBlur?: number, paddingH?: number, paddingV?: number, scrollWheel?: boolean, damp?: number, titleBar?: string | Label, titleBarColor?: color, titleBarBackgroundColor?: color, titleBarHeight?: number, draggable?: boolean, boundary?: Boundary, onTop?: boolean, close?: boolean, closeColor?: color, cancelCurrentDrag?: boolean, fullSize?: boolean, fullSizeColor?: color, resizeHandle?: boolean, collapse?: boolean, collapseColor?: color, collapsed?: boolean, optimize?: boolean, resizeBoundary?: Boundary, resizeVisible?: boolean, style?: boolean, group?: string, inherit?: {})
// ZIM Component Interface
// dispose():boolean // now added to Container, etc.
enabled: boolean
// END ZIM Component Interface
add(obj: DisplayObject, index?: number, center?: number, replace?: boolean): this
remove(obj: DisplayObject): this
removeAll(): this
resize(width?: number, height?: number): this
update(): void
background: Shape
backgroundColor: color
readonly content: {} | DisplayObject
readonly contentContainer: Container
readonly titleBar: Container
readonly titleBarLabel: Label
readonly titleBarBacking: Rectangle
readonly scrollBar: { size: number, minSize: number, spacing: number, margin: number, corner: number, showTime: number, fadeTime: number }
scrollX: number
scrollY: number
readonly scrollXMax: number
readonly scrollYMax: number
}
// Pick seems to be flagging a duplicate - don't know what!
export class Pick {
constructor(choices: any)
num(number: number): this
loop(number: number, call: Function): any
static choose(choice: any): any
static rand(a?: number, b?: number, integer?: boolean, negative?: boolean): number
static series(...array_item: any): Function
static getMinMax(vee: zimVee): {}
type: string
choices: any
}
// END UNIQUE - end of exports not added by parser
// PARSER - start of exports added by parser from globalsundefined// The PARSER will copy all these globals and export them in the module
// COLORS
export var orange: string
export var green: string
export var pink: string
export var blue: string
export var brown: string
export var yellow: string
export var purple: string
export var red: string
export var interstellar: string
export var black: string
export var darker: string
export var licorice: string
export var dark: string
export var charcoal: string
export var grey: string
export var gray: string
export var granite: string
export var tin: string
export var pewter: string
export var silver: string
export var fog: string
export var mist: string
export var light: string
export var lighter: string
export var white: string
export var clear: string
export var faint: string
export var F: Frame
export var S: Stage
export var W: number
export var H: number
export var FIT: string
export var FILL: string
export var FULL: string
export var LEFT: string
export var RIGHT: string
export var CENTER: string
export var MIDDLE: string
export var START: string
export var END: string
export var TOP: string
export var BOTTOM: string
export var HORIZONTAL: string
export var VERTICAL: string
export var BOTH: string
export var ALL: string
export var RADIAL: string
export var GET: string
export var POST: string
export var LOCALSTORAGE: string
export var SOCKET: string
export var TO: string
export var FROM: string
export var UP: string
export var DOWN: string
export var NEXT: string
export var PREV: string
export var AUTO: string
export var DEFAULT: string
export var NONE: string
export var AVE: string
export var SINE: string
export var SQUARE: string
export var TRIANGLE: string
export var SAW: string
export var ZAP: string
export var TAU: number
export var DEG: number
export var RAD: number
export var PHI: number
// ++++++++++++++++++++++++++++++++++++++
// ZIM CODE
export function chop(obj: DisplayObject, cols?: number, rows?: number, tile?: boolean, margin?: number): Tile | [Bitmap]
export function shuffle(array: [any]): [any]
export function pluck(array: [any], remove?: boolean): any
export function rand(a?: number, b?: number, integer?: boolean, negative?: boolean): number
export function seedRandom(seed?: number | string): number | string
export function odds(percent?: number): boolean
export function rarity(weights: {}, shuffle?: boolean, zimColors?: boolean, dynamicPayload?: boolean): [any]
export function repeats(array: [any], total?: boolean): number
export function loop(obj: number | {} | [any] | Dictionary, call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any): any
export function getTIME(time?: number, timeType?: string, minWarning?: number, maxWarning?: number, noWarning?: boolean): string
export function checkTIME(time?: number, timeChar?: string, minWarning?: number, maxWarning?: number): void
export function timeout(time: number | zimVee, call: Function): { pause: Function, clear: Function, time: number, paused: boolean, done: boolean }
export function interval(time: number | zimVee, call: Function, total?: number, immediate?: boolean, pauseOnBlur?: boolean, timeUnit?: string, complete?: Function, completeParams?: any, timeout?: boolean, mID?: string, tether?: any): { pause: Function, clear: Function, time: number, count: number, total: number, paused: boolean, pauseTimeLeft: number }
export function copy<T>(obj: T, clone?: boolean): T
export function arraysEqual(a: [any], b: [any], strict?: boolean): boolean
export function arrayMinMax(arr: [any]): {}
export function isEmpty(obj: {}): boolean
export function isPick(obj: any): boolean
export function isJSON(str: string): boolean
export function parseJSON(str: string): any
export function merge(object1: {}, object2: {}, ...objects: {}[]): {}
export function sortObject(obj: {}, property: string, reverse?: boolean): {}
export function decimals(num: number, places?: number, addZeros?: number, addZerosBefore?: number, includeZero?: boolean, time?: boolean): number | string
export function countDecimals(num: number): number
export function sign(num: number): 1 | 0 | -1
export function constrain(num: number, min?: number, max?: number, negative?: boolean): number
export function dist(a: {} | number, b: {} | number, c: number, d: number): number
export function rectIntersect(a: {} | Boundary, b: {} | Boundary, margin?: number): {}
export function boundsAroundPoints(points: [{}]): number
export function angle(a: {} | number, b: {} | number, c: number, d: number): number
export function asset(file: string): DisplayObject
export class Point {
constructor(x: number, y: number, z?: number, q?: number, r?: number, s?: number, t?: number, u?: number, v?: number, w?: number)
x: number
y: number
z: number
q: number
r: number
s: number
t: number
u: number
v: number
w: number
subtract(point: Point): Point
add(point: Point): Point
angle(point: Point): number
length(): number
distance(point: Point): number
project(angle: number, distance: number): Point
interpolate(point: Point, ratio: number): Point
average(point: Point): Point
}
export class Bezier {
constructor(a: {}, b: {}, c: {}, d: {})
}
export class Boundary {
constructor(x: number, y: number, width: number, height: number)
x: number
y: number
width: number
height: number
contract(x: number, y?: number, width?: number, height?: number): this
}
export class GradientColor {
constructor(colors: string[], ratios: number[] | number, x0: number, y0: number, x1: number, y1: number)
}
export class RadialColor {
constructor(colors: string[], ratios: number[] | number, x0: number, y0: number, r0: number, x1: number, y1: number, r1: number)
}
export class BitmapColor {
constructor(image: string | Bitmap, repetition?: string, matrix?: createjs.Matrix2D)
}
export function makeID(type?: string | [string | number], length?: number, letterCase?: string): string
export function makeSyllable(length?: number, firstValue?: boolean): string
export function makePrimitive(obj: any): string | number | boolean
export function makeMath(): void
export function series(...array_item: any): Function
export function smoothStep(num: number, min: number, max: number): number
export function unicodeToUTF(val: string): string
export function capitalizeFirst(string: string): string
export class Ajax {
constructor(master?: string | number, couple?: boolean, lock?: string, unique?: boolean)
get(url: string, call?: Function): void
post(url: string, data?: string, command?: string, extra?: string, call?: Function): void
put(url: string, data?: string, call?: Function): void
master: string | number
couple: boolean
lock: string
unique: boolean
}
export class Noise {
constructor(seed?: number)
seed: number
simplex1D(x: number): number
simplex2D(x: number, y: number): number
simplex3D(x: number, y: number, z: number): number
simplex4D(x: number, y: number, z: number, w: number): number
}
export class Damp {
constructor(startValue?: number, damp?: number)
damp: number
lastValue: number
convert(input: number): number
immediate(num: number): this
}
export class Proportion {
constructor(baseMin: number, baseMax: number, targetMin?: number, targetMax?: number, factor?: number, targetRound?: boolean, clamp?: boolean, clampMin?: number, clampMax?: number)
convert(input: number): number
}
export class ProportionDamp {
constructor(baseMin: number, baseMax: number, targetMin?: number, targetMax?: number, damp?: number, factor?: number, targetRound?: boolean, clamp?: boolean, clampMin?: number, clampMax?: number)
damp: number
convert(input: number): number
immediate(num: number): this
dispose(): boolean
}
export class Dictionary {
constructor(unique: boolean)
length: number
unique: boolean
objects: any[]
values: any[]
add(object: any, value: any): void
clear(): this
at(object: any): any
remove(object: any): boolean
dispose(): boolean
}
export class Hierarchy {
constructor(input: [any] | {})
processSimple(input: [any] | {}): {}
processComplex(input: [any] | {}): [any] | {}
getLinearList(data: [any] | {}): [any]
getLinearIds(data: [any] | {}): [any]
getData(id: String): any
getNextSibling(id: string): string
getPrevSibling(id: string): string
getParent(id: string): {}
insertBefore(items: [any] | {}, id: string, innerItems: [any] | {}): void
insertAfter(items: [any] | {}, id: string, innerItems: [any] | {}): void
replaceItem(item: [any] | {}, id: string): void
removeItem(id: string): void
}
export function swapProperties(property: string, objA: any, objB: any): boolean
export function setProps(obj: any, props: {}): void
export function swapHTML(idA: string, idB: string): boolean
// scrollX and scrollY are available only in zim namespace due to global conflict
export function windowWidth(): number
export function windowHeight(): number
export function getQueryString(string?: string): {}
export function urlEncode(string: string): string
export function urlDecode(string: string): string
export function setCookie(name: string, value: string, days?: number): boolean
export function getCookie(name: string): string
export function deleteCookie(name: string): boolean
export function convertColor(color: color, toColorType?: string, alpha?: number): string
export function colorRange(color1: string, color2?: string, ratio?: number): void
export function lighten(color: string, ratio?: number): void
export function darken(color: string, ratio?: number): void
export function toColor(color: string, targetColor: string, ratio?: number): void
export function toAlpha(color: string, ratio?: number): void
export function toBW(hex: string): string
export function invertColor(hex: string): string
export function syntaxColor(text: string, theme?: string, darken?: number): string
export function zimEase(points: [any], polynomials?: [any], reverse?: boolean, lockEnds?: boolean): Function
export function spline(points: [any], tension?: number, close?: boolean, shape?: Shape, removeLast?: boolean): string
export function getPointAtPercent(x1?:number, y1?:number, x2?:number, y2?:number, percent?:number): Point
export function pointAlongCurve(points: [any], ratio?: number, getAngle?: boolean): {}
export function distanceAlongCurve(points: [any]): number
export function closestPointAlongCurve(point: any, segmentPoints: [any], num?: number, interpolate?: boolean, percentage?: boolean): number
export function transformPoints(points: [any], transformType: string, amount: number, x?: number, y?: number): [any]
export function trimEndPoints(points: [any]): [any]
export function reversePoints(points: [any]): [any]
export function appendPoints(original: [any], points: [any], controlType?: string): [any]
export function prependPoints(original: [any], points: [any], controlType?: string): [any]
export function splitPoints(points: [any], index?: number, trimEnds?: boolean): [any]
export function outlineImage(image: DisplayObject, reverse?: boolean): [[any]]
export function simplifyPoints(points: [any], tolerance?:number, highestQuality?:boolean, reverse?:boolean, removeLast?:boolean): [[any]]
export function mobile(orientation?: boolean): string | boolean
export function vee(obj?: any): boolean
export function async(url: string, callback?: Function): void
export function couple(json: string): void
export function decouple(json: string): void
export function asset(file: string, width?: number, height?: number): DisplayObject
export function object(name: string): DisplayObject
// not sure how to type any class... is it Function?
export function extend(subclass: Function, superclass: Function, override?: string | string[], prefix?: string, prototype?: boolean): Function
// ++++++++++++++++++++++++++++++++++++++
// ZIM DISPLAY
export class Stage extends createjs.Stage {
constructor(canvasID: string | HTMLCanvasElement)
loop(config_or_call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any): any
loop(config: { call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any }): any
loop(config: { call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any }): any
hitTestGrid(width?: number, height?: number, cols?: number, rows?: number, x?: number, y?: number, offsetX?: number, offsetY?: number, spacingX?: number, spacingY?: number, local?: boolean, type?: string): any
type: string
readonly width: number
readonly height: number
draggable: boolean
}
export class StageGL extends Stage {
constructor(canvasID: string | HTMLCanvasElement, options: { preserveBuffer: boolean, antialias: boolean, transparent: boolean, premultiply: false, autoPurge: number })
loop(config_or_call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any): any
loop(config: { call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any }): any
loop(config: { call: Function, reverse?: boolean, interval?: number, step?: number, start?: number, end?: number, immediate?: boolean, complete?: Function, completeParams?: any }): any
hitTestGrid(width?: number, height?: number, cols?: number, rows?: number, x?: number, y?: number, offsetX?: number, offsetY?: number, spacingX?: number, spacingY?: number, local?: boolean, type?: string): any
type: string
readonly width: number
readonly height: number
}
export class Container extends createjs.Container implements zimDisplay {
constructor(width_or_boundsX?: number, height_or_boundsY?: number, width?: number, height?: number, style?: boolean, group?: string, inherit?: {})
// ZIM Display Interface
// ZIM 4TH Methods
movement(call: Function): this
noMovement(): this
tap(call: Function, distance?: number, time?: number, once?: boolean, dbl?: boolean, dblTime?: number, call2?: Function): this
noTap(): this
hold(call: Function, distance?: number, time?: number, once?: boolean): this
noHold(): this
change(call: Function): this
drag(config_or_boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number } | DisplayObject, axis?: string, overCursor?: string, dragCursor?: string, all?: boolean, swipe?: boolean, localBoundary?: boolean, onTop?: boolean, surround?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, reg?: boolean, removeTweens?: boolean, startBounds?: boolean, rect?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, currentTarget?: boolean): this
drag(config: { boundary?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number } | DisplayObject, axis?: string, overCursor?: string, dragCursor?: string, all?: boolean, swipe?: boolean, localBoundary?: boolean, onTop?: boolean, surround?: boolean, slide?: boolean, slideFactor?: number, slideSnap?: boolean, slideSnapDamp?: number, reg?: boolean, removeTweens?: boolean, startBounds?: boolean, rect?: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }, currentTarget?: boolean }): this
noDrag(): this
dragBoundary(boundary: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }): this
dragRect(boundary: Boundary | createjs.Rectangle | { x: number, y: number, width: number, height: number }): this
mouse(): this
noMouse(): this
effect(effect: createjs.Filter, x?: number, y?: number, width?: number, height?: number): this
updateEffects(): this
noEffect(effects?: string, cache?: boolean): this
wire(config_or_target: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string): this
wire(config: { target: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string }): this
noWire(config_or_target: DisplayObject, prop?: string, input?: string): this
noWire(config: { target: DisplayObject, prop?: string, input?: string }): this
wired(config_or_source: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string): this
wired(config: { source: DisplayObject, prop: string, twoWay?: boolean, setSource?: boolean, filter?: Function, call?: Function, input?: string }): this
noWired(): this
bind(config_or_id: string, props?: [any] | {} | string, extra?: string | number, filter?: Function, bindObj?: Bind): this
bind(config: { id: string, props?: [any] | {} | string, extra?: string | number, filter?: Function, bindObj?: Bind }): this
noBind(config_or_props?: [any] | {} | string, removeConnectionData?: boolean, call?: Function, bindObj?: Bind): this
noBind(config: { props?: [any] | {} | string, removeConnectionData?: boolean, call?: Function, bindObj?: Bind }): this
transform(config_or_move?: boolean, stretchX?: boolean, stretchY?: boolean, scale?: boolean, rotate?: boolean, allowToggle?: boolean, visible?: boolean, onTop?: boolean, showStretch?: boolean, showRotate?: boolean, showScale?: boolean, showReg?: boolean, showBorder?: boolean, borderColor?: color, borderWidth?: number, dashed?: boolean | [number], customCursors?: boolean, handleSize?: number, regSize?: number, snapDistance?: number, snapRotation?: number, cache?: boolean, events?: boolean, ghostColor?: color, ghostWidth?: number, ghostDashed?: boolean, ghostHidden?: boolean, container?: Container): this
transform(config: { move?: boolean, stretchX?: boolean, stretchY?: boolean, scale?: boolean, rotate?: boolean, allowToggle?: boolean, visible?: boolean, onTop?: boolean, showStretch?: boolean, showRotate?: boolean, showScale?: boolean, showReg?: boolean, showBorder?: boolean, borderColor?: color, borderWidth?: number, dashed?: boolean | [number], customCursors?: boolean, handleSize?: number, regSize?: number, snapDistance?: number, snapRotation?: number, cache?: boolean, events?: boolean, ghostColor?: color, ghostWidth?: number, gh