This is an example MLT producer implemented in HTML. It renders a user settable title parameter with an animated CSS shadow effect. The rendered video can be viewed here demo/mlt/mlt_producer_demo_html.
<html>
<head>
<style type="text/css">
html, body {
margin: 0;
width: 100%;
height: 100%;
}
body {
display: -webkit-box;
-webkit-box-orient: vertical;
}
#top {
-webkit-box-flex: 1;
background: #666;
}
#text {
background: #666;
color: #999;
text-align: center;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
}
#bottom {
-webkit-box-flex: 1;
background: #999;
}
</style>
<script type="text/javascript">
function Producer(textStyle) {
this.textStyle = textStyle;
}
Producer.prototype.render = function(time) {
this.textStyle.textShadow = ((time * 0.4) - 0.2) + "em -0.2em 0.3em black";
}
function onLoad() {
handleFontSize();
var text = document.getElementById("text");
text.innerText = webvfx.getStringParameter("title");
var producer = new Producer(text.style);
webvfx.renderRequested.connect(producer, Producer.prototype.render);
webvfx.readyRender(true);
}
function handleFontSize() {
document.body.style.fontSize = (window.innerHeight * 0.1) + "px";
}
window.addEventListener("load", onLoad, false);
window.addEventListener("resize", handleFontSize, false);
</script>
</head>
<body>
<div id="top"></div>
<div id="text"></div>
<div id="bottom"></div>
</body>
</html>