- Supported Bit Versions
-
- 32-bit
- 64-bit
- Minimum OBS Studio Version
- 30.0.0
- Supported Platforms
-
- Windows
- Mac OS X
- Linux
Lower Thirds Editor in a Canvas Animation
The Lower Thirds Editor in a Canvas Animation is a free dock plugin designed for use with OBS Studio. It allows users for creating, editing, and animating visual elements like shapes, text, and images on a canvas. Built using fabricJS and GSAP, it provides dynamic customization, precise controls, and powerful animation features for lines, circles, capsules, rounded rectangles, polygons, images, textboxes, and more.It consists of three main components:
- Animation Viewer (canvas.html): Displays animated visual elements as a Browser Source page.
- Control Panel (control_panel.html): Provides control buttons for starting, stopping, and reversing animations, as a dock page.
- Canvas Editor (canvas_editor.html): The Canvas Editor is an advanced tool designed for creating, editing, and animating visual content. It is tailored for designers, developers, and creators who need a highly customizable and interactive environment for crafting dynamic graphics and animations.
Installation
Prerequisites
- A local web server.
- A modern browser supporting ES6 features.
Steps
- Download the repository (via Git or ZIP) and extract the ZIP file to your desired location.
- Open OBS
- Add a new Browser Source in your scene and point the browser source to the canvas.html (e.g., http://lower-thirds-editor/canvas.html).
- Add control_panel.html as a dock page to perform start animation and reverse animation actions (e.g., http://lower-thirds-editor/control_panel.html).
- Open your browser
- Add the canvas_editor.html in your browser to edit new or existing JSON files (e.g., http://lower-thirds-editor/canvas_editor.html).
Dependencies
The editor uses libraries and .ttf fonts that have been downloaded locally, allowing it to function offline without requiring an internet connection.- fabricJS - For rendering and manipulating objects on the canvas.
- CDN: <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.2.4/fabric.min.js"></script>
- GSAP - For smooth animations on the canvas.
- CDN: <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script>
- Polygon Maker - For polygon design.
- LC-color-picker.js - Color picker updated for custom needs.
- BroadcastChannel API - For communication between the control panel (control_panel.html) and canvas (canvas.html).
The Canvas Editor (canvas_editor.html)
An interactive canvas editor that allows users to dynamically add, move, resize, rotate, delete, and animate objects. The canvas supports exporting designs as JSON or PNG files and reloading saved designs for further editing.Adding Objects
- Line: Add and customize stroke, width, and dash patterns.
- Circle: Adjust diameter, colors, and gradients.
- Capsule: Control radii, angle, and line length.
- Rounded Rectangle: Customize dimensions, corner radius, and border styles.
- Polygon: Add, edit, and adjust vertices dynamically.
- Image: Upload and edit brightness, contrast, and color channels.
- Textbox: Style text with fonts, alignment, spacing, and effects.
Animation Features
- Duration: Specify the animation length.
- Delay: Add a delay before the animation starts.
- Easing: Choose from various easing options.
- Properties: Animate starting position, scaling, opacity, and rotation.
Save & Load
- Save as JSON: Export the canvas design for future editing.
- Save as PNG: Export the canvas as a high-quality PNG image.
- Load JSON: Load an existing JSON file to continue editing.
- Load JSON files from fontnames.txt: Load JSON files listed in the configuration file (fontnames.txt) for editing.
Font Management for Textbox Canvas Objects
To ensure that the editor works offline, you'll need to manage the font families using local font files. The editor allows users to select a font family for each Textbox. The font families available are managed through a configuration file and the corresponding font files on the system.- The list of selectable font families is stored in the fontnames.txt file located in the fonts folder.
- Each line in fontnames.txt represents the name of a font family.
- For each font family added to fontnames.txt, ensure the corresponding .ttf files are installed on the operating system.
- If you want to use the font families listed in the sample fontnames.txt file, you need to install the ttf.zip files on your operating system.
- All .ttf files of ttf.zip have been downloaded from fonts.google.com.
The Control Panel (control_panel.html)
The control panel enables users to manage JSON files, allowing actions such as animating, and reversing animations.Features
- Dynamic JSON List: Displays a list of JSON file names retrieved from the text file (jsonfiles.txt). You can control as many files as exist as entries in the JSON file (jsonfiles.txt).
- Animation Buttons:
- Animate: Sends a broadcast message to animate the associated JSON file.
- Reverse Actions: Sends a broadcast message to reverse animate with specific actions like Reverse Animate, Reverse Outside-Left, etc.
- BroadcastChannel Integration: Uses the BroadcastChannel API for real-time communication between control_panel.html and canvas.html.
How It Works
- Loading JSON Files:
- The control_panel.html page fetches file names from jsonfiles/jsonfiles.txt.
- Each file name is displayed in a structured list with corresponding action buttons.
- Animation and Reverse Actions:
- The "Animate" button sends a broadcast message to perform animation on the selected JSON file.
- Reverse actions are also initiated via broadcast messages, allowing animations to be played in reverse.
- BroadcastChannel Communication:
- Sends messages with JSON file names and action types.
- Listens for messages to update the button states dynamically.
Example jsonfiles.txt Format
file1.jsonfile2.json
file3.json
The image below displays the control panel interface with rows corresponding to JSON file names and columns for animation actions. Each row represents a JSON file (e.g., sample1.json, sample2.json, sample3.json), and each column contains buttons for triggering specific animation-related actions like "Animate Action," "Reverse Animate," and directional animation reversals ("Reverse Outside-Left," "Reverse Outside-Bottom," "Reverse Outside-Right," "Reverse Fade-Out"). The buttons are styled with icons indicating play or reverse actions for easy identification.
The Animation Viewer (canvas.html)
Animation Viewer is an animation system for JSON data on an HTML canvas. It leverages fabricJS for canvas rendering and GSAP for animations. The animations are controlled using broadcast messages, and the canvas updates dynamically based on the provided JSON configuration.Features
- Dynamic Canvas Initialization:
- The canvas dimensions and objects are loaded dynamically from JSON files.
- BroadcastChannel Communication:
- Inter-tab communication is achieved using the BroadcastChannel API.
- GSAP Animations:
- Animations include entrance, reverse, and various directional effects.
- Custom Metadata Support:
- Objects have custom metadata attributes like data-duration, data-delay, data-position, etc.
- Concurrent Animations:
- Multiple canvas objects animate concurrently for seamless effects.
- Dynamic Reverse Animations:
- Supports reverse animations like Reverse Outside-Left, Reverse Outside-Bottom, etc.
How It Works
- Loading JSON Files:
- The JSON file name is passed as a URL parameter (e.g., ?json=example.json).
- Objects are loaded onto the canvas based on the JSON configuration.
- BroadcastChannel Integration:
- Listens for messages to perform animations or reverse actions.
- Reloads the page with the specified JSON file if triggered.
- Animation Logic:
- Uses GSAP to animate objects from specific start positions based on metadata.
- Reverse animations move objects outside the canvas boundaries.
- Custom Object Metadata:
Key attributes include:
- data-duration: Duration of the animation in seconds.
- data-ease: Easing function for a smooth transition.
- data-delay: Delay before the animation starts, in seconds.
- data-position: Starting position of the object (e.g., outside-left).
- data-opacity: Initial opacity of the object.
- data-distance: Distance the object travels from its starting position (optional - must be selected inside starting position).
- data-scalex: Initial scale along the X-axis.
- data-scaley: Initial scale along the Y-axis.
- data-rotation: Initial rotation angle of the object in degrees.
Enjoy!