SlideShare a Scribd company logo
1 of 32
Download to read offline
Canvas Only
Creative Coding in HTML5
“Software for Makers”
Make Magazine #30
processing.js paper.js
know processing want interactivity
artists --using code
[Casey Reas](reas.com)
[Aaron Koblin](aaronkoblin.com)
[Camille Utterback](camilleutterback.com)
java
PApplet
preprocessor
core.jar
awesome p5 books
p5 live coding video
• hello world
• show java file, how it builds the scaffolding
• show simple graphics demo
• more complex example
• arudino ide is based on the processing ide
“game loop” event based
KineticJS
EasleJS
paper.js
<!DOCTYPE html>
<html>
<head>
<title>Prototype : Paper : Test</title>
<script type="text/javascript" src="../../../lib/paper.js">
</script>
<script type="text/paperscript" src="js/app.js" canvas="testCanvas">
</script>
</head>
<body>
<canvas id="testCanvas" resize></canvas>
</body>
</html>
html»
«paper.js basics
var path = new Path.Circle(view.center, 30);
path.strokeColor = 'black';
!
function onResize(event) {
path.position = view.center;
}
js»
«paper.js basics
Paper.js live coding
video
• setting up a basic paper.js project
• creating some objects
• creating some interactivity with the mouse
processing.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Prototype : Processing + CoffeeScript : Test</title>
<link rel="stylesheet" href="stylesheets/app.css" />
</head>
<body>
<canvas id="p5canvas"></canvas>
<script type="text/javascript" src="../../../lib/jquery-1.9.1.min.js">
</script>
<script type="text/javascript" src="../../../lib/processing-1.4.1.js">
</script>
<script type="text/javascript" src="../../../lib/coffee-script-1.6.2.js">
</script>
<script type="text/coffeescript" src="js/app.coffee">
</script>
</body>
</html>
html»
«p5js basics
html { overflow: hidden; }
body { margin: 0px; }
css»
«p5js basics
$(window).resize ->
processing.size $(window).width(), $(window).height()
$(document).ready ->
canvas = document.getElementById "p5canvas"
window.processing = new Processing canvas, coffee_draw
coffee/jquery»
«p5js basics
coffee_draw = (p5) ->
p5.setup = () ->
p5.size $(window).width(), $(window).height()
p5.draw = () ->
p5.noStroke()
circle_size = p5.random(10, 40)
if circle_size < 30 then p5.fill 255, 0, 0
else p5.fill 0, 0, 255
p5.ellipse
p5.random(0, p5.width),
p5.random(0, p5.height),
circle_size,
circle_size
coffee/jquery»
«p5js basics
Processing.js live
coding video
• Setting up a basic processing.js sketch
• Creating some objects
• Creating some interactivity
css vs. canvas
Simple UI Creation live
coding video
• creating a simple object
• trapping for interactivity / bounds
• skinning objects
• circular menu example
Canvas UI Libraries
• Zebra UI
• github.com/barmalei/zebra
• FiveGUI
• github.com/elhsmart/FiveGUI
Going Canvas Only
• If we have our UI in Canvas what else do we
need
• Allowing for window resizing
• Different devices, media queries, etc.
• Whats next? Phonegap, AppCloud?
Cool Crossover Tech
• Toxiclibs -> Toxiclibs.js (2d/3d graphics, color,
math, physics)
• Box2d -> jBox2d -> box2djs (2d physics,
angrybirds)
Toxic Libs live coding
video
• Complex Color Interpolation and Modification
• geometry calculations in 2d and 3d
• complex 3d mesh generation
Box2d live coding
video
• Integrating box2d with processing.js
• Angry Birds Style Physics
• Physics Based UI Buttons and other elements
Additional Resources
Box2D vs Chipmunk: which physics engine for HTML5 games?
http://nine-software.com/2012/12/box2d-vs-chipmunk-html5-games/
!
AeroTwist Tutorials (three.js)
http://www.aerotwist.com/tutorials/
!
Coffeescript's `for` loops
http://www.jezng.com/2012/05/iteration-in-coffeescript/
!
ToxicLibs JavaDocs (documentation)
http://toxiclibs.org/javadocs/
!
Additional Resources
Box2D vs Chipmunk: which physics engine for HTML5 games?
http://nine-software.com/2012/12/box2d-vs-chipmunk-html5-games/
!
AeroTwist Tutorials (three.js)
http://www.aerotwist.com/tutorials/
!
Coffeescript's `for` loops
http://www.jezng.com/2012/05/iteration-in-coffeescript/
!
ToxicLibs JavaDocs (documentation)
http://toxiclibs.org/javadocs/
!
Thank you!
Questions Comments?
@manofstone
everything posted to:
github.com/manofstone/canvas-only/
Canvas Only: Creative Coding in HTML5

More Related Content

What's hot

About node-canvas
About node-canvasAbout node-canvas
About node-canvas
Seiya Konno
 
JavaScript: Creative Coding for Browsers
JavaScript: Creative Coding for BrowsersJavaScript: Creative Coding for Browsers
JavaScript: Creative Coding for Browsers
noweverywhere
 

What's hot (19)

Automated perf optimization - jQuery Conference
Automated perf optimization - jQuery ConferenceAutomated perf optimization - jQuery Conference
Automated perf optimization - jQuery Conference
 
GCC 11-13-15
GCC 11-13-15GCC 11-13-15
GCC 11-13-15
 
GSS Frontend Project Management
GSS Frontend Project ManagementGSS Frontend Project Management
GSS Frontend Project Management
 
Treeshaking your CSS
Treeshaking your CSSTreeshaking your CSS
Treeshaking your CSS
 
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
 
About node-canvas
About node-canvasAbout node-canvas
About node-canvas
 
To build a WordPress Theme: Wordcamp Denmark 2014
To build a WordPress Theme: Wordcamp Denmark 2014To build a WordPress Theme: Wordcamp Denmark 2014
To build a WordPress Theme: Wordcamp Denmark 2014
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with Webpack
 
Static Websites - The Final Frontier
Static Websites - The Final FrontierStatic Websites - The Final Frontier
Static Websites - The Final Frontier
 
JavaScript: Creative Coding for Browsers
JavaScript: Creative Coding for BrowsersJavaScript: Creative Coding for Browsers
JavaScript: Creative Coding for Browsers
 
Mobile applications in a new way with React Native
Mobile applications in a new way with React NativeMobile applications in a new way with React Native
Mobile applications in a new way with React Native
 
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
Angularjs vs Dojo toolkit | SuperSpeaker@CodeCamp Iasi 2014
 
The New Design Workflow
The New Design WorkflowThe New Design Workflow
The New Design Workflow
 
Bootstrap vs. Skeleton
Bootstrap vs. SkeletonBootstrap vs. Skeleton
Bootstrap vs. Skeleton
 
Web Optimisation
Web OptimisationWeb Optimisation
Web Optimisation
 
Javascript fatigue, 자바스크립트 피로
Javascript fatigue, 자바스크립트 피로Javascript fatigue, 자바스크립트 피로
Javascript fatigue, 자바스크립트 피로
 
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
 
Front-end Project Development -- from install, development to production
Front-end Project Development -- from install, development to productionFront-end Project Development -- from install, development to production
Front-end Project Development -- from install, development to production
 
(2018) Webpack Encore - Asset Management for the rest of us
(2018) Webpack Encore - Asset Management for the rest of us(2018) Webpack Encore - Asset Management for the rest of us
(2018) Webpack Encore - Asset Management for the rest of us
 

Viewers also liked

Viewers also liked (8)

Creative coding academy
Creative coding academyCreative coding academy
Creative coding academy
 
Arte Computacional
Arte ComputacionalArte Computacional
Arte Computacional
 
Creative Coding Workshop - Introduction
Creative Coding Workshop - IntroductionCreative Coding Workshop - Introduction
Creative Coding Workshop - Introduction
 
Creative Coding with Processing
Creative Coding with Processing Creative Coding with Processing
Creative Coding with Processing
 
Intro to Creative Coding
Intro to Creative Coding  Intro to Creative Coding
Intro to Creative Coding
 
