-
Notifications
You must be signed in to change notification settings - Fork 1
Examples: Multi Text
examples/multi_text
The "multi_text" DataDocs example demonstrates how to use a specially formatted JSON file to more efficiently add lots of text overlays to a DataDoc. You can still use any webfont you like, but instead of manually adding divs, CSS classes and "addSalt" calls to your files, you edit a single JSON file where you specify all the information necessary to position and time your text.
-
Open up
assets/dataFiles/text_labels.json. On line 2, you'll see a JSON element calledstylesheet. This is where you can specify the font (or webfont) that should be the default for all of your text labels (don't worry, you can override these for individual pieces of text). -
Inside the
text_blocksJSON array, you'll see a series of individual elements, each of which contains 3 arrays (enclosed by square brackets []). Thetop_leftarray controls the positioning of the text div that will be created. Thestart_endarray specifies the time, in seconds when the text will appear and disappear. Thetext_listarray may contain one or more elements, each of which corresponds to a individual line of text in the final video. Each element must have at least atextfield that contains the text to display, and may include an optionalfontSizeandfontFamilyfield, specifying the point size and font that should be applied only to that line of text, if different from the default. Note that multiline text is achieved by adding putting multiple elements into a singletext_listarray. Feel free to add, remove and change these elements as you like. -
Open up
dd_multi_text.htmlin FireFox (this example won't work in Chrome on your desktop). You should see the video with your new text fields and timing appear!
Note: If you don't want your text file to be called
text_labels.jsonbe sure to rename it while keeping the .json extension. Then inmain.js, change the name of the .json file targeted in the$.getfunction to match your own.