mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 17:00:04 +02:00
awesome animation framework now in with promises
This commit is contained in:
parent
39f6353f07
commit
ebaae41a38
5 changed files with 271 additions and 53 deletions
|
@ -8,6 +8,36 @@ var VisBase = Backbone.Model.extend({
|
|||
this.get(key).remove();
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
animateAttrKeys: function(keys, attrObj, speed, easing) {
|
||||
// either we animate a specific subset of keys or all
|
||||
// possible things we could animate
|
||||
keys = _.extend(
|
||||
{},
|
||||
{
|
||||
include: ['circle', 'arrow', 'rect', 'path', 'text'],
|
||||
exclude: []
|
||||
},
|
||||
keys || {}
|
||||
);
|
||||
|
||||
var attr = this.getAttributes();
|
||||
|
||||
// safely insert this attribute into all the keys we want
|
||||
_.each(keys.include, function(key) {
|
||||
attr[key] = _.extend(
|
||||
{},
|
||||
attr[key],
|
||||
attrObj
|
||||
);
|
||||
});
|
||||
|
||||
_.each(keys.exclude, function(key) {
|
||||
delete attr[key];
|
||||
});
|
||||
|
||||
this.animateToAttr(attr, speed, easing);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue