0.3.0 • Published 12 years ago
voxel-share v0.3.0
voxel-share
Take a snapshot in voxel.js and share on imgur.com/twitter.com.
Props to imgur.com for enabling CORS and accepting base64 image uploads via the browser. :D
usage
Create a share tool:
var share = require('voxel-share')({
// pass a copy of the game
game: game,
// api key from http://imgur.com/register/api_anon
key: 'abcd1234',
// specify a message to set as caption/tweet
message: 'Greetings from voxel.js! @voxeljs',
// type of image: image/png or image/jpg
type: 'image/png',
// quality of image. between 0 and 1
quality: 0.75
});
Then upon desired event, open/close the share dialog:
window.addEventListener('keyup', function(e) {
// on enter, open dialog
if (e.keyCode === 13) share.open();
// on esc, close dialog
if (e.keyCode === 27) share.close();
});
Check the example for a more in-depth usage.
install
With npm do:
npm install voxel-share
Use browserify to require('voxel-share')
.
release history
- 0.1.0 - initial release
license
Copyright (c) 2013 Kyle Robinson Young Licensed under the MIT license.