- HTML5 Canvas allows for dynamic drawing and animating directly in HTML using JavaScript scripting. It can be used to draw shapes, images, text and respond to user input like mouse clicks.
- The canvas element creates a grid that allows positioning images and objects by x and y coordinates. Basic drawing functions include lines, rectangles, curves and filling areas with colors.
- Transformations like translation and rotation can change the orientation of drawings on the canvas. The drawing state can be saved and restored to return to previous settings.
- Images can be drawn and manipulated at the pixel level by accessing image data. Animation is achieved by redrawing the canvas repeatedly with small changes.
- Data from sources like JSON can be
A university lecture for journalism students -- how to use the canvas element to add graphics and animation to Web pages. Updated April 2014. Basics for beginners. See also https://github.com/macloo/canvas
This is a brief introduction about HTML5. You will learn that what is new in HTML5. I will tell what and when changes happened in HTML which Hyper Text markup language. Html is a language which is used to create web pages that we have seen on the internet. For website development and web hosting visit https://tekfold.com
A university lecture for journalism students -- how to use the canvas element to add graphics and animation to Web pages. Updated April 2014. Basics for beginners. See also https://github.com/macloo/canvas
This is a brief introduction about HTML5. You will learn that what is new in HTML5. I will tell what and when changes happened in HTML which Hyper Text markup language. Html is a language which is used to create web pages that we have seen on the internet. For website development and web hosting visit https://tekfold.com
All you need to know about CSS:
Selectors
Value Processing
Cascading
Box Model
Visual Formatting Model
Block Formatting Context
Stacking Context
At-Rules
Units
Presentation with examples:
http://rawgit.com/vzhidal/HTML-CSS-Training-Presentations/master/css-basics.html
Things you should know about Javascript ES5. A programming language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else
JavaScript Events:
HTML events are "things" that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can "react" on these events.
What can JavaScript Do?
Event handlers can be used to handle, and verify, user input, user actions, and browser actions:
Things that should be done every time a page loads
Things that should be done when the page is closed
Action that should be performed when a user clicks a button
Content that should be verified when a user inputs data
What REALLY Differentiates The Best Content Marketers From The RestRoss Simmonds
I’ve been privileged to work with brands from all over the world in the last few years. Through this work, I’ve also had a chance to meet, become friends with, work with and collaborate with some of the best content marketers in the world. Some of these marketers have their faces plastered in magazines while others keep it low key and aren’t anything close to household names.
When I first started my career, I made it my mission to learn from the best. I studied and read books from the advertising greats and consumed every blog post I could fine from the top modern day marketers I could fine. Through discussions, research and studying the craft, I’ve been able to identify and uncover a few common traits that are found in the best content marketers today. If you want to be a great content marketer, you need to know what it takes to be considered such. Here’s a few traits that differentiate the best content marketers from the rest.
All you need to know about CSS:
Selectors
Value Processing
Cascading
Box Model
Visual Formatting Model
Block Formatting Context
Stacking Context
At-Rules
Units
Presentation with examples:
http://rawgit.com/vzhidal/HTML-CSS-Training-Presentations/master/css-basics.html
Things you should know about Javascript ES5. A programming language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else
JavaScript Events:
HTML events are "things" that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can "react" on these events.
What can JavaScript Do?
Event handlers can be used to handle, and verify, user input, user actions, and browser actions:
Things that should be done every time a page loads
Things that should be done when the page is closed
Action that should be performed when a user clicks a button
Content that should be verified when a user inputs data
What REALLY Differentiates The Best Content Marketers From The RestRoss Simmonds
I’ve been privileged to work with brands from all over the world in the last few years. Through this work, I’ve also had a chance to meet, become friends with, work with and collaborate with some of the best content marketers in the world. Some of these marketers have their faces plastered in magazines while others keep it low key and aren’t anything close to household names.
When I first started my career, I made it my mission to learn from the best. I studied and read books from the advertising greats and consumed every blog post I could fine from the top modern day marketers I could fine. Through discussions, research and studying the craft, I’ve been able to identify and uncover a few common traits that are found in the best content marketers today. If you want to be a great content marketer, you need to know what it takes to be considered such. Here’s a few traits that differentiate the best content marketers from the rest.
How to Craft Your Company's Storytelling Voice by Ann Handley of MarketingProfsMarketingProfs
You know your company's story, but what's the right voice to use in telling it? Find out how to craft your company's storytelling voice. Ann Handley, chief content officer of MarketingProfs and author of "Content Rules" shares tips and ideas for crafting your brand's storytelling voice.
40 Tools in 20 Minutes: Hacking your Marketing CareerEric Leist
Marketing today requires doing a little bit of everything from creative writing to HTML to light Photoshopping. There are a ton of free tools to make those tasks easier and scalable.
Originally presented at Suffolk University's Bridging the Gap Conference--April 18th, 2014.
WEB APPS
http://zapier.com
https://ifttt.com/
http://twitterfeed.com/
http://gaggleamp.com
http://landerapp.com/
https://support.google.com/analytics/answer/1033867?hl=en
http://99designs.com/
http://visual.ly
http://www.alexa.com/
http://www.hubspot.com/blog-topic-generator
http://www.wordle.net/
www.inboundwriter.com
http://litmus.com/
http://www.inboundwriter.com/
https://www.optimizely.com/
http://thenounproject.com/
http://fortawesome.github.io/Font-Awesome/
https://www.facebook.com/help/459892990722543/
http://ads.twitter.com
https://plzadvize.com/
DESKTOP APPS
https://itunes.apple.com/us/app/caffeine/id411246225?mt=12
http://jumpcut.sourceforge.net/
http://www.gifgrabber.com/
http://www.gimp.org/
EMAIL TOOLS
http://getsignals.com
http://www.yesware.com/
http://www.boomeranggmail.com/
http://rapportive.com/
http://www.wisestamp.com/
http://verify-email.org
MOBILE APPS
https://play.google.com/store/apps/details?id=com.xuchdeid.clear
https://itunes.apple.com/us/app/cardmunch-business-card-reader/id478351777?mt=8
BROWSER PLUGINS
https://chrome.google.com/webstore/detail/omnidrive/gpnikbcifngfgfcgcgfahidojdpklfia?hl=en-US
https://addons.mozilla.org/en-US/firefox/addon/klout/
LEARNING PLATFORMS
http://www.google.com/analytics/learn/
http://www.codecademy.com/
http://teamtreehouse.com/
https://generalassemb.ly/
http://www.intelligent.ly/
http://smarterer.com/
You’re not the expert. Your customers are, and who your customer is, is changing rapidly. Learn more about the digital consumer, how to bring new life to your customer experience, and inspire your team with workshop activities. Take a deeper look into the key drivers of your business, reinvigorate your customer experience, and gain insight from one of the newest inspiring entrepreneurs, who built his business around an out-of-the-ordinary customer experience. Why not create an experience that will leave your customers talking and sharing your brand with everyone? These musings were gathered after attending the Next Generation Customer Experience Conference in San Diego, March 2015.
An effective pitch presentation can be the difference between securing investment and/or support for your startup. Download our slide presentation, "Build a Better Pitch Deck," and gain insight on what content to include in your slides and how to design them for the most impact. This information is aggregated from leading entrepreneurship and investor sources both in Arizona and throughout the nation.
We Are Social's comprehensive new report covers internet, social media and mobile usage statistics from all over the world. It contains more than 350 infographics, including global snapshots, regional overviews, and in-depth profiles of 30 of the world's largest economies. For a more insightful analysis of these numbers, please visit http://bit.ly/SDMW2015
This contains the entire 4-napkin health care series in one file. It makes more sense to read this one now than the others since it is the complete set all in one file.
Today we all live and work in the Internet Century, where technology is roiling the business landscape, and the pace of change is only accelerating.
In their new book How Google Works, Google Executive Chairman and ex-CEO Eric Schmidt and former SVP of Products Jonathan Rosenberg share the lessons they learned over the course of a decade running Google.
Covering topics including corporate culture, strategy, talent, decision-making, communication, innovation, and dealing with disruption, the authors illustrate management maxims with numerous insider anecdotes from Google’s history.
In an era when everything is speeding up, the best way for businesses to succeed is to attract smart-creative people and give them an environment where they can thrive at scale. How Google Works is a new book that explains how to do just that.
This is a visual preview of How Google Works. You can pick up a copy of the book at www.howgoogleworks.net
Writing a Space Shooter with HTML5 CanvasSteve Purkis
This talk reviews a Space Shooter game that I wrote to learn about HTML5 canvas. It covers:
* Basics of canvas 2D
* Overview of how the game is put together
* Some performance tips
First presented @ Ottawa JavaScript in September 2012.
This presentation introduces developers to the functionality of the HTML5 canvas tag. It runs from getting started (slow start) to more comprehensive examples designed to be inspirational in nature. This presentation is not designed to make you an expert with canvas, but to introduce developers to the wealth of possibilities.
4. WHAT IS
HTML5 CANVAS?
• HTML5 element, now part of HTML5 API
• Used for drawing and animating directly in HTML, with
JavaScript scripting
• Originally developed by Apple for Dashboard widgets
5. WHAT CAN IT DO?
• Dynamically draw shapes, images and text
• Respond to user input – mouse, keyboard, touch, etc.
• Animation without Flash
• Create interactive charts and graphs
6. CANVAS IN ACTION
• Rough GuidesKEXP Archive Sketchpad Wired
Mind NYC Restaurant Health Ratings Map
10. SET-UP FOR DRAWING
grab the canvas
element
var mycanvas = document.getElementById("the_canvas");
var context = mycanvas.getContext("2d");
set up a 2D context
12. DRAWING LINES
context.beginPath(); //set up to draw a path
context.moveTo(x,y); //move to the start position
context.lineTo(x,y); //set the end
pointcontext.stroke(); //draw the line
3. Draw line between
1. Set start position points
2. Set end position
13. DRAWING CURVES
Control point 1 Control point 2
bezierCurveTo(100,25 ... ...400,25...
Start point
MoveTo(25,125) Destination point
...325,125);
14. CODING CURVES
var controlPt1 = {x:110,y:30};
var controlPt2 = {x:130,y:80};
var startPt = {x:75,y:140};
ctx.beginPath(); //prepare path
ctx.moveTo(startPt.x,startPt.y);
ctx.bezierCurveTo(
controlPt1.x,controlPt1.y,
controlPt2.x,controlPt2.y,
startPt.x,startPt.y
);
ctx.stroke();
15. DRAWING ARCS
1.5 * PI
Start angle
Start angle
PI 0
Center point End angle
End angle
Center point
0.5 * PI
16. DRAWING ARCS & CIRCLES
• Circles are types of arcs
• Angles are in radians (need to calculate
between degrees and radians)
ctx.beginPath();ctx.arc(x, y, radius, 0, Math.PI*2,
true);ctx.closePath();ctx.fill();
Start angle
Start angle End angle
End angle
17. TEXT
• Text is "drawn" to the canvas
context.fillText("Hello world", 10, 50);
• Style text in CSS syntax with .font property
• Get the dimensions of a text area
textObj = ctx.measureText(d);
width = textObj.width;
19. TRANSFORMATIONS
• To change the orientation of one element on
the canvas, you must shift the entire canvas
• Translate: move the canvas and its origin to a
different point in the grid
• Rotate: rotate the canvas around the current
origin
20. TRANSLATE CONTEXT
Context moved.
Context moved.
The origin point now
The origin point now
has a new location.
has a new location.
22. THE STATE STACK
State 1Fill Style: redRotation: 45deg State 2
Fill Style: redRotation: 45deg
State 1
save()
tate 2Fill Style: blackLine Style: blue
cale: 50%
restore()
cale: 50%
23. SAVE & RESTORE
ctx.fillRect(0,0,150,150); //Draw with default settings
ctx.save(); // Save the default state ctx.fillStyle =
'#09F'; //Change the fill color
state 1
ctx.fillRect(15,15,120,120); // Draw with new settings
ctx.save(); //Save the current state
ctx.fillStyle = '#FFF'; //Change fill again
ctx.fillRect(15,15,120,120); // Draw with new settings state 2
ctx.restore(); //Restore to last saved state
ctx.fillRect(45,45,60,60); //Draw with restored settings
back to state 2
25. DRAW IMAGE
var img = new Image(); //Create an image objectimg.src =
'dog.png'; //Set source
img.onload = function(){ //Wait for the image to load
context.drawImage(img,x,y); //Draw image to canvas
}
26. REDRAW IMAGE
//clear the stage
clearRect(0,0,canvas.width,canvas.height);
speed = 10;
if (previous_x < mouse_x){
direction = 1; //moving left to right
} else {
direction = -1; //moving right to left
}
var new_x = previous_x + (speed * direction);
context.drawImage(img,new_x,y);
27. IMAGES AT THE PIXEL LEVEL
Get image data and loop through pixel by pixel
28. LOOPING THROUGH PIXELS
c.drawImage(img,0,0);var imgData =
c.getImageData(0,0,canvas.width,canvas.height);
for(n=0; n<data.width*data.height; n++) {var index =
n*4; //each pixel has 4 data points
//rgb values from 0-255
red = imgData.data[index];green = imgData.data[index+1];blue
= imgData.data[index+2];
alpha = imgData.data[index+3];
//to reset pixels, change the values in the data array
imgData.data[index+2] = 255; //change the blue value
}
}
30. ANIMATION
Canvas doesn't track objects on the screen –
You must redraw the stage for each movement
Use event listeners or timers
31. FOLLOW THE MOUSE
• Draw the image on the canvas
• Track the position of the mouse (event listener
for every mouse move)
• Redraw the image every n seconds based on
the x position of the mouse
32. VISUALIZE DATA
USE JSON DATA TO CREATE
DYNAMIC DRAWINGS
CONNECT TO A WEB SERVICE
(TWITTER, FOURSQUARE, ETC)
34. MAP DATA TO CANVAS
//the data could also come in as a JSON object
var data = {jane: 231,julie: 325,ben: 276}; //js object
var highest_value = 325; //find programmatically
var pixel_units = canvas.height/highest_value;
for (user in data){ //loop through data points
var bar_height = data[user] * pixel_units;
var bar_title = user;
}
//now it's time to draw!
35. COOL EXAMPLE
Each bubble represents a tweet containing the word "water". Popping the
bubble displays the tweet.
39. GAMES EXAMPLES
• Alex the Alligator http://alex4.tapjs.com
• CATcher http://wpsystem.com.br/catcher/
• Catch the goblin http
://www.lostdecadegames.com/how-to-make-a-
simple-html5-canvas-game/
• Magician Fairy Rescue
http://www.relfind.com/game/magician.html
• Canvas Rider, bike game http://canvasrider.com/
43. CODING GOBLINS
1.Draw images for background, player, and
goblin
2.Listen for arrow keys and change player
coordinates accordingly
3.Detect hit by comparing monster's
coordinates to player's coordinates
4.Redraw as frequently as possible
46. 3D
• A few options:
• Canvas 3D context
• Canvas WebGL context
• Simulated 3D in 2D context
• Libraries ... three.js, c3dl, k3d, Sylvester
47. WebGL CONTEXT
var canvas = document.getElementById("glcanvas");
// Use standard WebGL context or experimental if it's not
available
gl = canvas.getContext("webgl") ||
canvas.getContext("experimental-webgl");
// Define initial WebGL settings
if (gl) {
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.enable(gl.DEPTH_TEST);
gl.depthFunc(gl.LEQUAL);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
}
// It gets more complex from here!
48. LIBRARIES
• KineticJS Canvas drawing & animation library
• Three.JS 3D library
• Processing.js Port of Processing environment
• GLGE WebGL library
• melonJS game engine
• ImpactJS game engine
49. PROCESSING.js
• Reads files from Processing programming
environment
• Uses processing-like code in Javascript
• More flexibility with objects -- collisions,
mouseover, etc
50. KINETIC JS
• Dynamically creates a series of canvas
elements as "layers"
• Provides a Stage class and code similar to
Actionscript
• Allow easy object moving, dragging, and
tracking
2canvas-lineclick.html The code example uses a mouse listener
3canvas-bezier.html
radians = degrees * (pi/180) last parameter (bool) is anticlockwise Circle example in canvas-keyboard.html - also keyboard listener example Circle in: canvas-bounce.html
The foursqare example uses text
build slide?
Translate code is used in canvas-dogrun.html Also in the foursquare example, used to rotate text