An Introduction to Animation

Slides:



Advertisements
Similar presentations
The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
Advertisements

JQuery A Javascript Library Hard things made eas(ier) Norman White.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
CHAPTER 12 UNLEASHING JAVASCRIPT USING JQUERY. LEARNING OBJECTIVES How to download the JQuery library. How to integrate the JQuery library into an HTML.
JQuery Page Slider. Our goal is to get to the functionality of the Panic Coda web site.Panic Coda web site.
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
JQUERY | INTRODUCTION. jQuery  Open source JavaScript library  Simplifies the interactions between  HTML document, or the Document Object Model (DOM),
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Images in HTML Images in the foreground –src loaded separately; relative to home directory –Width & height set aside space in page; do not use this to.
JavaScript, Fourth Edition
Jquery Nasrullah. Jquery jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Chapter 5: Windows and Frames
Animation & Effects Using JQuery. What is jQuery? jQuery is a lightweight, JavaScript library. The purpose of jQuery is to make it much easier to use.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Modifying HTML attributes and CSS values. Learning Objectives By the end of this lecture, you should be able to: – Select based on a class (as opposed.
Advanced Topics Lecture 8 Rachel A Ober
Intro to jQuery. What is jQuery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Unit 13 –JQuery Basics Instructor: Brent Presley.
5. Energizing pages with animations and effects BEAR BIBEAULT YEHUDA KATZ.
Microsoft FrontPage 2003 Illustrated Complete Creating a Frames Page.
Introduction to JQuery COGS 187A – Fall JQuery jQuery is a JavaScript library, and allows us to manipulate HTML and CSS after the page has been.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
JQuery Animation. If you look at example1.html, you will see that it is a basic web page with links to the jquery library, and a script.js file and some.
INTRODUCTION ABOUT DIV Most websites have put their content in multiple columns. Multiple columns are created by using or elements. The div element is.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Unit M Programming Web Pages with
Class06 Arrays MIS 3502 Jeremy Shafer Department of MIS
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
Introduction to JavaScript
CT Web Development, Colorado State University
Arrays MIS 3502 Jeremy Shafer Department of MIS Fox School of Business
A second look at JavaScript
A (gentle???) Introduction to JavaScript
HTML and CSS MIS 2402 Jeremy Shafer Department of MIS
Sending a text message (and more)
Form Validation (with jQuery, HTML5, and CSS)
Form Validation, Part 2 (with jQuery, HTML5, and CSS)
JavaScript and the DOM MIS 2402 Jeremy Shafer Department of MIS
Numbers, strings and dates in JavaScript
MIS JavaScript and API Workshop (Part 3)
Introduction to AJAX and JSON
MIS JavaScript and API Workshop (Part 2)
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
An Introduction to JavaScript
Programming Control Structures with JavaScript Part 2
Getting started with jQuery
New Semantic Elements (Part 2)
Sending a text message (and more)
An introduction to jQuery
Loops and Arrays in JavaScript
JavaScript objects, functions, and events
Introduction to JavaScript
An introduction to jQuery
Introduction to MIS2402 MIS MIS2402 Jeremy Shafer Department of MIS
Getting started with jQuery
An introduction to jQuery
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
JavaScript.
Form Validation (with jQuery, HTML5, and CSS)
Sending a text message (and more)
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Single Page Architecture (SPA)
JavaScript and the DOM MIS 2402 Maxwell Furman Department of MIS
Presentation transcript:

An Introduction to Animation Jeremy Shafer Department of MIS Fox School of Business Temple University

Agenda A little word of caution Options for introducing animation into our web applications Some best practices for animations Our jQuery toolbox for animations jQuery’s .animate() method Not every animation is obvious… where does animation fit in to our larger objectives for the class?

ANIMATE YOU SHOULD! A word of caution CAN BECAUSE JUST YOU DOESN’T MEAN… YOU SHOULD!

Options for animation in web applications HTML5 increased support for animation … but there’s really no HTML-only option. You need CSS, JavaScript/jQuery, or both. HTML CSS JavaScript CSS – all on its own – has events that fire when an element receives focus, or is hovered over. JavaScript and jQuery have animation options. Some options are totally separate from CSS. Others manipulate CSS to implement the effect. Let’s see some jQuery animation (see joke.zip)

Best practices for animation in applications Use a good CSS template: For real projects, it is advisable to start with a robust HTML/CSS template. A good template will include the CSS animations you need for menus and simple interactive elements. You *probably* don’t need to add any CSS animations beyond that. Keep user experience in mind: Consider how subtle animations can be used to improve user experience. Add those sparingly. Don’t “hack” the template. Instead use jQuery to implement those. Use “complex” animations only when necessary: If your animate is more than a few steps, and requires the coordination of multiple events and/or conditional statements, you should ask yourself: “Is this animation necessary? What core functionality is it related to? What key objective of the project is it related to?”

Our jQuery toolbox…. That's new… jQuery Method Notes .addClass() We've already seen this method! But, if you want the full documentation, it can be found here: https://api.jquery.com/addclass/ .toggleClass() We've already seen this method! But, if you want the full documentation, it can be found here: https://api.jquery.com/toggleclass/ .removeClass() Ok… technically you have not seen this yet, but, what do you think it does? Full documentation found here: https://api.jquery.com/removeclass/ .show() We've already seen this method! But, if you want the full documentation, it can be found here: https://api.jquery.com/show .hide() We've already seen this method! But, if you want the full documentation, it can be found here: https://api.jquery.com/hide .slideToggle() This shows or hides the matched elements with a sliding motion. That’s pretty neat! See slidetoggle.zip for an example and https://api.jquery.com/slidetoggle for full documentation. .animate() That's new…

$("#somelement").animate({property: value}, [speed, callback] ); jQuery animate Basic syntax: $("#somelement").animate({property: value}, [speed, callback] ); This is the selector of the thing we want to animate. Usually just one thing at a time, but not necessarily… This square brackets “[“ and “]” here are not part of the command. They are just a notation, indicating that speed and callback are optional. That’s good. We’ll cover callback functions another day…

jQuery animate (simplified) Basic (simplified) syntax: $("#somelement").animate({property: value},400); This represents the CSS property to animate. Put the CSS property name in quotes. This is the speed of the animation in milliseconds. 400 is the default. This value is a string as well. It contains a numeric value, and a unit of measure. For example: “10px” or “50%” or “2em” Tip! You can also use an operators here to manipulate current CSS values. += will add to the current value. The -= operator will subtract.

The big picture Animation effects allow our application’s interface to change right before our eyes. Those changes do not require us to reach out to a URL and reload a whole new copy of a page in response to every user action. Instead, content can be pulled down once, and show/hidden/animated as needed. This idea of bundling a lot of content into a single page is known as a Single Page Architecture (SPA) … an idea that we will revisit in the future!

It’s time for an experiment! Download mis2402template.zip and set up the template in your mis2402 workspace Explore how link navigation is taking place. Note that clicking on a navigation link does not load a new page. Instead, specific divs are shown / hidden. Notice how we change the class of our naivation <li> tags to “active” to indicate to indicate the user’s last navigation choice. Notice how .animate use used to emphasize the continue button on content div four. Your challenge is going to be to add a link 5 and a carousel of images similar to what is found in your textbook (see pages 282, 283)