HTML5 Canvas標籤範例








所以用以上的結果來看,目前是Google Chrome對於HTML5的支援最好,不過也只是拿了450分中的340而已,所以是否要全面改用HTML5來開發,還是應該要好好的斟酌一下,但是先了解HTML5能做到的功能,一定是沒問題的!以下就是馬老師針對HTML新增的畫布標籤製作的範例,不過因為瀏覽器支援的關係,必須使用Chrome觀賞才會是比較完整的功能喔!





<meta charset="utf-8">
<title>Slide Show</title>

var context;
var x = 0;
var ind;
var offset;
var photos = new Array();

for(var i=1;i<=13;i++){
	var im = new Image();
	im.src = "img/p" + i + ".jpg";

function slideshow(){
	context = document.getElementById('canvas').getContext('2d');

function loop(){
	x += (slider.value - x) * 0.1;
	ind = Math.floor(x/800);
	offset = x % 800;
	context.drawImage(photos[ind], offset, 0, 800-offset, 600, 0, 0, 800-offset, 600);
	context.drawImage(photos[ind+1], 0, 0, 800, 600, 800-offset, 0, 800, 600);

<body onLoad="slideshow()">

<canvas width="800" height="600" id="canvas"></canvas><br />
<input type="range" id="slider" style="width:800px;" min="0" max="9600" step="1" value="0">


You may also like...

106 Responses

  1. NFT Generator表示:

    Just a quick note to express my appreciation. Take care

  2. where can i get cenforce 100 getting cenforce without a prescription buy cenforce 120mg cenforce 150 red pill

  3. Substantially, the post is really the best on this laudable topic. I concur with your conclusions and will eagerly watch forward to your future updates.Just saying thanx will not just be enough, for the wonderful lucidity in your writing.

  4. hypertension et kamagra kamagra en ligne peut on acheter du kamagra sans ordonnace cialis ou kamagra ou levitra

  5. I’ve read several good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to make such a magnificent informative site.

  6. cartia drug表示:

    results of viagra name brand viagra does viagra make you bigger what levitra is used for

  7. have already been reading ur blog for a couple of days. really enjoy what you posted. btw i will be doing a report about this topic. do you happen to know any great websites or forums that I can find out more? thanks a lot.

  8. I like this web blog very much, Its a real nice berth to read and get information. “I have found that if you love life, life will love you back.” by Arthur Rubinstein.

  9. levitra sublingual levitra does bayer make levitra generic levitra usa

  10. prostigimine and zanaflex tizanidine 4 mg capsule coupon zanaflex daily dosage long term what is a dangerous dose of zanaflex

  11. zstqeyeh表示: buy hydroxychloroquine sulfate online

  12. If wings are your thing, Tinker Bell’s sexy Halloween costume design is all grown up.

  13. Amazing! Your site has quite a few comment posts. How did you get all of these bloggers to look at your site I’m envious! I’m still studying all about posting articles on the net. I’m going to view pages on your website to get a better understanding how to attract more people. Thank you!

  14. Could not disagree with the main ideas. Wonder how things will develop over the coming years.

  15. I would really like to appreciate the endeavors you cash in on written this article. I’m going for the similar best product from you finding out in the foreseeable future as well. Actually your creative writing abilities has urged me to begin my very own blog now. Genuinely the blogging is distributing its wings rapidly. Your write down is often a fine illustration showing it.