Quartz Composer WebKit Plug-in JavaScript Reference
The JavaScript API provided by the Quartz Composer WebKit plug-in includes methods for changing a composition’s state and manipulating its published inputs and outputs. To learn how to include a Quartz Composer composition in a web page or Dashboard widget, read Webpages and Widgets.
Methods by Task
- Composition Metadata
- Composition Playback
- Composition Status
- Pasteboard Operations
- Working with Published Values
Methods
attributes
Returns an array of strings with the composition’s attributes.
composition.attributes() |
- Discussion
The attributes returned are the composition’s metadata, including its name, copyright, and description values, along with information about each port of the composition.
copyImageToPasteboard
Copies the current context of the composition to the pasteboard.
composition.copyImageToPasteboard() |
- Discussion
Use this method in conjunction with an
oncopy
handler.
getInputValue
Returns the value of a published input.
composition.getInputValue("key") |
- Discussion
The value of
key
is any of the inputs that you published in Quartz Composer.If the returned value is a color, an object is returned with
red
,green
,blue
, andalpha
properties. Each value is a floating-point number, on a scale from0
to1
. CallhtmlColor()
on the object to return its HTML hexadecimal color value orcssColor()
to return itsrgba
value.No images are returned when calling
getInputValue
.- See Also
getOutputValue
Returns the value of a published output.
composition.getOutputValue("key") |
- Discussion
The value of
key
is any of the outputs that you published in Quartz Composer.If the returned value is a color, an object is returned with
red
,green
,blue
, andalpha
properties. Each value is a floating-point number, on a scale from0
to1
. CallhtmlColor()
on the object to return its HTML hexadecimal color value orcssColor()
to return itsrgba
value.No images are returned when calling
getOutputValue
.- See Also
inputKeys
Returns an array of strings with the names of a composition’s published inputs.
composition.inputKeys() |
loaded
Returns whether the composition is loaded.
composition.loaded() |
outputKeys
Returns an array of strings with the names of a composition’s published outputs.
composition.outputKeys() |
pause
Pauses playback of a composition.
composition.pause() |
paused
Returns whether the composition is paused.
composition.paused() |
play
Begins or pauses playback of a composition.
composition.play() |
playing
Returns whether the composition is playing.
composition.playing() |
setInputValue
Gives the composition the provided value for published input.
composition.setInputValue("key", value) |
- Discussion
The value of
key
is any of the inputs that you published in Quartz Composer.If you’re setting an input to a color value, you can pass in:
An object like that returned by getInputValue and getOutputValue, with
red
,green
,blue
, andalpha
propertiesAn HTML hexadecimal color value, like
#FFFFFF
An HTML color name, like
red
orgreen
A CSS
rgb
orrgba
value
If the input value can’t be parsed, no change is made. Also, images aren’t allowed as an input value.
- See Also
stop
Stops playback of a composition.
composition.stop() |
Copyright © 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-01-06