Created
June 11, 2014 16:16
-
-
Save pavelpower/24a38b70354b9486df9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head lang="en"> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style> | |
body { | |
background: #000000; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="title-wrap"></div> | |
<script> | |
function createTitle(title, domParent) { | |
var canvas, canvas, context, gradient; | |
canvas = document.createElement('canvas'); | |
canvas.id = 'title-canvas'; | |
canvas.width = 300; | |
canvas.height = 60; | |
domParent.appendChild(canvas); | |
context = canvas.getContext('2d'); | |
gradient = context.createLinearGradient(0, 0, 0, 60); | |
gradient.addColorStop(0.0, 'rgba(0, 0, 255, 1)'); | |
gradient.addColorStop(0.3, 'rgba(128, 0, 255, 0.6)'); | |
gradient.addColorStop(0.6, 'rgba(0, 0, 255, 0.4)'); | |
gradient.addColorStop(1.0, 'rgba(0, 255, 0, 0.2)'); | |
context.fillStyle = gradient; | |
context.strokeStyle = '#F00'; | |
context.font = 'italic 30pt Arial'; | |
context.fillText('Title text for film', 20, 50); | |
return canvas; | |
} | |
var dom_title_wrap = document.getElementById('title-wrap'); | |
createTitle('Hello!!!', dom_title_wrap); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment