linting sketchpad js
by J. Jones
JavaScript
marqueeID = false;
mixin = function(o) { // dojo.mixin
var len = arguments.length;
for(var i = 1; i < len; i++)
for(var j in arguments[i])
o[j] = arguments[i][j];
return o;
};
var dtx2D = document.createElement("canvas");
var ctx2D;
try { ctx2D = dtx2D.getContext('2d'); } catch(e) {}
var data2pattern = function(obj, data) {
// if(dtx2D.parentNode === null) document.body.appendChild(dtx2D);
if(ctx2D === null) ctx2D = dtx2D.getContext('2d');
function createPattern(src, id) {
var image = new Image();
image.onload = function() {
obj[id] = ctx2D.createPattern(image, "repeat");
};
image.src = src;
}
for(var key in data) {
createPattern(data[key], key);
}
};
gui = {
// Options
'options': function () {
var r = [],
fu = N.format;
cF = {
'inner_radius_spirograph': {
type: 'X',
val: [1, 100, 10]
},
'outer_radius_spirograph': {
type: 'X',
val: [1, 100, 10]
},
'diameter_spirograph': {
type: 'X',
val: [1, 500, 10]
},
'speed_spirograph': {
type: 'X',
val: [2, 250, 10]
},
'resolution_spirograph': {
type: 'X',
val: [1, 1000, 10]
},
'stroke_text': {
type: 'X',
val: [0, 20, 2]
},
'fontSize': {
type: 'X',
val: [16, 256, 64]
},
'kerning': {
type: 'X',
val: [0, 2, 1, 'float']
},
'diameter_pencil': {
type: 'X',
val: [1, 15, 10]
},
'opacity_fill': {
type: 'X',
val: [1, 100, 100],
fu: infc.opacity
},
'lineOpacity': {
type: 'X',
val: [2, 100, 1]
},
'sides_shape': {
type: 'X',
val: [2, 100, 1]
},
'slope_shape': {
type: 'X',
val: [0.2, 10, 1, 'float']
},
'sides_marquee': {
type: 'X',
...