HTML5 Canvas標籤範例

隨著時代的進步,HTML的版本一直在進化,目前比較新的版本應該就是HTML5了,這次的HTML5針對許多標籤進行調整,當然也新增了一些標籤,主要的目的是希望可以將一些本來需要利用Flash才可以完成的互動頁面取而用HTML5來進行設計,這樣比較能減輕網頁的負載,但不管怎麼進步,其最重要的目的當然還是要網友能夠看到才行!

目前各家的瀏覽器對於HTML5的支援都不一,如果想要測試看看自己所使用的瀏覽器對HTML5的支援程度,可以到這個網址測試,馬老師針對目前的三款瀏覽器(IE9、Firefox6、Chrome13)來做了測試,IE9於HTML5中測試得到了以下的分數:

IE9於HTML5中測試分數

Firefox6於HTML5中測試得到了以下的分數:

Firefox6於HTML5中測試分數

Chrome13於HTML5中測試得到了以下的分數:

Chrome13於HTML5中測試分數

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

範例觀賞頁面

範例影片:

PS:本範例的網頁所使用的圖檔為寬:800、高:600的圖檔,並將圖檔至於img的資料夾中

網頁程式碼:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Slide Show</title>
<script>

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";
	photos.push(im);
}

function slideshow(){
	context = document.getElementById('canvas').getContext('2d');
	setInterval(loop,10);
}

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);
}

</script>
</head>
<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">

</body>
</html>

You may also like...

19,850 Responses

  1. However, it is virtually all done with tongues rooted solidly in cheeks, and everyone has absolutely nothing but absolutely love for his or her friendly neighborhood scapegoat. The truth is, he is not just a pushover. He is basically that special variety of person strong enough to take all of that good natured ribbing for exactly what it is.

  2. sbobet表示:

    I would share your post with my sis.

  3. engelsWet表示:

    doxycycline liquid Data are given as means SE and relative to control n 3 for all groups.

  4. Obersenep表示:

    doxycycline mechanism of action The bacteria can also be detected if it grows in a blood, spinal fluid, or urine culture.

  5. arrindCen表示:

    doxycycline with food 1 Laboratory of Integrative Systems Physiology, Interfaculty Institute of Bioengineering, Г‰cole Polytechnique FГ©dГ©rale de Lausanne, CH- 1015 Lausanne, Switzerland.

  6. Maisiepisn表示:

    dating free site
    free dating online chat
    dating web

  7. Obersenep表示:

    Twenty microliters of supernatant were mixed with luciferase assay substrate, and luciferase activity was read in a Luminex luminometer. doxycycline vs clindamycin

  8. arquitectura表示:

    I wish I could craft such articles as this. Thank you very much.

  9. You ma’am have a way with words. Thank you very much!

  10. Maisiepisn表示:

    dating services contact australia
    browse free dating without registering
    date free internet

  11. wewencash表示:

    Pakistan is theoretically a democratic, parliamentary federal republic modelled on the British Westminster system, with Islam as the state religion. doxycycline dosage for cats Alternatively, when M.

  12. Obersenep表示:

    difficile associated diarrhea CDAD. doxycycline hyclate vs doxycycline Hematologic response.

  13. wewencash表示:

    fast delivery on doxycyclene Fever and lower back pain are unusual and may indicate upper urinary tract infection.

  14. İzmir Eskort表示:

    I’m impressed, I need to say. Really rarely do I encounter a blog that’s both educational and entertaining, and let me tell you, you have hit the nail on the head.

  15. İzmir Eskort表示:

    Just wanna admit that this is extremely helpful, Thanks for taking your time to write this.

  16. I simply could not leave your site before suggesting that I actually enjoyed the usual info a person supply in your visitors? Is going to be back often to inspect new posts

  17. Arreple表示:

    However erythromycin for humans is a broad spectrum antibiotic and acts against both gram- negative and gram- positive bacteria. does doxycycline make you tired Therefore, it s best to skip the missed dose and resume the medication at the next scheduled time.

  18. Thanks for some other great post. Where else may anybody get that kind of information in such an ideal method of writing? I’ve a presentation next week, and I am at the look for such information.

  19. Genniepisn表示:

    bbc gay chat room free
    free gay chat
    m4m chat phone free rochester ny gay

  20. Juanitapisn表示:

    freeca
    dating online
    adoult dating

  21. arrindCen表示:

    2007 Sep 1; 45 Suppl 2 S129- 36. nausea from doxycycline

  22. Juanitapisn表示:

    local personal ads
    online singles dating sites
    dating services melbourne

  23. 노팔로우表示:

    Public policy is key here, and our states need to develop some strategies – – soon.

  24. I absolutely adore your site! You aggressive me as able-bodied as all the others actuality and your broiled PS is absolutely great!

  25. Mavispisn表示:

    100% dating site
    pof dating
    intitle:dating

  26. Deeynpisn表示:

    b-gay chat
    chat de gay usa
    gay chat nyc

  27. Mavispisn表示:

    dating sim
    meet women online
    online dating simulator

  28. 두팔로우表示:

    Unquestionably believe that which you said. Your favorite reason seemed to be on the net the easiest thing to be aware of. I say to you, I certainly get annoyed while people consider worries that they plainly don’t know about. You managed to hit the nail on the head. Will probably be back to get more. Thanks

  29. sbobet表示:

    Magnificent beat ! Can I be your apprentice? Just kidding!

發佈回覆給「local seo importance」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。