Forms and Peer Review. HTML forms are a standard way to collect information from the user. Activity: Create a simple form. Your final project should be a functional web site by this time. Activity: Peer Review: Students split up into pairs and review each other’s web sites.
Homework
You will be working on your final and other assignments. If you have extra time on your hands, you can build a WordPress template.
Materials
Additional materials for this unit can be found by following these links:
Everyone is pretty busy with their finals but I thought to wrap up the course with a guided tour of a WordPress template.
look at how PHP creates the WordPress Website out of different sections.
take a detailed look at the WordPress style sheet.
Outcomes
At the end of this unit, students will have:
been exposed to a content management system (CMS).
worked through WordPress template.
understood how PHP combines the page out of disparate files.
will have been helped with any outstanding issues remaining in their final project.
Step-by-Step
20
Review homework and answer questions.
40
Show and Tell: Content management System — WordPress: new site
15
Student Evaluations: I will leave the room while you fill out the evaluations.
10
Break
80
In Class Help on the Final
News and External Resources
Sources of information that will enrich your knowledge about web design and will help you to stay current:
Move the Web Forward is the hub for how to engage the web community once you have joined it. You have all joined this community by now, and this will be a continually updated resource at the center of the web design universe.
Eric Meyer The original Industry Leader that helped bring in Standards based web design.
Jeff Zeldman Another industry leaders that helped bring in standards based web design.
There are, of course, many more resources but in this ever changing fast moving web culture, you can count on these to move the web forward. This will keep you going.
One last article that introduces freelance bidding sites.
As long as you are a student, your courses provide you with projects but if you are graduating, I highly recommend checking these sites out, and doing a number of projects, if not for the money, for the experience, so that you can build up your portfolio.
Definitions
These are the terms that participants should be familiar with during this unit:
Forms and Peer Review. HTML forms are a standard way to collect information from the user. It requires setting up a php script. Activity: Create a simple form and include it in your final. Activity: Peer Review: Students split up into pairs and review each other’s web site(s).
1) For class: sv Create a form to collect user information for your site. 2) Write up the web site you reviewed and hand that to the person whose site you reviewed and to me. Read: chapter 16. 3) For final: Use the feedback from the peer review to finish your website. Due: The following week.
Materials
Additional materials for this unit can be found by following these links:
There are, of course, many more resources but Safari, Firefox and Opera are the standards compliant browsers that have carried web forward. Microsoft is also becoming a player but all of you use Macs.
Talking Points
LYNDA.COM is available to all Newschool students by logging in, going to the library page, clicking on databases and search for lynda.com. You will have to sign up and activate an account but this will will give you access to both the video and the supplementary exercise files.
Validating web forms is a critical skill for any web developer, ensuring that the data that’s submitted is complete, accurate, and not malicious before it’s sent off to the server. Join author Ray Villalobos in this course as he shows how to validate input from site visitors with HTML5, JavaScript, and jQuery and then process the data with PHP. Plus, learn how to email form data and save it in a MySQL database so that it’s ready for other applications.
Assignment Links
Links that I expect to be up and the end of the semester:
Index.html landing page— these links and a picture next to your name.
Worksheet: behind the scenes on creative process.
NY Times Wireframe
Portfolio Photoshop Comp
Week 4
Portfolio exhibiting the CSS selections
Week 5
Portfolio Photoshop comp to HTML/CSS.
Week 6
Portfolio: rough, including SEO, Google Analytics and Styled Navigation
Week 7
Midterm Quiz
Midterm: Portfolio (can be the same link as week 6)
Week 8
Typography Poster
Final Worksheet with topic
Week 9
Responsive Redesign of Portfolio
Week 10
CSS3 Collateral ( and post the exercise you did in class)
Week 11
CSS3 Animatics (and post the exercise you did in class)
Week 12
Final: Rough
Week 12
Multimedia Demonstration
Week 13
Final: Modular Navigation
Week 14
Final: User Testing
Week 14
Final: Peer Review
Week 14
Forms
Week 15
WordPress CMS
Week 15
Link to Final
The final website sells something. It does not have to be lots of pages but the quality has to be ready for public scrutiny. It should have many of the topics we covered, like CSS3, Multimedia, PHP, forms media queries, etc.
Definitions
These are the terms that participants should be familiar with during this unit:
Peer review is an important life skill. Do it effectively and with tact, be positive and insightful and help the person see things about their site that they did not catch, from effective design and user experience point of view to mistakes or better solutions to implementing code.
Be Constructive and Instructive
Be positive, let your partner know what you liked. Praise, comment, and correct in that order. Make positive comments about the design, its execution and overall effectiveness of the site before explaining what does not meet expectations. Look at the code to see if it is properly annotated, well organized and valid. You will run their code through validator (and css validator. I expect that the site was already valid HTM and CSS. If not, it should be by the time you are finished.
Instruct if your partner needs to understand things that you are aware of and they are not. You can help them grow in the same way that you grew this semester. Sharing is caring, and it is always good to spread the love. You really know your stuff when you can teach it!
Critical Review Examples
If you are in need of an example please check out Web Standards Sherpa, a website dedicated to constructive criticism, to highlight standards compliant solution that solve real world problems. You can see articles that review the headlines of the New York Times and there are many others, including a critique of their own site.
The goal of WebStandardsSherpa.com is to provide web professionals the opportunity to receive feedback, glean advice and learn best practices from experts in the field to help improve the quality of their own work. It’s very instructive to see professional and pedagogically useful critique at work.
Reacting to Criticism
You do not have to incorporate your classmate’s suggestions. Trust your own judgement about your design, determine which issues are most important, though pay attention to comments if they are made by more than one peer, and get another opinion if you aren’t sure about something.
User Testing
One way to get feedback is to user test your site. You will use the SilverBack application to record the user test. Download the application, which is free for 30 days.
Doing a user test is straight forward. Create a project, and create a session which will record the your peer review partner’s “user interaction” as they go through your website.
Peer Review Check List
Be constructive, not just “yes” or “no”. Goint through these lists will help you dot your “i”s and crossed your “t”s, so to speak.
Using the HTML5 boilerplate should help to make your site work for most browsers. Try to test your site on Chrome, Firefox and Safari for Mac and Edge for Windows.
Help Your Partner. Everyone has learned a lot but not everyone will have learned everything equally well. You have the opportunity of helping your partner fixissues with their website where they may not have figured out the best way to do something. We are in this all together, and being able to help someone is rewarding initself.
Print out or fill in online the two pdf documents: the questions below and Adobe’s website analysis. Evaluate and answer questions. Send them to your peer review partner and CC me. If your partner has not yet finished coding their site they need to coordinate with you when it is finished, so you can do the review.
Intuitive reaction
Take the five-seconds test. What’s your immediate response? Your split second intuition is often canny in its ability to present an accurate picture that can get lost in more deliberated responses.
Describe how the site make you feel.
Clarity of Communication
Does the clearly communicate to its intended audience?
Is the experience seamless?
Do the pictures and the design facilitate the communication?
Accessibility
Are any of the pictures too large or too small? If so, fix them.
Is there an easily discoverable means of communicating with the author or administrator?
Is the HTML semantic (can screen readers to navigate the site)?
Consistency
Does the site have a consistent and clearly recognizable “look-&-feel”?
Do repeating visual themes to unify the site?
Is it consistent even without graphics or an external style sheet? (it can happen)
Navigation
Are the links obvious in their intent and destination?
Is there a convenient, obvious way to maneuver among related pages, and between different sections?
Design & maintenance
Does the site make effective use of hyperlinks to tie related items together?
Are there dead links? Broken scripts? Pages that are not completed or look unfinished?
Is page length appropriate to site content?
Code
Is the code clean and well documented?
Is it optimized for Search Engines (SEO)?
Does it have Google’s Analytics code?
Does it use the HTML5 boilerplate?
Does the HTML validate? Use the Unicorn Unified Validator Service and Check the HTML and CSS. You are to report your findings in your conclusion.
HTML5 and CSS3 goodness
List the CSS3 features used. Were they used to good effect?
Is the HTML5 semantically correct?
Is the website future proof? Does it use media queries? Check to see how it works on the iPhone/Android?
Overall Assessment?
Make a list of fixes, suggestions and possible solutions to any issue that came up when assessing the website using the aforementioned considerations.
Send this report to your partner later today, if you need more time to write it up than class provides, and send a copy to me.
Forms are vital tools for collecting information from users, such as their name, email address, opinions, etc. A form will take input from the user and may store that data into a file, place an order, gather user statistics, register the person or subscribe them to a newsletter.
HTML
The form itself is created in HTML, and starts with the <form>element and ends when that element closes. All the form elements are within the form element, mostly consisting of various input elements.
The input element changes according to its attributes. If there are no attributes, it provides a one line text field:
HTML Code:
<form>
<input>
</form>
Result:
Attributes
You add the type="text" or type="submit" attributes to the <input> tag to specify if it is text or a submit button. Add a name="name" attribute to reference the form element when it is sent. The size attribute sets the width, measured in blank spaces, and the number of characters can be limited using the maxlength="" attribute.
The submit button is created by using the input tag with a type attribute set to submit. The value="Send" attribute provides the text for the button, so the value send will label the submit button as “send”. Pressing the button engages the <form> action.
There has to be a mechanism for the form to send the information it collects. The <form> element contains a method attribute method="post" that is usually set to post. It can also be set to get, which appends the form information to the URL.
The <form> also has an action attribute action="url.php", which specifies the URL the data is sent to. In this example, it is set to use the email client with the “mailto:” command.
Filling out your name and sending it will open up your email client, and create an email addressed to name@address.com. and the body of the email contains whatever name you’ve entered. This paring up of the name of the form element with the information entered needs to happen for each form element that gets sent.
Radio Buttons
Of the different types of input, the type=radio allows for only one choice out of a number of options. This is accomplished by using the same name for each of the options, so that only one can be chosen. Each option has its own value however, which is sent when that option is selected.
HTML Code:
<input type="radio" name="color" value="red"> Red
<input type="radio" name="color" value="green"> Green
<input type="radio" name="color" value="blue"> Blue
Result:
Check Boxes
Check boxes are similar to radio buttons but its possible to click on more than one option.
HTML Code:
<input type="checkbox" name="color" value="cyan"> C
<input type="checkbox" name="color" value="magenta"> M
<input type="checkbox" name="color" value="yellow"> Y
<input type="checkbox" name="color" value="black"> K
Result:
Drop Down Lists
Another way to present the choices is as a drop down menu, which are especially good when there are lots of options. The drop down list is created by the <select> with each choice enclosed by an option tag.
All of the input fields have been single lines up to this point. The textarea provides a larger area to enter text, specified in rows and columns. A row is one line of text high while column unit is a character wide. Another setting is the wrap, which can be either virtual, which wraps the words for the person entering the text, but the text is sent without returns, or, physical, where the text is sent wrapped, just as it appears in the text area. You can also turn text wrap off.
HTML Code:
<textarea rows="5" cols="80" wrap="physical" name="comments">
Enter Comments Here:
</textarea>
Result:
If you enter text and press the send button, you can see that the words are concatenated (meaning added together) with plus signs and because the wrap is physical, the return is represented by the code: %0D%0A.
PHP script
Thus far the actions for all of these examples has been the “mailto:” which sent the text to the email client. Sending an email with PHP is easy enough. All you need is the PHP mail() function:
mail("recipient@domain.com", "This is the message subject", "This is the message body");
It gets more complicated when you need to connect up and receive the information, to add security measures, verify the form entry, and so on. Most hosting services have an email script that you can use, and all you need to do is send the form to that script in the action="email-script.php" attribute.
Setting Up Your Form
There are a lot of PHP email scripts on the web, and Free Contact Form is one that is simple and easy to set up. It has all the parts you need. See the demo.
These instructions are for the first version of this script: Download the package.
installation.txt contains basic instructions:
METHOD 1 (Automated)
Upload all files to your website.
In your browser, open the file freecontactforminstall.php and install.
METHOD 2 (Manual)
Create the file ‘freecontactformsettings.php’ using a code/plain text Editor.
Insert the following code into this file :
<?php
$email_to = "youremailaddress@yourdomain.com"; // your email address
$email_subject = "Contact Form Message"; // email subject line
$thankyou = "thankyou.htm"; // thank you page
// if you update the question on the form -
// you need to update the questions answer below
$antispam_answer = "25";
?>
Enter your email address in place of youremailaddress@yourdomain.com
Change the email subject (if you like)
Change your thank you page reference (if you like)
Save the file.
Copy ALL files onto your website using an FTP program
Test it out. The thank you page has been redirected with the return button bringing you back here.
Alternatives
You need not develop your own php file if you use Form Spree. This allows you to go beyond the options provided for in the php script.
Setting it up is easy and free. Here’s how: You don’t even have to register.
Setup the HTML form
Change your form’s action attribute to the action input given below. Replace “your@email.com” with your own email.
Go to your website and submit the form once. This will send you an email asking to confirm your email address, so that no one can start sending you spam from random websites.
All set, receive emails
From now on, when someone submits that form, we’ll forward you the data as email.
HTML5 Forms
Before HTML5, forms had to be carefully vetted with JavaScript to make sure that the information the user input was fundamentally correct, like an email address actually had the form of an email address, and a URL actually had the form of a URL. With HTML5 greatly enhanced forms support, this can be taken care of by the browser. Though there are still some browser compatibility problems, the time is coming when form checking is built right in.
Multimedia features of HTML5. HTML5 introduces a host of new features, the most visible are sound, video and the canvas element. Activity: Incorporate multimedia. Activity: In-class final Workshop #2.
1) For class: Use audio, video or canvas to sell your final Project. 2) For final: Finish the remaining pages of your website for peer review. Read chapter 17. Due: The following week. Third Quarter Assessment: Have your Final Worksheet including all 7 steps, photoshop comp and opening page ready and uploaded.
Materials
Additional materials for this unit can be found by following these links:
Video and canvas add a dimension of multimedia to the web experience that goes well beyond print. This should excite many of you but it can be daunting at the same time. The language of story telling on video, tools like After Effects, Final Cut Pro and Premier and the production requirements of making the videos are another world altogether.
When it is done right, video gets people’s attention, conveys emotion and personality, and engages engages people in a way that photo and text alone can’t. It can improve the website experience but it can also cripple it, suck up bandwidth, drive people away, and suck the energy out of what could otherwise be a good website by attracting too much of the attention.
Ask yourself, when you use video:
What are the goals for my video strategy?
What types of videos will I post?
Will I be concepting, shooting, editing and uploading videos?
How can I measure success or failure?
That said, Flash integrates well with video. Too bad that Apple threw it a monkey-wrench by not supporting it on its iPhone or iTablets.
The MetaProject exemplifies how flash integrates with video seamlessly working together.
You can, however, use Google’s swiffy to convert flash sites to HTML5, SVG, and javascript.
Problems of keeping video in the background like images. It takes a lot of room, requires a lot of bandwidth and careful planning, and the right video. Random Dance uses video on the splash page, and then uses it throughout the site.
Still, video can be difficult to integrate, so think about that as you work on your final. You need not integrate video or canvas in your final, just show me that you can do it in the homework.
News and External Resources
Subscribe to the following two magazines using (RRS): A list Apart has been a beacon for web development since the web’s earliest days with timely articles, and it still remains one of the best resources out there. Smashing Magazine is another popular web design magazines that you should be reading.
There are a zillion other resources on the web, and you need to plug in to stay up to date. As this especially exciting time shows, the best is yet to come. Plug in and keep abreast of the creative solutions that become standardized practices.
Though the time it has taken each of you to understand HTML and CSS has varied, everyone should be on board by now. The more you code, the better you become.
All of you should be reaching out to the larger web community. If I have been a cheerleader that encourages you to do that, then I can feel confident that you will fish for a lifetime.
landing page— links to your assignments and a picture next to your name.
HTML markup of Analysis
Worksheet: behind the scenes on creative process for midterm (7 steps)*:
Week 4
Portfolio exhibiting the CSS selections
HTML Wire Frame from PhotoShop comp
Week 5
incorporate CSS Layout Strategies in web site
Week 6
Quiz
Peer Review Notes / Advice
Week 7
Typography Poster
Finished Midterm: Portfolio
Week 8
Final Worksheet*
Week 9
Responsive Redesign of Portfolio
Week 10
CSS3 Collateral
Class Exercise
Week 11
CSS3 Animatics
Class Exercise
Week 12
Final: Modular Navigation
Week 13
Multimedia Demonstration
Week 14
Forms
Peer Review Notes / Advice
Week 15
Final — You have 5 days extra to hand it in before I determine my final grade
Each assignment exhibits a skill. If you have used that skill in building your portfolio, link to that page and explain how it satisfies the homework. For example, for Week 11 CSS Animatics, if you used a hover that fades in your final, point to the page that exhibits that feature and let me know where to look if it is not completely obvious.
The final website sells something. It does not have to be lots of pages but the quality has to be ready for public scrutiny. It should have many of the topics we covered, like CSS3, Multimedia, PHP, forms, media queries, etc.
Definitions
These are the terms that participants should be familiar with during this unit:
A codec is a device or computer program capable of encoding and/or decoding a digitaldata stream or signal. The word codec is a portmanteau of ‘compressor-decompressor’ or, more commonly, ‘coder-decoder’. A codec (the program) should not be confused with a coding or compression format or standard – a format is a document (the standard), a way of storing data, while a codec is a program (an implementation) which can read or write such files. In practice “codec” is sometimes used loosely to refer to formats, however.
A codec encodes a data stream or signal for transmission, storage or encryption, or decodes it for playback or editing. Codecs are used in videoconferencing, streaming media and video editing applications. A video camera’s analog-to-digital converter (ADC) converts its analog signals into digital signals, which are then passed through a video compressor for digital transmission or storage. A receiving device then runs the signal through a video decompressor, then a digital-to-analog converter (DAC) for analog display. The term codec is also used as a generic name for a video conferencing unit.
H.264
Out of the three standards, H.264 has the momentum, the quality and the recognition among media professionals. It also has the backing of a massive consortium of some of the industry’s biggest companies, including Microsoft and Apple, via MPEG LA. And therein lies its critics chief complaint: H.264 is not free.
For consumers, yes, it’s free. And most developers won’t have to worry about licensing issues (for now). However, that may not be the case for video distribution sites. The ins and outs of H.264 patent licensing go well beyond the scope of this article (and gets really confusing to boot) but suffice it to say that people have questions.
For most developers, the patent issue will largely boil down to a philosophical argument between open standards and image quality. H.264 provides a higher image quality and better streaming than Ogg (see below) and VP8 (WebM). It also enjoys a performance advantage due to hardware acceleration on multiple platforms including PC and mobile devices.
Lastly, consider ease of production, not an insignificant issue. All major video editors, including Final Cut, Adobe Premiere and Avid, export to H.264 format. The same can’t be said for Ogg Theora or VP8. If your shop is producing its own video, and a lot of it, using H.264 exclusively will shave a big chunk off your workflow.
Ogg Theora
Ogg is the only standard that is truly unencumbered by patent. However, it is also arguably the lowest in quality, though not by much. Multiple head to head comparisons against H.264 have favored the latter. While Ogg encodes to a slightly tighter file, it produces a lower image quality than H.264 and suffers even more in its streamability.
VP8 (WebM)
Between the two extremes of high quality but patent-encumbered (H.264) and marginal quality but royalty-free (Ogg) rests VP8, probably the most controversial standard of the three. So far, tests have shown that H.264 provides a slightly higher quality video than VP8 but that difference is negligible for most commercial purposes.
The bigger question is that of open standards. On one side of the debate, you have Google backing away from H.264 in favor of its “open” WebM standard, even going so far as to release WebM under a Creative Commons license. On the other hand, you have pretty much everyone else arguing that, in this case, “open” may not really mean “open”. Using the example of the JPEG lawsuits, for example, Microsoft points out that even if WebM is not patent encumbered by Google’s account, without explicit user indemnification from Google, many companies and individuals could still open themselves to patent infringement lawsuits, ostensibly from MPEG LA, by deploying WebM video.
The canvas element was originally developed by Apple for OSX as a way to encourage easy customization of dashboard widgets. It utilized Apple’s HTML rendering engine called webkit to create 2D graphics at around the same time as the WHATWG (Web Hypertext Application Technology Working Group) came together to create what would become HTML5. Apple, of course, played a central role in the creation of HTML5, and the technology was adopted by other the browser vendors.
What Is It?
Canvas is a drawable region that uses Javascript drawing functions to create dynamically generated graphics. This is what other drawing programs do. Illustrator draws vectors using postscript to create pictures, Canvas uses javascript. A difference is that the vectors are always rasterized at screen resolution in canvas, meaning that they are turned into a bitmap.
How To Use the Canvas Element
You first have to create the canvas element, and you do that in the body of the document:
<canvas id="canvas" height="250" width="300">
<p>Use a browser that supports the canvas element
</canvas>
The canvas element needs to be initialized in the Javascript, which appears between the <script type="application/javascript"> and </script> tags, and that is usually done in the head of the document:
The actual instructions are written right after the canvas element has been initialized. The following examples show the instructions that draw a square and a circle.
Square
You draw on the canvas by coding the exacting steps the computer requires to draw these shapes. There is only one shape it supports natively, and that is a square. All other shapes have to be drawn path by path. Luckily, there are drawing functions that make it possible to create complex shapes.
If we take a red square as an example, you first specify the fill style and then fill the rectangle based on the given coordinates. Click the draw button and you will see this red square appear in the canvas window. If you change the values, the square will change.
Javascript Code View
var canvas=document.getElementById('theCanvas');
var context=canvas.getContext('2d');
//code for the square
context.fillStyle = "rgb(255,0,0)";
context.fillRect(50, 50, 50, 50);
Paths
Paths require a few more steps. You have open and close a path using the following code: beginPath() , and closePath(), though the shape automatically closes when you stroke() or fill() the path. In that case, the closing of the path can be skipped. There are path methods that draw lines, arcs, bezier and quadratic curves.
The following circle has all of its steps annotated, so show exactly how many steps it takes to create a red circle with a white fill that has a shadow, the letter P and a stroke to create a no parking sign. Copy the code and replace the code for the square in the Javascript Code View, click Draw It if you haven’t already done so, and you can play with the code, add to it, subtract, to see how it works. If you get excited, I have included many more definitions below that you can use to draw simple shapes.
context.beginPath(); //Begin drawing path
context.strokeStyle="#f00"; // sets stroke color
context.fillStyle="#fff"; //sets fill color
context.arc(175,120,100,0,Math.PI*2, true); // draws circle
context.lineWidth=40; // sets width of stroke
context.shadowOffsetX="3" // adds shadow offset x
context.shadowOffsetY="3" // adds shadow offset y
context.shadowBlur="7" // adds shadow blur
context.shadowColor="#888"// sets shadow color
context.stroke(); // draws stroked circle
//remove shadow from inside of circle
context.shadowOffsetX="0" // removes offset x
context.shadowOffsetY="0" // removes offset y
context.shadowBlur="0" // removes blur
context.fill(); // draws fill
context.closePath; // closes path
context.beginPath(); // draws P
context.lineWidth=15; // width of line
context.strokeStyle="#000"; // color of stroke
context.fillStyle="#000"; // color of fill
context.font="9em sans-serif"; // size of font
context.strokeText("P",120,190); // text stroke
context.fillText("P",120,190); // text fill
context.closePath; // but closes path
context.beginPath(); // draws Slash
context.strokeStyle="#f00"; // sets stroke color
context.moveTo(100,50); // begin vector
context.lineTo(240,210); // end vector
context.lineWidth=25; // width of line
context.stroke(); // draw stroke
context.closePath; // not necessary but closes path
Definitions:
You can copy these definitions and paste them into the editor to create a shape. Check out the example shapes to see what definitions are required.
Styles
set the fillStyle
context.fillStyle="color"
set the strokeStyle
context.strokeStyle="color"
line widths
context.lineWidth=number
line join styles
context.lineJoin="style" (bevel, round, miter)
line end styles
context.lineCap="style" (butt, round, square)
Rectangles
draw a rectangle
context.strokeRect(left, top, width, height)
fill a rectangle
context.fillRect(left, top, width, height)
erase a rectangle
context.clearRect(left, top, width, height)
paths
begin a path
context.beginPath
complete a path
context.closePath
move the pen to a location
context.moveTo(horizontal, vertical)
draw a straight line from current pen location to a new location
context.lineTo(horizontal, vertical)
stroke the current path
context.Stroke()
fill the current path
context.fill()
Text
set the font
context.font="bold italic size font-family"
set the alignment
context.textAlign="left right center"
fill some text
context.fillText("string to fill", top, left)
stroke some text
context.strokeText("string to stroke", top, left)
See if you can draw this figure using the shapes similar to the ones already drawn in the demo, or draw your own shapes. You can copy and paste the definitions, just make sure you initiate the object, give it properties, draw it and then create it, and if this seems laborious, be glad you are not a computer, who does nothing but this type of routines.
Better yet, watch someone else create a canvas based on processing, a sister visual programing language developed to teach visually oriented people programming, right before your eyes, using popcorn.
Turn Postscript Into Javascript
Drawing these primitive shapes by hand is really only for the purpose of understanding how canvas works. In its raw form it will never be a drawing tool for design students.
But that can change if someone were to write drawing software that could be translated to the canvas element. This is exactly what Mike Swanson has done. He created an Adobe Illustrator to HTML5 Canvas plugin. [Unfortunately, the plugin has not been updated, and it did not load the last time I tried it with Illustrator CC. Still, this is a good learning opportunity for you to understand how canvas works, and it is better to use SVG Graphics and insert the vector art straight into the code.]
This is an Illustrator plug-in that transforms Illustrator art into canvas art, allowing you use Illustrator as a front end to draw with, and the plugin will render it into Javascript code equivalent that can be rendered in the canvas element. Check out the Yellowstone Map as an example, and if you go to the website, you will see that the plugin is able to create motion graphics as well. We do not have the ability to install Illustrator plug-ins in the school’s computers but please try this on your computer, as Illustrator is a very good front end to drawing directly on the canvas. If you follow his tutorial, you can even animate!
Illustrator
So here is an example of Illustrator art I created turned into Javascript. It takes only 5700 lines of code! To put that into perspective, the Illustrator file requires about the same number of lines using postscript to create the picture. Here is a text version of the Illustrator file, and the html source so you can see that there are an equal number of instructions.
Wrap Up
Advanced examples using the canvas element from the web:
Canvas is made for creating games. It turns graphic assets into bitmaps ready for use. If you already know some JavaScript, and would like to explore making games, then the next links are for you.
Step by step explanation of how to create your own game using javascript and canvas.
HTML5 audio and video provide native playback of both audio and video by the web browsers themselves.
History
Audio and video playback was previously handled through proprietary plug-ins, originally Quicktime, RealPlayer and Microsoft’s Media player, but then Sorenson, who created the CODEC (from COmpression/DECompression) Apple was using for Quicktime, created a similar CODEC for MicroMedia’s Flash, propelling this ubiquitous plugin to become the preferred software for delivering video streaming.
Apple did not like that (it sued Sorenson to try and stop this from happening), as Flash killed Apple’s Quicktime and all the others video players (Real Player and Microsoft Media Player).
Flash became the default delivery system for video on the web. Adobe purchased MicroMedia for 3.5 billion in 2005, and inherited Apple’s wrath. This point should not be lost in the current debate between Flash and HTML5 video, which has been forced by the iPhone not playing Flash.
That battle appears to have been won by Apple. Flash is no longer considered ubiquitous. HTML5 video has taken over from Flash and its use in ads is no longer what it once was. Flash has been implemented on Android, but its performance is spotty, introduces vulnerabilities and eats up precious resources at the time of this writing. Flash is not dead, and its still good at what it does on the desktop, but its future of this ubiquitous proprietary standard has suffered a major hit.
The Quick and Easy Way to Embed Video
You can upload your video to Google’s YouTube or Vimeo, and embed it in your page. The tools to do that are provided by these video sharing sites, and the process is painless enough. Include the code to embed into your web page and these services will take care of displaying your video in the right format.
You can even tell both YouTube and Vimeo to display the video using HTML5 on your own browser, and it will do so seamlessly, and as you can see, you can style it on the fly. The media is my son Taiyo and some footage of the 2nd Ave Subway (under construction).
These sites generate the code that you put in your page, and from Youtube, it looks like this:
Standard HTML5 video is responsive by setting width to 100% and placing it in a responsive container. It will automatically fill the right size while keeping the ratio (height and width) the same.
video {
width: 100% !important;
height: auto !important;
}
This does not work for Vimeo or YouTube viddoes, which use the iframe to deliver the content.
Instead, you place absolutely the iframe containing the YouTube and Vimeo video in a parent locked to the video’s ratio using the following HTML and CSS:
There are times when you need to display video and audio from your own server, and not rely on some other service. You can do that yourself, and it is almost as easy as displaying an image. I say almost as easy, because the issue as to what browsers can display which audio or video format requires that we need to create several version of each to satisfy all of the browsers.
Audio
HTML example of an audio with only a mp3 source file and an explanation that is supposed to show up if the browser does not recognize the audio tag:
<audio controls src="http://b.parsons.edu/~dejongo/12-fall/stuff/KillingACountry.mp3" type="audio/mpeg"> The browser you're using does not recognize the HTML5 audio tag. You can download the song here: <a href="http://b.parsons.edu/~dejongo/12-fall/stuff/KillingACountry.mp3">
link</a>.</audio>
What actually happens in Firefox is that the HTML 5 property is recognized, but the proprietary CODEC is not recognized. This means that you do not get the option to download the music, but see this instead:
Proprietary CODEC Problems
The mp3 audio file format is proprietary. For that reason, not all browsers support mp3 audio files. Only Safari and IE9 play this audio format. Opera or Firefox users are not able to play the mp3 format. Implementing this would require them to pay royalties. They do support the royalty free ogg format, so we need to approach this another way.
The Solution
I need to create an ogg file from the mp3 file, and serve up both files, and the browser will pick whatever one they can play. Since I have an mp3 file, I need to create the ogg or ogv file. Translating the audio file from mp3 to the ogg format can be done using Miro Video Converter, or if you want more control, Handbrake. With Miro Video Converser, drag the file to the conversion window, select Theora from the drop down menu and convert. It will create a theora.ogv file that works just fine in Firefox and Opera.
Putting both sources in the HTML5 tag allows the browser to choose the one that they can play, and the following code works in Firefox.
<audio controls>
You are not able to hear this sound because the browser you are
using is not standards compliant. You can download the song
from this <a href="http://b.parsons.edu/~dejongo/12-fall/stuff/KillingACountry.mp3">link</a>.
<source src="http://b.parsons.edu/~dejongo/12-fall/stuff/KillingACountry.mp3" type="audio/mpeg">
<source src="http://b.parsons.edu/~dejongo/12-fall/stuff/KillingACountry.ogg" type="audio/ogg">
</audio>
CSS Code View
The Video CODEC Problem
Video has the same problems as audio. Some browsers manufacturers pay royalties and can play the H.264 CODEC while others rely on a royalty free CODEC. Just like with audio, Safari and Internet Explorer can display the proprietary formats while Firefox, Opera and Chrome support royalty free formats.
There is movement toward a single open source standard. Google purchased On2 Technologies, the creators of the VP8 video codex, and combined it with Vorbis, an open source audio format, and has been giving it away, meaning that they released the code to the open source community. Google’s WebM Project is still new, and not yet supported by all browsers, but the intention is that WebM replace the proprietary H.264 format that Apple and Microsoft Endorse.
Google has even gotten religious, and stopped supporting the .H264 CODEC in Chrome, claiming it’s only supporting open source software. It hopes to accelerate the adoption of its WebM format.
The industry is entrenched, however, and to become ubiquitous the CODEC has to be supported by all kinds of playback devices, like phones and computer chips, so do not expect major changes any time soon, even if the future belongs to open source.
Microsoft makes a pug-in for Chrome users to play the proprietary CODEC. So there you have it, the messy world of building a brave new future.
Translating Video from H264 to Theora Ogg
What this all means is that you have to translate your video into several different formats if you want to serve it yourself, just like audio, and include source links to each of them. The browser will then play whichever one it is most attracted to.
There are plenty of ways to get the .h64 CODEC, but to translate to ogg requires
I need to create an ogg file from the mp3 file, and serve up both files, and the browser will pick whatever one they can play. Since I have an mp3 file, I need to create the ogg file. Translating the audio file from mp3 to the ogg format can be done using Miro Video Converter, or if you want more control, Handbrake.
Here is example code for inserting video into the browser, using both ogg and H264 CODECs:
<video width=480 height=270 controls>
<source src="http://b.parsons.edu/~dejongo/12-fall/stuff/10_example.ogg" type=video/ogg>
<source src="http://b.parsons.edu/~dejongo/12-fall/stuff/10_example.mp4" type=video/mp4>
Download the example video in
<a href="http://b.parsons.edu/~dejongo/12-fall/stuff/10_example.ogg">oog</a>, or
<a href="http://b.parsons.edu/~dejongo/12-fall/stuff/10_example.MP4">mp4</a> format.
</video>
CSS Code View
Download this video and transcode it, then upload it and get it to play in Firefox.
This is, of course, only the beginning. An example of what’s coming is the use of javascript to make a much more customized player and the ability to initiate actions that control web content from the movie itself, as in popcorn as demonstrated in this canvas sketch demonstration. The possibilities of HTML5 and open source video are endless and belong to the future.
Programming on the web. Scrips on the server and the client create the modern web experience. 1) Introduction to PHP. Activity: Use PHP includes to make final website modular. 2) JQuery as a way to create dynamic web pages. Activity: Create a dynamic web page using jQuery.
1) For class: Implement a PHP include for your navigation and a jQuery script into your final website. 2) For final: Finish home page for the final. Read chapters 19 and 20. Due: The following week.
Goal
The goal of this unit is to:
Be exposed to programing languages.
Understand the benefits of modular web design.
Add interactivity to the website.
Outcomes
At the end of this unit, students will have:
Used PHP include to create a modular web page.
Created interactivity by implement jQuery in a web page.
Been left with a general idea of both server side and client programing languages for the web.
Materials
Additional materials for this unit can be found by following these links:
Jquery has been the most popular implementation of jQuery. A set of Jquery Tutorials to get you started.
CMS or Content Management System are modular websites, and they are everywhere. The benefits are that content can be accessed and updated by the clients themselves. Once the template is set up, the navigation and look are taken care of. It is possible to acquire templates and modify them for your own usage, or to build them from scratch.
Disadvantages are that the site needs to be maintained and becomes vulnerable to being hacked if you don’t.
This site is a modular site running WordPress. Take a look at the wordpress showcase and see other examples. Other popular CMSs are Joomla and Drupal.
News and External Resources
Resources that will aid in your understanding of HTML and CSS.
PHP is a general-purpose scripting language that is especially suited to server-sideweb development where PHP generally runs on a web server. Any PHP code in a requested file is executed by the PHP runtime, usually to create dynamic web page content or dynamic images used on web sites or elsewhere.[34] It can also be used for command-line scripting and client-sideGUI applications. PHP can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems (RDBMS). It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.[3]
PHP acts primarily as a filter,[35] taking input from a file or stream containing text and/or PHP instructions and outputting another stream of data; most commonly the output will be HTML. Since PHP 4, the PHP parsercompiles input to produce bytecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.[36]
Mastering CSS is akin to building amazing things with Legos. Understanding JavaScript is like manufacturing Legos. Though related, they are simultaneously altogether different.
JavaScript’s use in applications outside Web pages — for example in PDF documents, site-specific browsers, and desktop widgets — is also significant. Newer and faster JavaScript VMs and frameworks built upon them (notably Node.js) have also increased the popularity of JavaScript for server-side web applications.
JavaScript uses syntax influenced by that of C. JavaScript copies many names and naming conventions from Java but the two languages are otherwise unrelated and have very different semantics. The key design principles within JavaScript are taken from the Self and Scheme programming languages.[8]
A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies.
Some JavaScript libraries, such as YUI, are classified as frameworks since they exhibit full-stack capabilities and properties not found in general JavaScript libraries.
While JavaScript, as first developed by Netscape (and later Mozilla), has long had a presence on the Web for many websites, it gained a particular pitch with the rise of the Web 2.0 era of computing, in which JavaScript became increasingly used for the development of user interfaces for applications, both web-based and desktop-based. JavaScript was also combined with CSS to create dynamic web pages, which have also become popular as a more efficient and accessible alternative to Flash -based websites.
With the expanded demands for JavaScript, an easier means for programmers to develop such dynamic interfaces was needed. Thus, JavaScript libraries such as Prototype, script.aculo.us, Ext Core, MooTools and jQuery and JavaScript widget libraries such as Ext JS and Dojo Toolkit were developed, allowing for developers to concentrate more upon more distinctive applications of AJAX. This has led to other companies and groups, such as Microsoft and Yahoo! developing their own JavaScript-based user interface libraries, which find their way into the web applications developed by these companies.
Almost all JavaScript libraries are released under either a copycenter or copyleft license to ensure license-free distribution, usage, and modification.