Skip to content

Commit a9dd312

Browse files
committed
Added version information, added lowerthird example
1 parent 5dab1d8 commit a9dd312

File tree

8 files changed

+188
-1
lines changed

8 files changed

+188
-1
lines changed

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def build(
2525
dist_dir:pathlib.Path=typer.Option("./dist", help="Path to the directory where resulting zip files will be stored", **dir_checks)
2626
):
2727
"""
28-
HTML Template Builder
28+
HTML Template Builder 0.3
2929
3030
For detailed instructions, see the README.md file or visit
3131
https://github.com/aveco-automation/html-template-builder

build/.gitkeep

Whitespace-only changes.

dist/.gitkeep

Whitespace-only changes.

src/.gitkeep

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"js" : ["gsap.min.js"],
3+
"parameters" : [
4+
{ "id" : "MainText", "type" : "string", "info" : "Main text line" },
5+
{ "id" : "HeaderText", "type" : "string", "info" : "Header text" },
6+
{ "id" : "LowerText", "type" : "string", "info" : "Bottom text line bellow the main text" },
7+
{ "id" : "Info", "type" : "string", "info" : "Info text" },
8+
{ "id" : "Label", "type" : "string", "info" : "Bottom small text" }
9+
]
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div id="container" class="hidden">
2+
<div id="lower-third">
3+
<div id="line1">
4+
<div id="header-text"><span>Header text</span></div>
5+
</div>
6+
7+
<div id="line2">
8+
<div id="info"><span>INFO</span></div>
9+
<div id="main-text"><span>This is the main text</span></div>
10+
</div>
11+
12+
<div id="line3">
13+
<div id="label"><span>LIVE</span></div>
14+
<div id="lower-text"><span>This is the lower text</span></div>
15+
</div>
16+
</div>
17+
</div>

src/example-lowerthird/template.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Map parameters (data fields defined in the manifest) to the DOM elements
2+
var data_fields = {
3+
"MainText" : "main-text",
4+
"HeaderText" : "header-text",
5+
"LowerText" : "lower-text",
6+
"Info" : "info",
7+
"Label" : "label"
8+
}
9+
10+
// Create a timeline and start in a paused state
11+
var timeline = gsap.timeline();
12+
timeline.pause();
13+
14+
// first we add a red rectangle spin-in effect
15+
timeline.from("#info", {duration: .6, opacity:0, rotationY: "-90"});
16+
17+
// main-text animation needs to start slightly before the first animation ends
18+
timeline.from("#main-text", {duration: .3, opacity:0, x: "-100%"}, "-=0.1");
19+
20+
// as soon the main-text animation finishes, slide down the bottom line
21+
timeline.from("#label, #lower-text", {duration: .3, opacity:0, y: "-100%"});
22+
23+
// start header-text animation at the same time as the previous one
24+
timeline.from("#header-text", {duration: .3, opacity:0, y: "100%"}, "-=0.3");
25+
26+
//
27+
// CasparCG handlers
28+
//
29+
30+
function play(){
31+
// show the #container, which is hidden by default and start the animation
32+
document.getElementById("container").setAttribute("class", "visible");
33+
timeline.play();
34+
}
35+
36+
function stop(){
37+
// to hide the layout, just play the timeline in reverse
38+
timeline.reverse();
39+
}
40+
41+
function update(data){
42+
var params = parse_params(data);
43+
for (var idx in data_fields){
44+
var field_name = data_fields[idx];
45+
if (idx in params){
46+
document.getElementById(field_name).querySelector("span").innerText = params[idx];
47+
}
48+
}
49+
}
50+
51+
// Autoplay: comment this out in production
52+
//document.addEventListener("DOMContentLoaded", function(){
53+
// play();
54+
//}); // DOMContentLoaded
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
// We have different variables for background and foreground colors
3+
// Notice that black and white backgounds are slightly transparent
4+
5+
$bkg-red: #c01010
6+
$bkg-black: #2c2323cc
7+
$bkg-white: #f0f0f0cc
8+
9+
$fg-red: #c01010
10+
$fg-black: #2c2323
11+
$fg-white: #f0f0f0
12+
13+
$font-family: Roboto, Helvetica, Arial
14+
$font-size-large: 36px
15+
$font-size-small: 22px
16+
17+
$vertical-safe-area : 5%
18+
$horizontal-safe-area : 5%
19+
20+
// Base container respects EBU R-095/2017 safe areas recommendation
21+
// Hidden by default, the container contains all elements which are
22+
// therefore displayed only when PLAY action is is invoked
23+
24+
#container
25+
position: absolute
26+
top: $vertical-safe-area
27+
bottom: $vertical-safe-area
28+
left: $horizontal-safe-area
29+
right: $horizontal-safe-area
30+
font-family: $font-family
31+
32+
&.visible
33+
visibility: visible
34+
35+
&.hidden
36+
visibility: hidden
37+
38+
39+
// LAYOUT
40+
41+
// Lower third is aligned to the bottom-left corner of the safe-area
42+
#lower-third
43+
position: absolute
44+
bottom: 0
45+
left: 0
46+
display: flex
47+
flex-direction: column
48+
49+
// we have three lines in the layout: #line1, #line2, #line3
50+
div
51+
display: flex
52+
flex-direction: row
53+
overflow: hidden
54+
span
55+
padding: 6px 14px
56+
57+
// move the first line contents (#header-text)
58+
// to the far right of the graphic
59+
#line1
60+
justify-content: flex-end
61+
62+
// left segments have the fixed width of 150 pixels
63+
// and their text is centered
64+
#info, #label
65+
width: 150px
66+
span
67+
margin: 0 auto
68+
69+
// expand main-text and lower-text to the width of the longest element
70+
#main-text, #lower-text
71+
flex-grow: 1
72+
73+
74+
// Apperance
75+
// This section defines colors and font sizes of CG elements
76+
77+
#main-text
78+
text-transform: uppercase
79+
font-size: $font-size-large
80+
background-color: $bkg-white
81+
color: $fg-black
82+
83+
#lower-text
84+
font-size: $font-size-small
85+
background-color: $bkg-black
86+
color: $fg-white
87+
88+
#label
89+
font-size: $font-size-small
90+
font-weight: bold
91+
background-color: $bkg-white
92+
color: $fg-black
93+
94+
#info
95+
font-size: $font-size-large
96+
font-weight: bold
97+
background-color: $bkg-red
98+
color: $fg-white
99+
// Main text slides behind this element,
100+
// so info needs to be in the front
101+
z-index: 100
102+
103+
#header-text
104+
font-size: $font-size-small
105+
background-color: $bkg-red
106+
color: $fg-white

0 commit comments

Comments
 (0)