Constructor
new Project(name, width, height, framerate, backgroundColor)
- Description:
Create a project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Project name. Default "My Project". |
width |
number | Project width in pixels. Default 720. |
height |
number | Project height in pixels. Default 480. |
framerate |
number | Project framerate in frames-per-second. Default 12. |
backgroundColor |
Color | Project background color in hex. Default #ffffff. |
Members
activeFrame :Wick.Frame
- Description:
The active frame of the active layer.
- Source:
The active frame of the active layer.
Type:
activeFrames :Array.<Wick.Frame>
- Description:
The active frames of the active timeline.
- Source:
The active frames of the active timeline.
Type:
- Array.<Wick.Frame>
activeLayer :Wick.Layer
- Description:
The active layer of the active timeline.
- Source:
The active layer of the active timeline.
Type:
activeTimeline :Wick.Timeline
- Description:
The timeline of the active clip.
- Source:
The timeline of the active clip.
Type:
activeTool :Wick.Tool
- Description:
The currently activated tool.
- Source:
The currently activated tool.
Type:
assets :Array.<Wick.Asset>
- Description:
The assets belonging to the project.
- Source:
The assets belonging to the project.
Type:
- Array.<Wick.Asset>
backgroundColor :string
- Description:
The background color of the project.
- Source:
The background color of the project.
Type:
- string
canCreateTween
- Description:
A tween can be created if frames are selected or if there is a frame under the playhead on the active layer.
- Source:
A tween can be created if frames are selected or if there is a frame under the playhead on the active layer.
canDraw :boolean
- Description:
Returns true if there is currently an active frame to draw onto.
- Source:
Returns true if there is currently an active frame to draw onto.
Type:
- boolean
currentKey :Array.<string>
- Description:
The key to be used in the global 'key' variable in the scripting API. Update currentKey before you run any key script.
- Source:
The key to be used in the global 'key' variable in the scripting API. Update currentKey before you run any key script.
Type:
- Array.<string>
error :Object
- Description:
The current error, if one was thrown, during the last tick.
- Source:
The current error, if one was thrown, during the last tick.
Type:
- Object
focus :Wick.Clip
- Description:
The currently focused clip.
- Source:
The currently focused clip.
Type:
framerate :number
- Description:
The framerate of the project.
- Source:
The framerate of the project.
Type:
- number
height :number
- Description:
The height of the project.
- Source:
The height of the project.
Type:
- number
hideCursor :boolean
- Description:
Whether or not to hide the cursor while project is playing.
- Source:
Whether or not to hide the cursor while project is playing.
Type:
- boolean
history :Wick.History
- Description:
An instance of the Wick.History utility class for undo/redo functionality.
- Source:
An instance of the Wick.History utility class for undo/redo functionality.
Type:
isMouseDown :boolean
- Description:
Determine if the mouse is down.
- Source:
Determine if the mouse is down.
Type:
- boolean
isPublished
- Description:
Returns true if the project is published, false otherwise.
- Source:
Returns true if the project is published, false otherwise.
keysDown :Array.<string>
- Description:
The keys that are currenty held down.
- Source:
The keys that are currenty held down.
Type:
- Array.<string>
keysJustPressed :Array.<string>
- Description:
The keys were just pressed (i.e., are currently held down, but were not last tick).
- Source:
The keys were just pressed (i.e., are currently held down, but were not last tick).
Type:
- Array.<string>
keysJustReleased
- Description:
The keys that were just released (i.e. were down last tick back are no longer down.)
- Source:
The keys that were just released (i.e. were down last tick back are no longer down.)
mouseMove :object
- Description:
The amount the mouse has moved in the last tick
- Source:
The amount the mouse has moved in the last tick
Type:
- object
mousePosition :object
- Description:
The position of the mouse
- Source:
The position of the mouse
Type:
- object
muted :boolean
- Description:
Is the project currently muted?
- Source:
Is the project currently muted?
Type:
- boolean
onionSkinEnabled
- Description:
True if onion skinning is on. False otherwise.
- Source:
True if onion skinning is on. False otherwise.
playing :boolean
- Description:
Checks if the project is currently playing.
- Source:
Checks if the project is currently playing.
Type:
- boolean
publishedMode :boolean
- Description:
In "Published Mode", all layers will be rendered even if they are set to be hidden. This is enabled during GIF/Video export, and enabled when the project is run standalone.
- Source:
In "Published Mode", all layers will be rendered even if they are set to be hidden. This is enabled during GIF/Video export, and enabled when the project is run standalone.
Type:
- boolean
renderBlackBars :boolean
- Description:
Should the project render black bars around the canvas area? (These only show up if the size of the window/element that the project is inside is a different size than the project dimensions).
- Source:
Should the project render black bars around the canvas area? (These only show up if the size of the window/element that the project is inside is a different size than the project dimensions).
Type:
- boolean
root :Wick.Clip
- Description:
The root clip.
- Source:
The root clip.
Type:
selection :Wick.Selection
- Description:
The project selection.
- Source:
The project selection.
Type:
showClipBorders :boolean
- Description:
Toggle whether or not to render borders around clips.
- Source:
Toggle whether or not to render borders around clips.
Type:
- boolean
tools :Array.<Wick.Tool>
- Description:
All tools belonging to the project.
- Source:
All tools belonging to the project.
Type:
- Array.<Wick.Tool>
toolSettings :Wick.ToolSettings
- Description:
The tool settings for the project's tools.
- Source:
The tool settings for the project's tools.
Type:
width :number
- Description:
The width of the project.
- Source:
The width of the project.
Type:
- number
zoom
- Description:
Value used to determine the zoom of the canvas.
- Source:
Value used to determine the zoom of the canvas.
Methods
addAsset(asset)
- Description:
Adds an asset to the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.Asset | The asset to add to the project. |
addObject(object) → {boolean}
- Description:
Adds an object to the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
object |
Wick.Base |
Returns:
returns true if the obejct was added successfully, false otherwise.
- Type
- boolean
breakApartSelection()
- Description:
Breaks selected clips into their children clips and paths.
- Source:
cleanupUnusedAssets()
- Description:
Remove assets from the project that are never used.
- Source:
copySelectionToClipboard() → {boolean}
- Description:
Copy the contents of the selection to the clipboard.
- Source:
Returns:
True if there was something to copy, false otherwise
- Type
- boolean
createClipFromLayers()
- Description:
Creates a symbol from the layers currently selected.
- Source:
createClipFromSelection(identifier, type)
- Description:
Creates a symbol from the objects currently selected.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
identifier |
string | the identifier to give the new symbol |
type |
string | "Clip" or "Button" |
createClipInstanceFromAsset(asset, x, y, callback)
- Description:
Adds an instance of a clip asset to the active frame.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.Asset | the asset to create the clip instance from |
x |
number | the x position to create the image path at |
y |
number | the y position to create the image path at |
callback |
function | the function to call after the path is created. |
createImagePathFromAsset(asset, x, y, callback)
- Description:
Adds an image path to the active frame using a given asset as its image src.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.Asset | the asset to use for the image src |
x |
number | the x position to create the image path at |
y |
number | the y position to create the image path at |
callback |
function | the function to call after the path is created. |
createSVGInstanceFromAsset(asset, x, y, callback)
- Description:
Adds an instance of a clip asset to the active frame.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.Asset | the asset to create the SVG file instance from |
x |
number | the x position to import the SVG file at |
y |
number | the y position to import the SVG file at |
callback |
function | the function to call after the path is created. |
createTween()
- Description:
Create a new tween on all selected frames OR on the active frame of the active layer.
- Source:
cutSelectedFrames()
- Description:
Cut the currently selected frames.
- Source:
cutSelectionToClipboard() → {boolean}
- Description:
Copy the contents of the selection to the clipboard, and delete what was copied.
- Source:
Returns:
True if there was something to cut, false otherwise
- Type
- boolean
deleteSelectedObjects()
- Description:
Deletes all objects in the selection.
- Source:
destroy()
- Description:
TODO: Remove all elements created by this project.
- Source:
distributeSelectionToLayers()
- Description:
Moves the selected paths and clips to their own layers.
- Source:
doBooleanOperationOnSelection(booleanOpName)
- Description:
Perform a boolean operation on all selected paths.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
booleanOpName |
string | The name of the boolean op function to use. See Wick.Path.booleanOp. |
duplicateSelection() → {boolean}
- Description:
Copy and paste the current selection.
- Source:
Returns:
True if there was something to duplicate, false otherwise
- Type
- boolean
errorOccured(message)
- Description:
Called when an error occurs to forward to the onError function
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
String | the message to display for the error |
extendFrames()
- Description:
Move the right edge of all frames right one frame.
- Source:
extendFramesAndPushOtherFrames()
- Description:
Move the right edge of all frames right one frame, and push other frames away.
- Source:
focusTimelineOfParentClip() → {boolean}
- Description:
Sets the project focus to the parent timeline of the currently focused clip.
- Source:
Returns:
True if parent clip is focused, false otherwise.
- Type
- boolean
focusTimelineOfSelectedClip() → {boolean}
- Description:
Sets the project focus to the timeline of the selected clip.
- Source:
Returns:
True if selected clip is focused, false otherwise.
- Type
- boolean
generateAudioSequence()
- Description:
Play the project through to generate an audio track.
- Source:
generateAudioTrack(args, callback)
- Description:
Generate an audiobuffer containing all the project's sounds merged together.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
object | takes soundInfo (list of soundInfo to use for audioGeneration). |
callback |
function | callback used to recieve the final audiobuffer. |
generateImageSequence(args, imageType, onProgress, onFinish)
- Description:
Create a sequence of images from every frame in the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
object | Options for generating the image sequence |
imageType |
string | MIMEtype to use for rendered images. Defaults to 'image/png'. |
onProgress |
function | Function to call for each image loaded, useful for progress bars |
onFinish |
function | Function to call when the images are all loaded. |
generateSoundInfo(asset, options)
- Description:
Generates information for a single sound that is being played.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.Asset | Asset to be played. |
options |
Object | Options including start (ms), end (ms), offset (ms), src (sound source), filetype (string). |
getAllFrames()
- Description:
All frames in this project.
- Source:
getAllOnionSkinnedFrames() → {Array.<Wick.Frame>}
- Description:
Returns all frames that should currently be onion skinned.
- Source:
Returns:
Array of Wick frames that sould be onion skinned.
- Type
- Array.<Wick.Frame>
getAssetByName(name) → {Wick.Asset}
- Description:
Retrieve an asset from the project by its name.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the asset to get. |
Returns:
The asset
- Type
- Wick.Asset
getAssetByUUID(uuid) → {Wick.Asset}
- Description:
Retrieve an asset from the project by its UUID.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
uuid |
string | The UUID of the asset to get. |
Returns:
The asset
- Type
- Wick.Asset
getAssets(type) → {Array.<Wick.Asset>}
- Description:
The assets belonging to the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Optional, filter assets by type ("Sound"/"Image"/"Clip"/"Button") |
Returns:
The assets in the project
- Type
- Array.<Wick.Asset>
getAudioInfo()
- Description:
Create an object containing info on all sounds in the project. Format: start: The amount of time in milliseconds to cut from the beginning of the sound. end: The amount of time that the sound will play before stopping. offset: The amount of time to offset the start of the sound. src: The source of the sound as a dataURL. filetype: The file type of the sound asset.
- Source:
getFonts() → {Array.<string>}
- Description:
A list of all "fontFamily" in the asset library.
- Source:
Returns:
- Type
- Array.<string>
getObjectByUUID(uuid)
- Description:
Returns an object associated with this project, by uuid.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
uuid |
string |
hasFont(fontFamily) → {boolean}
- Description:
Check if a FontAsset with a given fontFamily exists in the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fontFamily |
string | The font to check for |
Returns:
- Type
- boolean
importFile(file, callback)
- Description:
Creates an asset from a File object and adds that asset to the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
File | File object to be read and converted into an asset. |
callback |
function | Function with the created Wick Asset. Can be passed undefined on improper file input. |
initialize()
- Description:
Used to initialize the state of elements within the project. Should only be called after deserialization of project and all objects within the project.
- Source:
inject(element)
- Description:
Inject the project into an element on a webpage and start playing the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | the element to inject the project into |
insertBlankFrame()
- Description:
Inserts a blank frame into the timeline at the position of the playhead. If the playhead is over an existing frame, that frame will be cut in half, and a blank frame will be added to fill the empty space created by the cut.
- Source:
isKeyDown(key)
- Description:
Check if a key is being pressed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The name of the key to check |
isKeyJustPressed(key)
- Description:
Check if a key was just pressed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The name of the key to check |
loadAssets(callback)
- Description:
Loads all Assets in the project's asset library. This must be called after opening a project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Called when all assets are done loading. |
moveSelectedFramesLeft()
- Description:
Shift all selected frames over one frame to the left
- Source:
moveSelectedFramesRight()
- Description:
Shift all selected frames over one frame to the right
- Source:
moveSelection(target, index) → {boolean}
- Description:
Move the current selection above, below, or inside target.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
target |
object | The target object (to become parent of selection) |
index |
number | index to insert at |
Returns:
- true if project did change
- Type
- boolean
mute()
- Description:
Disable all sounds from playing
- Source:
objectIsMouseTarget(object)
- Description:
Check if an object is a mouse target (if the mouse is currently hovered over the object)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
object |
Wick.Tickable | the object to check if it is a mouse target |
onError(fn)
- Description:
Assign a function to be called when a user error happens (not script errors - errors such as drawing tool errors, invalid selection props, etc)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | the function to call when errors happen |
pasteClipboardContents() → {boolean}
- Description:
Paste the contents of the clipboard into the project.
- Source:
Returns:
True if there was something to paste in the clipboard, false otherwise.
- Type
- boolean
play(args)
- Description:
Start playing the project. Arguments: onError: Called when a script error occurs during a tick. onBeforeTick: Called before every tick onAfterTick: Called after every tick
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
object | Optional arguments |
playSound(assetName, options)
- Description:
Plays the sound in the asset library with the given name.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
assetName |
string | Name of the sound asset to play |
options |
Object | options for the sound. See Wick.SoundAsset.play |
playSoundFromAsset(asset)
- Description:
Plays a sound from a presented asset.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.SoundAsset | Name of the sound asset to play. |
prepareProjectForEditor()
- Description:
Prepares the project to be used in an editor.
- Source:
recenter()
- Description:
Sets zoom and pan such that the canvas fits in the window, with some padding.
- Source:
redo() → {boolean}
- Description:
Redo the last action that was undone.
- Source:
Returns:
true if there was something to redo, false otherwise.
- Type
- boolean
removeAsset(asset)
- Description:
Removes an asset from the project. Also removes all instances of that asset from the project.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
asset |
Wick.Asset | The asset to remove from the project. |
resetCache()
- Description:
Resets the cache and removes all unlinked items from the project.
- Source:
resetTools()
- Description:
Resets all tools in the project.
- Source:
resetZoomAndPan()
- Description:
Resets zoom and pan (zoom resets to 1.0, pan resets to (0,0)).
- Source:
runScheduledScripts()
- Description:
Run scripts in schedule, in order based on Tickable.possibleScripts.
- Source:
scheduleScript(uuid, name, parameters)
- Description:
Schedules a script to be run at the end of the current tick.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
uuid |
string | the UUID of the object running the script. |
name |
string | the name of the script to run, see Tickable.possibleScripts. |
parameters |
Object | An object of key,value pairs to send as parameters to the script which runs. |
selectAll()
- Description:
Selects all objects that are visible on the canvas (excluding locked layers and onion skinned objects)
- Source:
shrinkFrames()
- Description:
Move the right edge of all frames left one frame.
- Source:
shrinkFramesAndPullOtherFrames()
- Description:
Move the right edge of all frames left one frame, and pull other frames along.
- Source:
stop()
- Description:
Stop playing the project.
- Source:
stopAllSounds()
- Description:
Stops all sounds playing from frames and sounds played using playSound().
- Source:
stopSound(assetName, id)
- Description:
Stops sound(s) currently playing.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
assetName |
string | The name of the SoundAsset to stop. |
id |
number | (optional) The ID of the sound to stop. Returned by playSound. If an ID is not given, all instances of the given sound asset will be stopped. |
tick() → {object}
- Description:
Ticks the project.
- Source:
Returns:
An object containing information about an error, if one occured while running scripts. Null otherwise.
- Type
- object
tryToAutoCreateTween()
- Description:
Tries to create a tween if there is an empty space between tweens.
- Source:
undo() → {boolean}
- Description:
Undo the last action.
- Source:
Returns:
true if there was something to undo, false otherwise.
- Type
- boolean
unmute()
- Description:
Enable all sounds to play
- Source:
zoomIn()
- Description:
Zooms the canvas in.
- Source:
zoomOut()
- Description:
Zooms the canvas out.
- Source: