Sketchy/js/main.js

37 lines
850 B
JavaScript
Raw Normal View History

2014-02-01 18:18:29 +00:00
"use strict";
$(document).ready(function() {
2014-02-02 20:16:28 +00:00
window.c = $('canvas')[0].getContext('2d');
window.o = $('canvas')[1].getContext('2d');
2014-02-01 18:18:29 +00:00
window.settings = {
2014-02-05 13:02:07 +00:00
lineWidth : 2,
color : 'black',
2014-02-01 18:18:29 +00:00
type: 'sketch',
lineCap: 'round',
2014-02-02 20:16:28 +00:00
lineJoin: 'round',
2014-02-05 13:02:07 +00:00
furLength: 5,
connectTelorance: 40
2014-02-01 18:18:29 +00:00
};
window.points = [];
window.$c = $('canvas');
2014-02-02 20:16:28 +00:00
window.points.history = [{ data: c.createImageData($c.width(), $c.height()), points: []}];
2014-02-01 18:18:29 +00:00
sizeAndPos();
$(window).resize(sizeAndPos);
2014-02-05 13:02:07 +00:00
$('.color-picker').change(function() {
var c = $(this).find('.color').val();
settings.color = c;
$('#setcolor span').html(c);
})
$('.color').val('#000000');
yepnope({
test: window.mobile,
yep : ['js/mobile-events.js', 'js/libs/color-picker-touch.js'],
nope: ['js/events.js', 'js/libs/color-picker.js']
})
2014-02-01 18:18:29 +00:00
})