Top Banner
25

Abusing JavaScript for fun and profit

Oct 18, 2014

Download

Economy & Finance

In this talk I outline some of the cool things you can do with JavaScript - including writing a old skool 2d side scrolling platformer!
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Abusing JavaScript for fun and profit
Page 2: Abusing JavaScript for fun and profit

What I do

www.madpilot.com.au www.88miles.net

Page 3: Abusing JavaScript for fun and profit

JavaScript: A brief history

Page 4: Abusing JavaScript for fun and profit

Developed by Brendan Eich

Mocha: A brief history

Page 5: Abusing JavaScript for fun and profit

Developed by Brendan EichAt Netscape

LiveScript: A brief history

Page 6: Abusing JavaScript for fun and profit

Developed by Brendan EichAt Netscape

Around the time Java was added

JavaScript: A brief history

Page 7: Abusing JavaScript for fun and profit

Developed by Brendan EichAt Netscape

Around the time Java was addedWas implented in IE 3.0

JScript: A brief history

Page 8: Abusing JavaScript for fun and profit

Developed by Brendan EichAt Netscape

Around the time Java was addedWas implented in IE 3.0

Became an official ECMA standard

ECMAScript: A brief history

Page 9: Abusing JavaScript for fun and profit

MouseoversStatus bars

Annoying PopupsGet’s a bad name

JavaScript in the 90s

90’s 2000 2002 2004 2006 Today

Page 10: Abusing JavaScript for fun and profit

Microsoft invents XMLRequest

Make server requestswithout refreshing

AJAX

90’s 2000 2002 2004 2006 Today

Page 11: Abusing JavaScript for fun and profit

Move stuff aroundDynamic Menus

Show/hide elements

DHTML and the DOM

90’s 2000 2002 2004 2006 Today

Page 12: Abusing JavaScript for fun and profit

Three browsers – three technologiesCreate vector graphicsThink outside the box

Canvas/SVG/VML

90’s 2000 2002 2004 2006 Today

Page 13: Abusing JavaScript for fun and profit

Separate JS from the HTMLCreates Business Logic layer

Unobstrusive JavaScript

90’s 2000 2002 2004 2006 Today

Page 14: Abusing JavaScript for fun and profit

User interface widgetsFrameworks a go-go

Closer to desktop appsCool Experiments

We ♥ JavaScript

90’s 2000 2002 2004 2006 Today

Page 15: Abusing JavaScript for fun and profit

How far can HTML CSS and JavaScript be pushed?

Pretty far actually…

We are losing interest…

Page 16: Abusing JavaScript for fun and profit

Make it think it is an 8-bit video console

Fool your browser

Page 17: Abusing JavaScript for fun and profit

Prototype JavaScript LibraryXHTML + CSS + Unobtrusive JS

DOM manipulationJS Events

Our tools

Page 18: Abusing JavaScript for fun and profit

JavaScript supports classes

Almost supports inheritance

Create sprite classes

Oh, so classy

Page 19: Abusing JavaScript for fun and profit

Need to create animation loopsetInterval(interval, function);

Check collisionsRender animations

JS isn’t threaded!

Using timers

Page 20: Abusing JavaScript for fun and profit

Pointless without User InputEvent.observe(element, event, handler);

Listen to keypress, window loadCreate some pseudo events

Input Events

Page 21: Abusing JavaScript for fun and profit

An old game techniqueMove background image

…then mask

el.style.backgroundPosition = '0px 0px';

Animation strips

Page 22: Abusing JavaScript for fun and profit

Basic squareUses vectors

Check distanceAnd direction

Collision Detection

Page 23: Abusing JavaScript for fun and profit

Fixed view pointMove the background

Capture arrow events (ignore)Move character – background scrolls

Sideways scrolling

Page 25: Abusing JavaScript for fun and profit

ENDE.