Introduction to Processing and creative coding
Introduction to Processing and creative codingIntroduction to Processing and creative coding
Introduction to Processing and creative coding
 
Creative Coding 1 - 1 Introduction
Creative Coding 1 - 1 IntroductionCreative Coding 1 - 1 Introduction
Creative Coding 1 - 1 Introduction
 
StoryCode DIY Days Presentation - Creative Coding
StoryCode DIY Days Presentation - Creative CodingStoryCode DIY Days Presentation - Creative Coding
StoryCode DIY Days Presentation - Creative Coding
 

Similar to Canvas Only: Creative Coding in HTML5

JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
Why you should build your own JS Frontend Framework
Why you should build your own JS Frontend FrameworkWhy you should build your own JS Frontend Framework
Why you should build your own JS Frontend Framework
baccigalupi
 

Similar to Canvas Only: Creative Coding in HTML5 (20)

EuRuKo JRuby Talk 2008
EuRuKo JRuby Talk 2008EuRuKo JRuby Talk 2008
EuRuKo JRuby Talk 2008
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Node azure
Node azureNode azure
Node azure
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
 
Why you should build your own JS Frontend Framework
Why you should build your own JS Frontend FrameworkWhy you should build your own JS Frontend Framework
Why you should build your own JS Frontend Framework
 
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esCreating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
 
Advanced Web Graphics with Canvas
Advanced Web Graphics with CanvasAdvanced Web Graphics with Canvas
Advanced Web Graphics with Canvas
 
Android
AndroidAndroid
Android
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
React Native - DILo Surabaya
React Native -  DILo SurabayaReact Native -  DILo Surabaya
React Native - DILo Surabaya
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Node.js for .NET Developers
Node.js for .NET DevelopersNode.js for .NET Developers
Node.js for .NET Developers
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
 
Building a game engine with jQuery
Building a game engine with jQueryBuilding a game engine with jQuery
Building a game engine with jQuery
 
W3C HTML5 KIG-The complete guide to building html5 games
W3C HTML5 KIG-The complete guide to building html5 gamesW3C HTML5 KIG-The complete guide to building html5 games
W3C HTML5 KIG-The complete guide to building html5 games
 
java swing
java swingjava swing
java swing
 
The Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey VasilievThe Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey Vasiliev
 

More from James Stone

Turku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-componentsTurku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-components
James Stone
 

More from James Stone (6)

Turku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-componentsTurku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-components
 
Easy Bolt-on Docs Using React Styleguidist
Easy Bolt-on Docs Using React StyleguidistEasy Bolt-on Docs Using React Styleguidist
Easy Bolt-on Docs Using React Styleguidist
 
Living Styleguides: Build Your Own Bootstrap
Living Styleguides: Build Your Own BootstrapLiving Styleguides: Build Your Own Bootstrap
Living Styleguides: Build Your Own Bootstrap
 
ZURB Foundation 5: Clean + Organized
ZURB Foundation 5: Clean + OrganizedZURB Foundation 5: Clean + Organized
ZURB Foundation 5: Clean + Organized
 
Wordpress -> Middleman: Lesson learned in the 2-years since migrating
Wordpress -> Middleman: Lesson learned in the 2-years since migratingWordpress -> Middleman: Lesson learned in the 2-years since migrating
Wordpress -> Middleman: Lesson learned in the 2-years since migrating
 
ZURB Foundation 5 -- Understanding the Ecosystem
ZURB Foundation 5 -- Understanding the EcosystemZURB Foundation 5 -- Understanding the Ecosystem
ZURB Foundation 5 -- Understanding the Ecosystem
 

Recently uploaded

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 

Recently uploaded (20)

Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 

