Permalink
Browse files

clarification about css animations

  • Loading branch information...
1 parent 9d83452 commit 2eff8a7eb4259fd17037093092406f761cc76422 @bmcmahen committed Mar 18, 2013
Showing with 12 additions and 15 deletions.
  1. +2 −0 Readme.md
  2. +10 −15 dist/app.js
View
@@ -112,6 +112,8 @@ Renders (or rerenders) the collection into the specified wrapper element.
## CSS for animations
+The following CSS will provide animations for opacity and positions. You can also choose to animate the `width` and `height` attributes if you're using the dynamic layout mode, but this will signficantly reduce performance in some browsers.
+
.cast-item {
position: absolute;
opacity: 1;
View
@@ -700,7 +700,7 @@ Cast.prototype.reset = function(attr, fn){
Cast.prototype.add = function(attr, fn){
if (type(attr) !== 'array') attr = [attr];
- for (var i = 0, len = attr.length; i < len; i++){
+ for (var i = 0; i < attr.length; i++){
var key = fn ? fn(attr[i]) : this.uniqueId('c');
var val = new Block(attr[i], this);
this.collection.set(key, val);
@@ -785,7 +785,12 @@ Cast.prototype.center = function(options){
, left = mx + (c * (w + pw))
, top = (r * h) + (r + 1) * ph;
- model.set({ 'left': left, 'top': top, 'width': w, 'height': h });
+ model.set({
+ 'left': left,
+ 'top': top,
+ 'width': w,
+ 'height': h
+ });
});
var t = this.collection.length();
var wrapperHeight = Math.ceil(t / bpr) * (h + ph) + ph;
@@ -831,10 +836,6 @@ Cast.prototype.dynamic = function(options){
return this;
};
-Cast.prototype.determineHeight = function(){
-//return (Math.ceil(totalNumber / bpr)) * (boxHeight * paddingHeight);
-};
-
Cast.prototype.sortBy = function(field, invert){
invert = invert || 1;
this.collection.sort(function(left, right){
@@ -865,8 +866,7 @@ Cast.prototype.draw = function(options){
// Constructor
var Block = function(attributes, context){
this.context = context;
- this.attributes = {};
- this.attributes.hidden = true;
+ this.attributes = { hidden: true };
if (attributes) this.set(attributes);
};
@@ -876,17 +876,12 @@ Emitter(Block.prototype);
Block.prototype.set = function(attr){
var changed = false;
if (!attr) return;
- if (this.attributes)
- this.previousAttributes = clone(this.attributes);
+ this.previousAttributes = clone(this.attributes);
for (var key in attr) {
if (attr.hasOwnProperty(key)) {
this.attributes[key] = attr[key];
- if (this.previousAttributes) {
- if (this.attributes[key] !== this.previousAttributes[key]){
- changed = true;
- }
- } else {
+ if (this.attributes[key] !== this.previousAttributes[key]){
changed = true;
}
}

0 comments on commit 2eff8a7

Please sign in to comment.