Loading forever?...

Javascript Canvas
Audiovisual Light & Magic

Filipe Cruz

Dan Peddle

OPEN SEASON

feel free to interrupt for questions

WHOIS...

Filipe

  • MSc Informatics Engineer from Portugal
  • Media artist of sorts
  • Freelance software developer

WHOIS...

Dan

  • From UK, emigrated to Portugal
  • Worked as a Sound Engineer before discovering <3 for the web
  • Freelancer with JS and front-end focus

2002

Experimental music with buzz

2012

inércia Demoparty

The potential of Javascript Canvas

Hello codebits!

First time for everything!

Why use this?

JS is a dynamic language with minimal boilerplate (bugs a gogo!)

In a browser context, lives in the DOM, which has an incredibly rich presentation and input API

"F5" = see your result

2012 browsers are rocket powered fire breathing monsters compared to just a few years ago

The DOM's API is constantly being extended with new features

It's ubiquitous - your audience is the world

Approach

  • Sketch ideas on paper
  • Easy to visualise code, and importantly code patterns, as graphics
  • Many, many tricks to get visually appealing stuff going quickly (hue and saturation color models, transparency, trig, random numbers, noise, symmetry)
  • We interpret what our senses are telling us - psychoacoustics in audio, not sure what equivalent is in vision, but same concept - we instinctively look for patterns

Before we go any further..

Everyone in this room is better at maths than me :D

First demo

Let's make hundreds of cubes and animate them!

Second demo

Particles are pretty fun

Can use multiple canvas elements in a page

Let's go crazy

How far can we push this?

Keep it snappy

Threads (in the form of web workers) to the rescue

Using this on devices

Turned an effect into a "polar clock" idea

Device conclusion

No hardware acceleration = forget it

iOS 5+ devices generally the winner (compared to Android 2.1-4.0, webOS) from our limited testing - phones are expensive :(

Interesting tools available for boosting even further canvas performance in iOS packaged apps - Ejecta, from ImpactJS team

Android has a massive variety of devices, very hard to depend on a particular combination for good performance

Thank you for watching, over to Filipe!

HOW TO DEMO

Where to start?

HOW TO DEMO

Demo or die!

You don't actually need to die...

HOW TO DEMO

Code every single day

Even if it's just 15 minutes

HOW TO DEMO

Focus on putting something moving on the screen

Your mega engine will come later

HOW TO DEMO

OOP and Software Design Patterns?

"Fuck that shit!"

"Just KISS it!"

Keep It Simple, Stupid

HOW TO DEMO

1) When in doubt, do a new effect

(the more effects available the better)

(HTML5 cheat sheet is your friend)

HOW TO DEMO

2) Get a soundtrack that brings stuff together

(don't settle for crap sounds, even if your code is crap)

HOW TO DEMO

3) Don't let the coder pick the colorscheme

(god invented graphic designers for a reason, use them)

(if you dont have a graphics designer: 1 2)

HOW TO DEMO

4) Set a realistic deadline and meet it

(Sure you could do the best engine ever, in 5 years)

(Releasing stuff is motivating, use it in your favor)

Filipe's earlier experiments

HTML5 WEBVIEW

Baby Demo @ Stream 2011

Failed Android webview HTML5 benchmark test demo

WEBGL

Blind Serpent @ The Flame Party Helsinki 2011

WebGL remix

PROCESSINGJS

pgen @ Assembly 2011

ProcessingJS generative art slideshow

HTML5 HACKING

shogun neophyte @ LGRU 2011

javascript animation using comic creator tool by kesiev

JS1K

Spreading Love Liebe Amor @ JS1K Love 2012

Cyboman 5

Cyboman 5 4k @ Stream 2012

making of article

Cyboman 5

code some new effects

Cyboman 5

javascript 1k speech synth

http://www.p01.org/releases/JS1K_Speech_Synthesizer/

Cyboman 5

16k original.js

12k UglifyJS min.js

4k PNGinator final.html

Javascript Compression

better then UglifyJS:

crush on js

closure compiler

Javascript Compression

better then PNGinator:

JsExe

Under a Seering Sky

sci-fi web book game

http://enoughrecords.scene.org/uass

making of article

Under a Seering Sky

imposed myself a deadline

(demoparty accepting IF entries in 2 months)

Under a Seering Sky

started writing storyline

(based on unpublished sci fi novel i had written months before)

Under a Seering Sky

re-structured storyline and re-engineered engine

(after chapter 1 was half-way done)

Under a Seering Sky

added audio support (tracks taken from my netlabel)

adapted effects to match project

bothered graphician friends for some graphics

Under a Seering Sky

polished chapter 1

finished chapter 2

beta tested

Under a Seering Sky

polish until deadline

HTML5 on Mobiles

<audio> problems cross-fading

variable resolutions

button drag/tap problems

Parsley State

10k for DemoJS 2012

making of article

Parsley State

code some new effects

Parsley State

soundtrack options:

Parsley State

requestAnimationFrame

Parsley State

off-screen rendering

compositing

Parsley State

problems:

  • off-screen rendering conflicted with audio player
  • pruning converted svg graphics to take less size
  • including ahx file format required base conversion (binhexjs)
  • closure exclude files for audio and canvas (and their hashes)

Parsley State

74k original.js

33k closure.js

10k pnginator.js

Benefits of Parsley

  • Parsley is an excellent breath freshener, eliminating strong mouth odours such as garlic or onion.
  • It cleanses and strengthens the kidney and can even help break up kidney stones.
  • Helps with bladder or urinary tract infections.
  • Parsley aids digestion and promotes a faster elimination of waste materials from the body.
  • It acts as an anti-inflammatory, reducing joint pain and stiffness.

Benefits of Parsley

  • It boosts the immune system and protects against colds and infections.
  • It can help to protect the body against heart disease and cardiovascular disease.
  • Parsley can help with water retention, bloating, indigestion and flatulence.
  • Parsley aids the digestion of proteins and fats.
  • It is helpful in pregnancy and fertility.
  • The calcium and fluorine that is present in parsley can strengthen bones and teeth.

Becoming 1337

sci-fi web book game

http://www.tpolm.org/~ps/becoming_1337/

github

Questions?