Skip to content

Instantly share code, notes, and snippets.

@videlais
videlais / notifications.js
Created December 29, 2013 16:28
Complete Notifications.js
/**
* A Notifications object
*
* http://caniuse.com/notifications
* Currently supported only in Firefox 22+, Chrome 22+, and Safari 6+ (on Mac OSX 10.8+).
*
* Note: requestPermission() MUST be called from a user gesture event in Chrome
* to be valid. It will fail silently otherwise!
*
* Note: Firefox and Safari will close notifications themselves
@videlais
videlais / fullscreen.js
Created December 27, 2013 22:01
Complete Fullscreen.js
/**
* A Fullscreen object
*
* Current support (http://caniuse.com/#feat=fullscreen)
* is limited to Firefox 22+ (moz), Chrome 28+, Safari 6.0+, Opera 16.0+ (webkit),
* and IE11+ (ms)
*
* @property {boolean} supported If fullscreen support exists in the current context
* @property {boolean} isFullscreen If an element is currently fullscreen or not
*/
@videlais
videlais / visibility.js
Created December 27, 2013 15:47
Complete Visibility.js
/**
* A Visibility object using the Page Visibility API with fallback to
* the the 'focus' and 'blur' events.
*
* The result of visibilityState() returns one of the possible following strings:
* "visible" : is visible to the user
* "hidden" : is not visible to the user
* "prerender" : (Limited support) is not visible to the user, but has been loaded in memory
* "unloaded" : (Limited support) the page itself is currently being unloaded from memory
*
@videlais
videlais / vibrate.js
Created December 26, 2013 07:16
Vibrate.js
/**
* A Vibrate object for detecting and using the window.navigator.vibrate
* function.
*
* Code borrows from David Walsh's work
* http://davidwalsh.name/vibration-api
*
* @property {boolean} supported If vibrate is supported in the current context
*/
@videlais
videlais / accelerometer.js
Created December 25, 2013 12:14
Complete Accelerometer.js code
/**
* An accelerometer object for detecting device orientation
* and motion (if supported)
*
* Chrome 7+, Firefox 6+, IE11+, iOS Safari 4.0+, Android Browser 3.0, Blackberry 10.0
* http://caniuse.com/#feat=deviceorientation
*
* The DeviceOrientationEvent.alpha value represents the motion of the device around the z axis,
* represented in degrees with values ranging from 0 to 360.
*
@videlais
videlais / Gamepad.js
Last active July 17, 2021 09:36
Complete Gamepad.js code
/**
* (Note: Depends on window.requestAnimationFrame for polling.)
*
* An experimental Gamepad object for detecting
* and parsing gamepad input.
*
* Current code borrows heavily from Marcin Wichary's work:
* http://www.html5rocks.com/en/tutorials/doodles/gamepad/
*
* Also uses deadzone values from
@videlais
videlais / PlayState.as
Created November 6, 2013 05:32
ActionScript 3 Multi-camera HUD example
package
{
import org.flixel.*;
public class PlayState extends FlxState
{
private var hud:FlxGroup;
private var world:FlxTilemap;
private var player:PlayerSprite;
//
@videlais
videlais / MapGroup.as
Last active December 26, 2015 23:39
ActionScript 3 Example 8 MapGroup Version 2
package
{
/**
* ...
* @author Dan Cox
*/
import org.flixel.*;
public class MapGroup extends FlxGroup
@videlais
videlais / AreaGroup.as
Created October 30, 2013 12:51
ActionScript 3 Example 8 AreaGroup Version 2
package
{
/**
* ...
* @author Dan Cox
*/
import org.flixel.*;
import org.flixel.system.FlxTile;
@videlais
videlais / Assets.as
Created October 30, 2013 03:30
ActionScript 3 Example 8 Assets Version 2
package
{
/**
* ...
* @author Dan Cox
*/
public class Assets
{
[Embed(source="data/houseTiles.png")]
public static var houseTilesPng:Class;