HTML5 Canvas標籤範例
隨著時代的進步,HTML的版本一直在進化,目前比較新的版本應該就是HTML5了,這次的HTML5針對許多標籤進行調整,當然也新增了一些標籤,主要的目的是希望可以將一些本來需要利用Flash才可以完成的互動頁面取而用HTML5來進行設計,這樣比較能減輕網頁的負載,但不管怎麼進步,其最重要的目的當然還是要網友能夠看到才行!
目前各家的瀏覽器對於HTML5的支援都不一,如果想要測試看看自己所使用的瀏覽器對HTML5的支援程度,可以到這個網址測試,馬老師針對目前的三款瀏覽器(IE9、Firefox6、Chrome13)來做了測試,IE9於HTML5中測試得到了以下的分數:
Firefox6於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>
HSZ Дизайн человека https://humandesignplanet.ru Дизайн человека. 1/4 Дизайн человека.
H0h3Q4C4k7
I blog quite often and I really thank you for your information. Your article has really peaked my interest. I am going to take a note of your blog and keep checking for new information about once a week. I subscribed to your Feed as well.
Добрый день!
Мы изготавливаем дипломы любой профессии по приятным ценам.
vared.flyboard.ru/topic174
Very good information. Lucky me I ran across your site by accident (stumbleupon). I have book-marked it for later!
I’d like to thank you for the efforts you have put in writing this website. I’m hoping to check out the same high-grade blog posts by you later on as well. In truth, your creative writing abilities has inspired me to get my own blog now 😉
Как правильно приобрести диплом колледжа или ПТУ в России, важные моменты
Добрыйдень!
Приобрести диплом о высшем образовании.
telegra.ph/kupit-diplom-vo-vladimire-08-13-3
This is the perfect blog for anybody who hopes to understand this topic. You understand so much its almost hard to argue with you (not that I personally would want to…HaHa). You definitely put a fresh spin on a topic that’s been discussed for many years. Excellent stuff, just wonderful.
JMQ Дизайн человека https://designchita.ru Дизайн человека. 4/1 Дизайн человека.
Howdy, I do think your web site might be having web browser compatibility problems. When I take a look at your blog in Safari, it looks fine however, if opening in IE, it has some overlapping issues. I merely wanted to provide you with a quick heads up! Apart from that, excellent blog.
TWH Дизайн человека https://design-human.ru Дизайн человека. 6/2 Дизайн человека.
I’m in awe of the author’s ability to make complicated concepts accessible to readers of all backgrounds. This article is a testament to her expertise and dedication to providing valuable insights. Thank you, author, for creating such an captivating and insightful piece. It has been an incredible joy to read!
Please let me know if you’re looking for a article author for your weblog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please send me an email if interested. Thanks!
ZXJ Дизайн человека https://irida-design.ru Дизайн человека. 5/1 Дизайн человека.
Having read this I thought it was rather enlightening. I appreciate you taking the time and effort to put this information together. I once again find myself spending way too much time both reading and leaving comments. But so what, it was still worthwhile.
Hello, i think that i saw you visited my site thus i came to “return the favor”.I am trying to find things to enhance my web site!I suppose its ok to use some of your ideas!!
pharmacy prices levitra: people’s pharmacy nexium – what pharmacy sells azithromycin
Приобретение школьного аттестата с официальным упрощенным обучением в Москве
Terrific work! This is the type of information that should be shared around the net. Shame on the search engines for not positioning this post higher! Come on over and visit my website . Thanks =)
Spot on with this write-up, I honestly believe that this amazing site needs a great deal more attention. I’ll probably be returning to see more, thanks for the info!
When I initially commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get 4 emails with the identical comment. Is there any method you can take away me from that service? Thanks!
Thanks for taking the time to write this.오피
revatio specialty pharmacy: online pharmacy uk prozac – buy viagra tesco pharmacy
I’m amazed, I have to admit. Seldom do I encounter a blog that’s equally educative and amusing, and let me tell you, you have hit the nail on the head. The problem is something too few people are speaking intelligently about. Now i’m very happy that I found this in my search for something concerning this.
Aw, this was an incredibly good post. Taking the time and actual effort to create a good article… but what can I say… I hesitate a whole lot and don’t manage to get anything done.
I really like it when people come together and share opinions. Great blog, continue the good work!
I’ve been absent for some time, but now I remember why I used to love this website. Thanks , I will try and check back more often. How frequently you update your site?
As being a Newbie, We’re permanently exploring online for articles which can be of help to me. Many thanks
Если вы искали где отремонтировать сломаную технику, обратите внимание – ремонт техники в челябинске