Using Components in HTML5 Canvas

Use this article to learn more about using customizable components.

Component provides a function or group of related reusable customizable components that enhances productivity for ad creators. Previously, Animate supported flash components used with flash-based targets. From this release onwards, Animate supports HTML5 Canvas. 

  1. Select File > New.

    Choose an Advanced from the tabs at the top of the screen in the New Document dialog and then select HTML5 Canvas option.

    New Document
    HTML5 Canvas

  2. Select Window > Components.

    Default Components

  3. Select Components > Video. Drag-and-drop the associated components to the canvas. 

  4. Select the Video component Instance on stage, and view and modify parameters in the Property Inspector. The Source parameter allows you to select video file from a local location or provide any URL to play the video (mp4, ogg, ogv, or webm formats). 

    Drag-and-drop the Components

  5. Select “match source dimensions” to resize the video player to match the input video dimensions. This feature only works for mp4 videos. For other video types, manually resize the video instance on stage to ensure that the aspect ratio remains the same.

  6. Press Ctrl + enter (cmd + enter on MAC) to preview the movie. The video plays in your default browser. Since the controls are visible by default, you can view the controls when you hover over the video in a browser.

    You can use the same procedure to use other components.

    Preview component output

Note:

Components are added to HTML document as DOM elements, so refer to Component code snippets (Code Snippets > HTML5 Canvas > Components) to add interactivity to Components.

Adding interactivity to components using code snippets

  1. Select Window > Components.

  2. To add interactivity to the components, select Window > Code snippets panel. You can view the mapping of the various available component behaviors.

  3. In the Code Snippet screen, select HTML5 Canvas > Components.

    Default code snippets

  4. Based on the component you have selected, double-click the corresponding code snippet to display the snippet in the Actions panel. For information on adding interactivity to code snippets, see Add interactivity with code snippets in Animate

Example

Use the following example to learn how to use code snippets where the playback of the video is controlled through code.

  1. Select the video instance on stage and disable the AutoPlay setting in the Property inspector. 

  2. Double click the Button component twice in the Components panel to create two instances on stage and place the buttons. You can also drag-and-drop them directly from the components panel on stage.

    Place the buttons

  3. Select the first button instance and change the label to Play in the PI and the second button to Pause. 

  4. Open the Code Snippets Panel by clicking Window > Code Snippets. Navigate to HTML5 Canvas > Components and expand the User Interface Section. 

  5. Select the Play button on stage, double-click on the Button Click Event in Code Snippets Panel, and click Ok. Animate assigns an instance name to the selected button. You can view the newly added code in the Actions panel.

    Adding code snippets

  6. Select the Video on stage and expand the Video section in Code snippets. Double-click Play a Video. The code required to play the video is added to the Actions panel.

    Code added to the Actions panel

  7. To play the video when the button is clicked, move the code between  <Start your custom code> and <End your custom code> section. 

    Move the code within the tags

  8. To add a code to pause the video, select the pause button, assign the new button click handler and add the pause video code.

  9. Preview the movie. Click the play button to play the video and click on the Pause button to pause the video. 

Note:

You can view the className attribute for each component in the Property Inspector. Use these class names to skin the components using a CSS. Use the CSS component to load your custom CSS. The CSS component allows you to select any local CSS file included in the movie.

Install distributed components

Animate designers or developers can install the distributed ZXP file component by using the Manage Extensions utility. For more information, see Install extensions.

Prerequisite

Installing components

To install distributed components, you can perform the following steps: 

  1. Double-click the ManageExtensions.exe file. The Manage Extensions dialog appears.

  2. Click Install an extension and select the extension (.zxp file) that you want to install. For more information, see Install extensions.

  3. To view the installed component in Animate, click Window > Component. Components pop-up dialog appears. 

  4. Click hamburger icon at upper-right corner and click Reload Components.

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online