1 Canvas Tag In JavaScript Amy Luong Yan Ge Hon Yee Regneel Prahalad Michael Leggio.

Slides:



Advertisements
Similar presentations
HTML Basics Customizing your site using the basics of HTML.
Advertisements

HTML5 Overview HOANGPT2. 1. General 2. New Elements List 3.
What is Multimedia ? Multi ( Multiple ) and Media ! So…. Information in multiple formats, including text, images, audio, video and animation :) It makes.
CHAPTER 20 CREATING SVG GRAPHICS. LEARNING OBJECTIVES How to embed a graphic stored within a.SVG file in an HTML page How to use the and tag pair to specify.
Iframes & Images Using HTML.
HTTP Request/Response Process 1.Enter URL ( in your browser’s address bar. 2.Your browser uses DNS to look up IP address of server.com.
Lecture # 11 JavaScript Graphics. Scalable Vector Graphics (SVG) Scalable Vector Graphics (SVG), as the name implies, are - scalable (without pixelation):
HTML 5 Previous version: HTML4.01, 1999 Still work in progress, most browsers support some of it.
Understand Web Page Development Software Development Fundamentals LESSON 4.1.
HTM03. Let’s Get Started Everything is drawn onto the 2D rendering context.
© Nova / Grassioulet 5-6 mai 2002 TECFA staf2x S V G glossary Scalable Vector Graphics.
February 11, 2007 Can Ajax be OS for the Browser? Kevin Hakman Co-Founder General Interface Ajax Toolkit Director, Developer Evangelism TIBCO Software.
SVG Scalable Vector Graphics. What is SVG? SVG stands for Scalable Vector Graphics SVG is used to define vector-based graphics for the Web SVG defines.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
Chapter 14 Introduction to HTML
Web Design Software Alyssa Lagimoniere. Adobe Dreamweaver Pros Relatively low-cost price ($99) Produces very "clean" HTML code; easy to transport and.
Web Design Basic Concepts.
Session: 11. © Aptech Ltd. 2HTML5 Audio and Video / Session 11  Describe the need for multimedia in HTML5  List the supported media types in HTML5 
HTML5. What is HTML5? HTML5 will be the new standard for HTML. HTML5 is the next generation of HTML. HTML5 is still a work in progress. However, the major.
DHTML - Introduction Introduction to DHTML, the DOM, JS review.
HTML 5 New Standardization of HTML. I NTRODUCTION HTML5 is The New HTML Standard, New Elements New Attributes Full CSS3 Support Video and Audio 2D/3D.
CS7026 – HTML5 Canvas. What is the element 2  HTML5 defines the element as “a resolution-dependent bitmap canvas which can be used for rendering graphs,
Suleyman YILDIRIM.  Overview  Browser support  Scalability  Performance  Demos  Added value to the project.
INT222 – Internet Fundamentals Weekly Notes: AJAX and Canvas 1.
Computer Concepts 2014 Chapter 7 The Web and .
What is Web Design?  Web design is the creation of a Web page using hypertext or hypermedia to be viewed on the World Wide Web.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Mobile App Support Jacob Poirier Geri Hengesbach Andrea Menke Erin Rossell.
SVG: The Past, Present and Future of Vector Graphics for the Web Patrick Dengler Senior Program Manager, Internet Explorer Team Member, W3C SVG Working.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
HTML5 – The Power of HTML5 – The Power of Thomas Lewis HTML5 Principal Technical Evangelist Microsoft | asimplepixel.tumblr.com.
CITS1231 Web Technologies JavaScript and Document Object Model.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
School of Computer Science & Information Technology G6DPMM - Lecture 17 Scaleable Vector Graphics.
Session: 17. © Aptech Ltd. 2Canvas and JavaScript / Session 17  Describe Canvas in HTML5  Explain the procedure to draw lines  Explain the procedure.
Presented By: Mahmoud Ghoz Internet Explorer 9 and HTML5 for Developers.
Presented by Nassib Awad
Element. The element Used to dynamically draw graphics using javascript. Capable of drawing paths, circles, rectangles, text, and images.
DHTML - Introduction Chapter Introduction to DHTML, the DOM, JS review.
Creating User Interfaces Recap HTML/HTML5 JavaScript features Homework: keep working on user observation studies. Review JavaScript.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 13 - Dynamic HTML: Object Model and Collections Outline 13.1 Introduction 13.2 Object Referencing.
Session: 1. © Aptech Ltd. 2Introduction to the Web / Session 1  Explain the evolution of HTML  Explain the page structure used by HTML  List the drawbacks.
SVG for Designers Tom Hoferek. Objectives Introduce SVG Illustrate its capabilities Demonstrate SVG in action Speculate, discuss, answer questions.
1 Scalable Vector Graphics (SVG). 2 SVG SVG is an application language of XML. “SVG is a language for describing two- dimensional graphics in XML. SVG.
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
XML and SVG as an Aid to Distance Learning Lez Bullwer MSc Information Technology.
HTML VS. FLASH by Yaren Bilici. WHAT IS HTML5? (Hyper Text Markup Language)  Tool for developping websites  If HTML is the backbone of the page, JavaScript.
Contents : What is Silverlight? Silverlight Overview Silverlight Toolkit Overview Timeline & Packaging Silverlight V1.0 & V1.1 Properties of V1.0 Properties.
HTML JAVASCRIPT. CONTENTS Javascript Example NOSCRIPT Tag Advantages Summary Exercise.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Presented By Nanda Kumar(972789) P. Trinesh (982816) Sk. Salma (982824) K. Madhuri (982814) HTML5.
Please thank our sponsors?. SharePoint Data Visualization Using D3, SVG, jQuery and REST.
Introduction of Presented by Neetu sharma MCA (8 th trim)
SVG technology SVG technology is what we want? is what we want? Jaehoon Woo KNU Real-Time Systems Lab. KNU Real-Time Systems Lab.
HTML5 HTML5 Canvas May 18, 2011 Subject: CPSC 473 Professor: Kenytt D. Avery Student: Scott Jung.
HTML 5 (Part 1) – Start from SCRATCH. HTML 5 – Start from SCRATCH.
Scalable Vector Graphics Dietz Ellis 04/17/06. SVG SVG is a language for describing two- dimensional graphics in XML. SVG is a language for describing.
Part – 3 : HTML 5 SVG Tag. † SVG stands for Scalable Vector Graphics. † SVG is used to define vector-based graphics for the Web. † SVG defines the graphics.
Introduction to Silverlight Development Pavel Yosifovich CTO, Matrix Global; Senior Instructor, Hi-Tech College
XHTML. What Is XHTML? XHTML stands for EXtensible HyperText Markup Language XHTML is almost identical to HTML XHTML is stricter than HTML XHTML is HTML.
The HTML5 logo was introduced by W3C in 2010
Chapter 4: Scalable Vector Graphics (SVG)
HTML5 – The Saga Continues
Building beautiful and interactive apps with HTML5 & CSS3
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
ISC440: Web Programming II Ch14: HTML5 Canvas
The Canvas.
HTML 5 Training HTML 5 SYMANTICS [Notes to trainer:
Drawing Graphics in JavaScript
Presentation transcript:

1 Canvas Tag In JavaScript Amy Luong Yan Ge Hon Yee Regneel Prahalad Michael Leggio

2 Topics of Discussion What is the Canvas tag? What is the Canvas tag? History History Advantages/Disadvantages Advantages/Disadvantages The Future/Who is using it ? The Future/Who is using it ? Working Demo and Mechanics Working Demo and Mechanics

3 What do these graphics have in common?

4 What in the world is a Tag?? HTML tag used to create 2D/3D graphics HTML tag used to create 2D/3D graphics Notion of an ”Image that you can paint on" programmatically. Notion of an ”Image that you can paint on" programmatically. Scripting language (Javascript) is used Scripting language (Javascript) is used INTERACTIVE INTERACTIVE Allows for DYNAMICALLY generated graphics in real-time Allows for DYNAMICALLY generated graphics in real-time Graphs, Animations, Images Graphs, Animations, Images

5 GAMES!! GAMES!! Richer client-side web apps Richer client-side web apps Smaller, Leaner, Faster! Smaller, Leaner, Faster! More integrated in your environment More integrated in your environment What in the world is a Tag??

6 History Of The Canvas Tag History Of The Canvas Tag Originally introduced by Apple computer, Inc Originally introduced by Apple computer, Inc First implemented in Mac OS X 10.4(Tiger) First implemented in Mac OS X 10.4(Tiger) Dashboard (WIDGETS) Dashboard (WIDGETS)

7 Apple Safari browser Apple Safari browser Mozilla and Firefox(Gecko) Mozilla and Firefox(Gecko) The element is part of the WhatWG Web applications 1.0 specification (HTML 5). The element is part of the WhatWG Web applications 1.0 specification (HTML 5). Requirements Requirements Safari 2+ (April 2005) Safari 2+ (April 2005) Firefox 1.5+ (Nov 2005) Firefox 1.5+ (Nov 2005) Opera 9+ (April 2006) <-- 7 months ago Opera 9+ (April 2006) <-- 7 months ago

8 Hey! What about IE? Why no Internet Explorer? Why no Internet Explorer? Not natively supported by IE Not natively supported by IE Microsoft does not comply with WhatWG Microsoft does not comply with WhatWG Only with WC3. Only with WC3. GOOGLE is currently involved in a project to add the canvas abilities to IE. GOOGLE is currently involved in a project to add the canvas abilities to IE.

9 Advantages Ease of use Ease of use It is simply a markup tag that is embedded in html, and uses the same attributes as the image tag (with the exception of the src attribute). It is simply a markup tag that is embedded in html, and uses the same attributes as the image tag (with the exception of the src attribute). Small learning curve Small learning curve Little to no cost for training. Little to no cost for training. Implementable immediately Implementable immediately

10 Advantages Low cost Low cost Open source Open source No need to purchase more expensive packages such as Flash, Shockwave, Lightwave, Maya, etc. No need to purchase more expensive packages such as Flash, Shockwave, Lightwave, Maya, etc. Implements both static displays (graphs) and dynamic displays (animations, visualizations, and games). Implements both static displays (graphs) and dynamic displays (animations, visualizations, and games). Comes with a context (rotation, location, transformation), and a number of built-in methods. Comes with a context (rotation, location, transformation), and a number of built-in methods. Allows for rapid alterations of a scene without resorting to the costly DOM manipulation. Allows for rapid alterations of a scene without resorting to the costly DOM manipulation. Makes it possible to compose complex shapes Makes it possible to compose complex shapes

11 Advantages Has both 2D and 3D rendering capabilities. Has both 2D and 3D rendering capabilities. 3D capabilities of the tag are a very recent development. Such a tag brings us back to one of the original promises of web-based 3D, that is, it can be handled as easily as HTML. 3D capabilities of the tag are a very recent development. Such a tag brings us back to one of the original promises of web-based 3D, that is, it can be handled as easily as HTML. Offers the opportunity for developers not familiar with higher-end graphics tools to add graphical texture to their pages. Offers the opportunity for developers not familiar with higher-end graphics tools to add graphical texture to their pages.

12 Disadvantages The entire page must be redrawn when a change is made. The entire page must be redrawn when a change is made. Code can be quite extensive without the use of libraries. Code can be quite extensive without the use of libraries. The Canvas context lacks support for text rendering. The Canvas context lacks support for text rendering.

13 Disadvantages Limited browser support (currently Firefox 1.5 and Safari Limited browser support (currently Firefox 1.5 and Safari There are packages that provide workarounds for this in IE. There are packages that provide workarounds for this in IE. Unlike SVG (Scalable Vector Graphics), canvas supports only one primitive shape, which is the rectangle. All other shapes must be created by combining one or more path. Unlike SVG (Scalable Vector Graphics), canvas supports only one primitive shape, which is the rectangle. All other shapes must be created by combining one or more path.SVG

14 Future/Who’s Using Due to increasing demand we will likely see the addition of text rendering capabilities, as well as a much broader scope of browser support. Due to increasing demand we will likely see the addition of text rendering capabilities, as well as a much broader scope of browser support. Currently being used at the grass roots level of the web development community Currently being used at the grass roots level of the web development community However with Google now on board and a working group having been created to establish standards, this will very likely change. However with Google now on board and a working group having been created to establish standards, this will very likely change.

15 “The trend is clear: smaller, leaner, faster to startup, more integrated in your environment (means real event interoperation with the page!), easier for DHTML designers to understand. This leads me to think that is going to be huge. “ “The trend is clear: smaller, leaner, faster to startup, more integrated in your environment (means real event interoperation with the page!), easier for DHTML designers to understand. This leads me to think that is going to be huge. “ “Thank you, little tag, you'll be teaching a lot of lessons to a lot of people and you'll be making my rich- webapp-developer life easier.” “Thank you, little tag, you'll be teaching a lot of lessons to a lot of people and you'll be making my rich- webapp-developer life easier.” It's the tag, over again: "simplest thing that can possibly work" vs. "design by committee". It's the tag, over again: "simplest thing that can possibly work" vs. "design by committee". Future/ Who's Using A Blogger's Point of View Stefano Mazzocchi

16 Basic Canvas Drawing Functions Drawing a Rectangle fillRect(x,y,width,height) : Draws a filled rectangle Drawing a Rectangle fillRect(x,y,width,height) : Draws a filled rectangle Drawing a Line lineTo(x, y); Drawing Angles arc(x, y, radius, startAngle, endAngle, anticlockwise) Drawing a Quadractic Curve quadraticCurveTo(cp1x, cp1y, x, y)

17 Simple Example canvas.beginPath(); canvas.arc(75,75,50,0,Math.PI*2,true); // Outer circle canvas.moveTo(110,75); canvas.arc(75,75,35,0,Math.PI,false); // Mouth (clockwise) canvas.moveTo(65,65); canvas.arc(60,65,5,0,Math.PI*2,true); // Left eye canvas.moveTo(95,65); canvas.arc(90,65,5,0,Math.PI*2,true); // Right eye canvas.stroke();

18 Implementation function draw(){ var canvas = document.getElementById('myCanvas'); if (canvas.getContext){ var ctx = canvas.getContext('2d'); canvas.beginPath(); …. } }

19 Implementation Specifying Style Specifying Style canvas { border: 1px solid black; } canvas { border: 1px solid black; }</style> Canvas tag in HTML: Canvas tag in HTML: This is my canvas This is my canvas </BODY>

20

21 Business Example Canvas can serve as a great tool for the visualization of corporate data.

22 Fun Canvas Examples 3D first person shooter ape/ 3D first person shooter ape/ ape/ ape/ 3D boxes 3D boxes stic_beta_1/eg/boxes.html stic_beta_1/eg/boxes.html Painting Painting

23 End