Run operations on collections (we call these straps)
// Manipulate a collection of dom elements
var myCollection = oak.strap("li");
li.css("color", "#FFF");
// Manipulate a collection of objects
var
obj1 = {x: 100, y: 400},
obj2 = {x: 150, y: -20},
obj3 = {x: 400, y: 0};
var myObjCollection = oak.strap(obj1, obj2, obj3);
myObjCollection.set("x", 200);
Extend oak's strappable functions
oak.expose({
dogify: function (strap) {
return strap.each(function (str) {
if (oak.isString(str)) {
str += ", sup dog.";
});
});
}
});
var names = ["Carl", "Justin", "Lindsey"].strap();
names.dogify();
// Outputs "Carl, sup dog."
console.log(names[0]);
Check for supported properties
if (oak.support.cssanimations) {
// Do something
}
Animate using css
oak.animate(myDiv, {
easing: oak.timing.EasInOut,
duartion: 500,
backgroundColor: "#FFF",
transform: "translate3d(100px, 300px, 4000px)",
onComplete: function () {
console.log("complete");
}
});