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...

6,925 Responses

  1. Lariorfgz表示:

    Сколько стоит диплом высшего и среднего образования и как его получить?
    diplomyx.com/kupit-diplom-moskva

  2. Cazrkez表示:

    Привет, друзья!
    Мы можем предложить документы ВУЗов, расположенных на территории всей РФ. Можно купить диплом за любой год, включая документы старого образца. Документы выпускаются на “правильной” бумаге самого высшего качества. Это позволяет делать государственные дипломы, которые не отличить от оригиналов. Документы заверяются необходимыми печатями и штампами.
    Купить диплом ВУЗа.
    lebanonhub.app/blogs/2403/%D0%9A%D0%B0%D0%BA-%D0%BC%D0%BE%D0%B6%D0%BD%D0%BE-%D0%B1%D1%83%D0%B4%D0%B5%D1%82-%D0%B1%D1%8B%D1%81%D1%82%D1%80%D0%BE-%D0%BF%D1%80%D0%B8%D0%BE%D0%B1%D1%80%D0%B5%D1%81%D1%82%D0%B8-%D0%B0%D1%82%D1%82%D0%B5%D1%81%D1%82%D0%B0%D1%82-%D0%B2-%D0%B8%D0%BD%D1%82%D0%B5%D1%80%D0%BD%D0%B5%D1%82-%D0%BC%D0%B0%D0%B3%D0%B0%D0%B7%D0%B8%D0%BD%D0%B5
    Удачи!

  3. Qazrpul表示:

    Привет, друзья!
    Где заказать диплом специалиста?
    Наши специалисты предлагают быстро приобрести диплом, который выполнен на оригинальной бумаге и заверен печатями, штампами, подписями должностных лиц. Документ пройдет лубую проверку, даже при помощи профессиональных приборов. Решайте свои задачи быстро и просто с нашим сервисом.
    Купить диплом о высшем образовании.
    http://www.euusedgoodstrading.com/read-blog/2792

  4. I wanted to thank you for this good read!! I certainly enjoyed every little bit of it. I have you bookmarked to look at new stuff you post…

  5. Diplomi_krEa表示:

    ответственность за купленный диплом asxdiplomik.com/kupit-diplom-moskva .

  6. Iajdbh表示:

    buy calan for sale – order verapamil 120mg pills buy tenoretic no prescription

  7. Slot demo表示:

    I like it whenever people come together and share thoughts. Great website, stick with it!

  8. Jarioribd表示:

    Привет!
    Купить диплом университета
    Наша компания предлагает выгодно и быстро купить диплом, который выполняется на бланке ГОЗНАКа и заверен мокрыми печатями, водяными знаками, подписями. Документ пройдет любые проверки, даже при помощи специфических приборов. Достигайте свои цели максимально быстро с нашим сервисом.
    Где приобрести диплом по актуальной специальности?
    Всё, что нужно знать о покупке аттестата о среднем образовании

  9. Hthjmh表示:

    how to buy arava – order risedronate generic purchase cartidin pills

  10. aphid control表示:

    Thank you for making the trustworthy effort to talk about this. I think very sturdy approximately it and would like to read more. If it’s OK, as you gain more extensive wisdom, would you thoughts adding extra articles very similar to this one with additional info? It could be extraordinarily useful and useful for me and my friends.

  11. I love what you guys are up too. This sort of clever work and reporting! Keep up the amazing works guys I’ve added you guys to our blogroll.

  12. I have been exploring for a little for any high quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this web site. Reading this info So i’m happy to convey that I have an incredibly good uncanny feeling I discovered exactly what I needed. I most certainly will make certain to do not forget this site and give it a glance on a constant basis.

  13. I am just use very happy understand this. This can be the method of information which needs to be presented harmful . ” the actual random hype may possibly be inside the another webpages. Satisfaction from your individual sharing with us the following prime file.

  14. I am curious to find out what blog platform you have been utilizing? I’m having some small security issues with my latest website and I’d like to find something more safe. Do you have any suggestions?

  15. magnificent submit, very informative. I ponder why the opposite experts of this sector don’t realize this. You must proceed your writing. I’m sure, you’ve a great readers’ base already!

  16. Real informative and excellent anatomical structure of content material , now that’s user pleasant (:.

  17. There couple of interesting points in time in this posting but I do not determine if I see them all center to heart. There is some validity but I most certainly will take hold opinion until I check into it further. Very good post , thanks and now we want a lot more! Included with FeedBurner also

  18. those thick and heavy borosilicate wine glasses are the best but they are very expensive.

  19. Spot on with this write-up, I seriously believe that this amazing site needs a great deal more attention. I’ll probably be back again to read more, thanks for the advice!

  20. supperace777表示:

    Thanks for another informative web site. Where else could I get that kind of information written in such an ideal way? I have a project that I’m just now working on, and I’ve been on the look out for such information.

  21. Uazruql表示:

    Добрый день!
    Заказать диплом ВУЗа
    Наша компания предлагает быстро и выгодно приобрести диплом, который выполняется на оригинальной бумаге и заверен печатями, штампами, подписями официальных лиц. Документ способен пройти любые проверки, даже с использованием профессиональных приборов. Решите свои задачи быстро и просто с нашей компанией.
    Где приобрести диплом специалиста?
    http://forum.hi-def.ru/index.php?showtopic=35822
    Окажем помощь!.

  22. Xariorpuu表示:

    Добрый день!
    Где купить диплом по необходимой специальности?
    Купить диплом о высшем образовании.
    http://karkadan.ru/users/77829
    Успешной учебы!

  23. Xariorspw表示:

    Привет!
    Где приобрести диплом по актуальной специальности?
    Купить диплом ВУЗа.
    http://www.hristianka.ru/forum/r/prev_loaded/1/
    Успехов в учебе!

  24. Everything is very open with a very clear description of the challenges. It was truly informative. Your site is extremely helpful. Many thanks for sharing!

  25. breasmale表示:

    Food and Drug Administration FDA in February 2015 for the treatment of hormone receptor HR positive human epidermal growth factor receptor 2 HER2 negative advanced breast cancer buy online cialis

  26. Diplomi_gcOl表示:

    купить диплом о высшем образовании с занесением в реестр в ульяновске ast-diplom.com .

  27. Diplomi_oxot表示:

    купить диплом о высшем цена купить диплом о высшем цена .

  28. scatterwinph表示:

    An interesting dialogue is value comment. I think that it’s best to write more on this topic, it may not be a taboo topic but typically persons are not enough to talk on such topics. To the next. Cheers

  29. Toninfurf表示:

    online cialis Ding H, Wu Y, Zhang W, Zhong J, Lou Q, Yang P, Fang Y 2017 Occurrence, distribution, and risk assessment of antibiotics in the surface water of Poyang Lake, the largest freshwater lake in China

  30. Jrvfxb表示:

    purchase durex gel for sale – generic xalatan purchase latanoprost generic

發佈留言

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