<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mobile-Web-App: HTML5 Canvas</title>
<script type="text/javascript">
function loadcanvas(){
var canvas;
var context;
canvas = document.getElementById("mycanvas");
context = canvas.getContext("2d");
drawText(context);
}
function drawText(c){
c.font = "30pt helvetica";
c.fillStyle = "#FF0000";
c.fillText ("Mobile-Web-App", 50, 50);
c.font = "18pt helvetica";
c.fillStyle = "#00FF00";
c.fillText ("http://mobile-web-app.blogspot.com/", 50, 100);
c.font = "16pt helvetica";
c.fillStyle = "#0000FF";
c.fillText ("HTML5 canvas - Text", 50, 150);
}
</script>
</head>
<body onload="loadcanvas();">
<h1>Mobile-Web-App: HTML5 canvas - Text</h1>
<canvas id="mycanvas" style="border: 5px solid;" width="450" height="250">
Sorry! Your browser doesn't support Canvas.
</canvas>
</body>
</html>
Related:
- HTML5 Canvas - Apply shadow of Text
No comments:
Post a Comment