This gist outlines the specification for the ChronoPixel v1.0 scripting library. The goal is to approximate similar functionality as found in Macromedia Flash (from ye olde web). The language of choice for ChronoPixel will be LUA. Code will be interpreted at runtime while manipulation of the world will happen via javascript bindings which hook in to the ChronoPixelMX source engine.
Scripts are attached to keyframes. To add a new script, right-click a keyframe and select “Add Script”. Once a keyframe is executed, all associated scripts will be run.
Drawables have an instanceName property which can optionally be specified in the Properties panel. If specified, all scripts within that layer will have access to modify the instance.
- Network
- fetch(url)
- JSON
- stringify()
- parse()
- Timeline
- stop()
- play()
- gotoAndStop(frame)
- gotoAndPlay(frame)
- addEventListener(event, handler)
- getObjectByName(name)
- Instance of Drawable
- props
- x
- y
- sx
- sy
- pivotX
- pivotY
- rotation
- strokeColor
- fillColor
- strokeWidth
- zIndex (not currently supported)
- name
- addChild(drawable)
- removeChild(drawable)
- forEachChild(fn)
- addEventListener(event, handler)
- removeEventListener(event, handler)
- copy()
- destroy()
- bboxHitTest(x, y)
- polygonHitTest(x, y)
- props
- Global Drawable
- create()
- createBuilder()
- Drawable Builder
- moveTo(x,y)
- lineTo(x,y)
- arcTo(x,y,radius)
- closePath()
- build()
- Layer
- setAnimationType(tween | step)
- Event
- stopPropagation()
- Storage
- setItem(key, value)
- getItem(key)
- Math
- All the math functions in JavaScript
- Debug
- trace(...args)
- Drawables
- CREATE
- ROLL_ENTER
- ROLL_OVER
- ROLL_OUT
- CLICK
- DRAG
- Timeline
- ENTER_FRAME
- EXIT_FRAME
- KEYDOWN
- KEYUP
- MOUSE_DOWN
- MOUSE_UP
- MOUSE_MOVE