Canvas Only: Creative Coding in HTML5

  • 2. “Software for Makers” Make Magazine #30 processing.js paper.js know processing want interactivity
  • 3.
  • 4.
  • 5. artists --using code [Casey Reas](reas.com) [Aaron Koblin](aaronkoblin.com) [Camille Utterback](camilleutterback.com)
  • 6.
  • 9. p5 live coding video • hello world • show java file, how it builds the scaffolding • show simple graphics demo • more complex example • arudino ide is based on the processing ide
  • 10.
  • 11. “game loop” event based KineticJS EasleJS
  • 13. <!DOCTYPE html> <html> <head> <title>Prototype : Paper : Test</title> <script type="text/javascript" src="../../../lib/paper.js"> </script> <script type="text/paperscript" src="js/app.js" canvas="testCanvas"> </script> </head> <body> <canvas id="testCanvas" resize></canvas> </body> </html> html» «paper.js basics
  • 14. var path = new Path.Circle(view.center, 30); path.strokeColor = 'black'; ! function onResize(event) { path.position = view.center; } js» «paper.js basics
  • 15. Paper.js live coding video • setting up a basic paper.js project • creating some objects • creating some interactivity with the mouse
  • 17. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Prototype : Processing + CoffeeScript : Test</title> <link rel="stylesheet" href="stylesheets/app.css" /> </head> <body> <canvas id="p5canvas"></canvas> <script type="text/javascript" src="../../../lib/jquery-1.9.1.min.js"> </script> <script type="text/javascript" src="../../../lib/processing-1.4.1.js"> </script> <script type="text/javascript" src="../../../lib/coffee-script-1.6.2.js"> </script> <script type="text/coffeescript" src="js/app.coffee"> </script> </body> </html> html» «p5js basics
  • 18. html { overflow: hidden; } body { margin: 0px; } css» «p5js basics
  • 19. $(window).resize -> processing.size $(window).width(), $(window).height() $(document).ready -> canvas = document.getElementById "p5canvas" window.processing = new Processing canvas, coffee_draw coffee/jquery» «p5js basics
  • 20. coffee_draw = (p5) -> p5.setup = () -> p5.size $(window).width(), $(window).height() p5.draw = () -> p5.noStroke() circle_size = p5.random(10, 40) if circle_size < 30 then p5.fill 255, 0, 0 else p5.fill 0, 0, 255 p5.ellipse p5.random(0, p5.width), p5.random(0, p5.height), circle_size, circle_size coffee/jquery» «p5js basics
  • 21. Processing.js live coding video • Setting up a basic processing.js sketch • Creating some objects • Creating some interactivity
  • 23. Simple UI Creation live coding video • creating a simple object • trapping for interactivity / bounds • skinning objects • circular menu example
  • 24. Canvas UI Libraries • Zebra UI • github.com/barmalei/zebra • FiveGUI • github.com/elhsmart/FiveGUI
  • 25. Going Canvas Only • If we have our UI in Canvas what else do we need • Allowing for window resizing • Different devices, media queries, etc. • Whats next? Phonegap, AppCloud?
  • 26. Cool Crossover Tech • Toxiclibs -> Toxiclibs.js (2d/3d graphics, color, math, physics) • Box2d -> jBox2d -> box2djs (2d physics, angrybirds)
  • 27. Toxic Libs live coding video • Complex Color Interpolation and Modification • geometry calculations in 2d and 3d • complex 3d mesh generation
  • 28. Box2d live coding video • Integrating box2d with processing.js • Angry Birds Style Physics • Physics Based UI Buttons and other elements
  • 29. Additional Resources Box2D vs Chipmunk: which physics engine for HTML5 games? http://nine-software.com/2012/12/box2d-vs-chipmunk-html5-games/ ! AeroTwist Tutorials (three.js) http://www.aerotwist.com/tutorials/ ! Coffeescript's `for` loops http://www.jezng.com/2012/05/iteration-in-coffeescript/ ! ToxicLibs JavaDocs (documentation) http://toxiclibs.org/javadocs/ !
  • 30. Additional Resources Box2D vs Chipmunk: which physics engine for HTML5 games? http://nine-software.com/2012/12/box2d-vs-chipmunk-html5-games/ ! AeroTwist Tutorials (three.js) http://www.aerotwist.com/tutorials/ ! Coffeescript's `for` loops http://www.jezng.com/2012/05/iteration-in-coffeescript/ ! ToxicLibs JavaDocs (documentation) http://toxiclibs.org/javadocs/ !
  • 31. Thank you! Questions Comments? @manofstone everything posted to: github.com/manofstone/canvas-only/