Events and data enter and exit a composition through published ports

Abstract

A composition as a whole has a specific job to perform — like a node, but on a larger scale

Earlier, you learned that a composition is made up of nodes, each of which is a building block that has a specific job to perform. If you think about it, the composition as a whole also has a specific job to perform. It’s like a node, but on a larger scale. A composition can even be used as a building block within another composition or another application.

Just as a node can input and output information through its ports, a composition can input and output information through published ports. If a composition has published ports, Vuo shows them in sidebars along the left and right sides of the composition canvas.

Above is an example of a composition with published ports: Generate Checkerboard Image (File > Open Example > Image Generator). It inputs events and data through published input ports called width, height, and time. It outputs events and data through a published output port called outputImage.

You can use this composition as a building block, called a subcomposition, inside of another composition. Below is what that looks like — the published input and output ports of the composition become the input and output ports of a node. (You’ll learn more about subcompositions in Using subcompositions inside of other compositions.)

Because this composition has a certain set of published ports, making it an image generator, you can use it in other special ways. You can install it as a plugin for a VJ application that supports Vuo plugins. You can run it in Vuo to see a preview of the video stream it would generate in a VJ application. You can export a movie of the video stream. (More about image generators is in Making compositions fit a mold with protocols.)

In all of these different ways of executing the composition — as a subcomposition, within a VJ application, as a preview, for a movie export — events and data enter the composition through its published input ports, flow through the composition, and exit through the published output ports.