Permalink
Browse files

Add starter template

  • Loading branch information...
koenbok committed Dec 26, 2012
1 parent 3c2d257 commit 0c647944f3cdb1d652225d9510df6ca5601a670a
Showing with 2,037 additions and 16 deletions.
  1. +105 −16 build/framer.js
  2. +20 −0 template/app.js
  3. BIN template/checker-pattern.png
  4. +1,876 −0 template/framer.js
  5. +36 −0 template/index.html
@@ -416,7 +416,8 @@ require.define("/css.coffee",function(require,module,exports,__dirname,__filenam
});
require.define("/utils.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__slice = [].slice;
Function.prototype.define = function(prop, desc) {
Object.defineProperty(this.prototype, prop, desc);
@@ -508,6 +509,16 @@ require.define("/utils.coffee",function(require,module,exports,__dirname,__filen
return timer;
};
exports.interval = function(time, f) {
var timer, _ref;
timer = setInterval(f, time);
if ((_ref = window._delayIntervals) == null) {
window._delayIntervals = [];
}
window._delayIntervals.push(timer);
return timer;
};
exports.remove = function(a, e) {
var t;
if ((t = a.indexOf(e)) > -1) {
@@ -516,6 +527,80 @@ require.define("/utils.coffee",function(require,module,exports,__dirname,__filen
return a;
};
exports.debounce = function(func, threshold, execAsap) {
var timeout;
timeout = null;
return function() {
var args, delayed, obj;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
obj = this;
delayed = function() {
if (!execAsap) {
func.apply(obj, args);
}
return timeout = null;
};
if (timeout) {
clearTimeout(timeout);
} else if (execAsap) {
func.apply(obj, args);
}
return timeout = setTimeout(delayed, threshold || 100);
};
};
exports.throttle = function(fn, delay) {
var timer;
if (delay === 0) {
return fn;
}
timer = false;
return function() {
if (timer) {
return;
}
timer = true;
if (delay !== -1) {
setTimeout((function() {
return timer = false;
}), delay);
}
return fn.apply(null, arguments);
};
};
exports.max = function(obj) {
var max, n, _i, _len;
for (_i = 0, _len = obj.length; _i < _len; _i++) {
n = obj[_i];
if (!max || n > max) {
max = n;
}
}
return max;
};
exports.min = function(obj) {
var min, n, _i, _len;
for (_i = 0, _len = obj.length; _i < _len; _i++) {
n = obj[_i];
if (!min || n < min) {
min = n;
}
}
return min;
};
exports.sum = function(a) {
if (a.length > 0) {
return a.reduce(function(x, y) {
return x + y;
});
} else {
return 0;
}
};
}).call(this);
});
@@ -937,19 +1022,19 @@ require.define("/primitives/frame.coffee",function(require,module,exports,__dirn
return p;
},
set: function(args) {
var key, value, _ref, _ref1, _ref2, _results;
var key, value, _ref, _ref1, _ref2, _ref3, _results;
_ref = Frame.Properties;
for (key in _ref) {
value = _ref[key];
if (args[key]) {
if ((_ref1 = args[key]) !== null && _ref1 !== (void 0)) {
this[key] = args[key];
}
}
_ref1 = Frame.CalculatedProperties;
_ref2 = Frame.CalculatedProperties;
_results = [];
for (key in _ref1) {
value = _ref1[key];
if ((_ref2 = args[key]) !== null && _ref2 !== (void 0)) {
for (key in _ref2) {
value = _ref2[key];
if ((_ref3 = args[key]) !== null && _ref3 !== (void 0)) {
_results.push(this[key] = args[key]);
} else {
_results.push(void 0);
@@ -1602,37 +1687,37 @@ require.define("/views/scrollview.coffee",function(require,module,exports,__dirn
});
ScrollView.prototype.scrollToTop = function() {
return this.layer.element.scrollTop = 0;
return this._element.scrollTop = 0;
};
ScrollView.prototype.scrollToBottom = function() {
var _this = this;
return setTimeout(function() {
return _this.scrollPoint = _this.layer.element.scrollHeight - _this.frame.height;
return _this.scrollPoint = _this._element.scrollHeight - _this.frame.height;
}, 0);
};
ScrollView.define("scrollPoint", {
get: function() {
return this.layer.element.scrollTop;
return this._element.scrollTop;
},
set: function(value) {
return this.layer.element.scrollTop = value;
return this._element.scrollTop = value;
}
});
ScrollView.define("scrollFrame", {
get: function() {
return new Frame({
x: this.layer.element.scrollLeft,
y: this.layer.element.scrollTop,
x: this._element.scrollLeft,
y: this._element.scrollTop,
width: this.width,
height: this.height
});
},
set: function(frame) {
this.layer.element.scrollLeft = frame.x;
return this.layer.element.scrollTop = frame.y;
this._element.scrollLeft = frame.x;
return this._element.scrollTop = frame.y;
}
});
@@ -1704,7 +1789,7 @@ require.define("/views/imageview.coffee",function(require,module,exports,__dirna
});
require.define("/init.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
var Animation, Frame, Global, ImageView, ScrollView, View, ViewList, k, toggler, utils, v;
var Animation, Frame, Global, ImageView, ScrollView, Spring, View, ViewList, k, toggler, utils, v;
require("./css");
@@ -1722,6 +1807,8 @@ require.define("/init.coffee",function(require,module,exports,__dirname,__filena
Frame = require("./primitives/frame").Frame;
Spring = require("./primitives/spring").Spring;
Global = {};
Global.View = View;
@@ -1734,6 +1821,8 @@ require.define("/init.coffee",function(require,module,exports,__dirname,__filena
Global.Frame = Frame;
Global.Spring = Spring;
Global.utils = utils;
Global.ViewList = ViewList;
@@ -0,0 +1,20 @@
view = new View({
x:100, y:100,
width:200, height:200
});
view.style = {
textAlign: "center",
lineHeight: view.height + "px",
backgroundColor: "rgba(255,0,0,0.5)"
};
view.html = "Hello";
view.on("click", function() {
view.scale = 0.8;
view.animate({
properties: {scale:1},
curve: "spring(100,15,1000)"
});
});
Binary file not shown.
Oops, something went wrong.

0 comments on commit 0c64794

Please sign in to comment.