HTML Graphics






<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



HTML Graphics



❮ Previous
Next ❯



Google Maps


Google Maps lets you embed maps in HTML:




function myMap()
{
var mapProp= {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:5,
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}


SVG


The HTML <svg> element allows vector based graphics in HTML:





















HTML Canvas


The HTML <canvas> element can be used draw graphics on a web page:



The graphic below is created with <canvas>:



Your browser does not support the <canvas> element.

It shows four elements: a red rectangle, a gradient rectangle,
a multicolor rectangle, and a multicolor text.





var c=document.getElementById("myCanvas");
var canvOK=1;
try {c.getContext("2d");}
catch (er) {canvOK=0;}
if (canvOK==1)
{
var ctx=c.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(20,20,100,50);

var grd=ctx.createLinearGradient(140,20,240,70);
grd.addColorStop(0,"black");
grd.addColorStop(1,"white");
ctx.fillStyle=grd;
ctx.fillRect(140,20,100,50);

var grd2=ctx.createLinearGradient(20,90,120,90);
grd2.addColorStop(0,"black");
grd2.addColorStop("0.3","magenta");
grd2.addColorStop("0.5","blue");
grd2.addColorStop("0.6","green");
grd2.addColorStop("0.8","yellow");
grd2.addColorStop(1,"red");
ctx.fillStyle=grd2;
ctx.fillRect(20,90,100,50);

ctx.font="30px Verdana";
var grd3=ctx.createLinearGradient(140,20,240,90);
grd3.addColorStop(0,"black");
grd3.addColorStop("0.3","magenta");
grd3.addColorStop("0.6","blue");
grd3.addColorStop("0.8","green");
grd3.addColorStop(1,"red");
ctx.strokeStyle=grd3;
ctx.strokeText("Smile!",140,120); }



❮ Previous
Next ❯

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay