Download presentation
Presentation is loading. Please wait.
Published byLambert Harvey Modified over 8 years ago
1
4.3. Code animations by using JavaScript. 4.4. Access data access by using JavaScript. Creating Animations, Working with Graphics, and Accessing Data
2
Agenda Animations Canvas + JavaScript Transmitting Data Loading and Saving Files Validating Form Input Cookies
4
Animation with JavaScript
5
Creating Animations
7
Manipulating the Canvas Recall that the canvas element is used to create a container for graphics With JavaScript, you can manipulate the container and draw graphics dynamically To draw a canvas object, you use the getElementById() function to access the canvas and the canvas.getContext to create the object
8
Canvas Demo Your browser does not support the canvas element. var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.fillStyle="Blue"; ctx.fillRect(5,5,150,75); Example: Cut The Rope
10
Sending and Receiving Data CLIENT
11
The XMLHttpRequest API function load(url, data, callback) { var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.onload = function() { callback(xhr.responseText); } xhr.send(data); } JavaScript
12
Parsing
13
JavaScript Object Notation (JSON)
15
Validating Uploaded Files VS.
16
AppCache for Offline Files Data can be stored locally when a user is offline using the Application Cache, or AppCache AppCache stores resources, such as HTML, CSS, and JavaScript files, locally on a user’s machine As a result, users can access Web pages and apps offline The cache manifest file dictates which type of information is stored offline
18
Validating User Input First Name Last Name Email Address Jane Doe jane@live Please provide a valid email address.
20
Cookies
21
Agenda Animations Canvas + JavaScript Transmitting Data Loading and Saving Files Validating Form Input Cookies
22
© 2015 Microsoft Corporation. All rights reserved.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.