I would like Dojo to pass in some properties to "start" and "end" that allow me to access the node.
Currently I'm doing:
dojo.animateProperty({
node: "msgBox",
properties: {
height: {
end: function() { dojo.byId("msgBox").scrollHeight; }
}
}
}).play();
node: "msgBox",
properties: {
height: {
end: function() { dojo.byId("msgBox").scrollHeight; }
}
}
}).play();
I want to do:
dojo.animateProperty({
node: "msgBox",
properties: {
height: {
end: function(node) { node.scrollHeight; }
}
}
}).play();
node: "msgBox",
properties: {
height: {
end: function(node) { node.scrollHeight; }
}
}
}).play();
And another question, do you think it would be useful to be able to animate the "clip" property?

how about:
var n = dojo.byId("msgBox"); dojo.animateProperty({ node:n, properties:{ height: { end:function(){ return n.scrollHeight; } } } });just as soon as animateProperty passes the node, someone else will want the properties of the animation passed all together :)
You can look in dojo/fx.js and dojox/fx/_base.js for example of how to generically reuse the node from within a scope like that more or less magically, and is a technique used in most dojo fx.
Storing the node in a
Storing the node in a variable would work, but I thought, since the purpose of properties.start() and properties.end() is to calculate how much to animate a node by, more often than not this requires access to the node, and therefore it would be reasonable for a node reference to be passed in, instead of requiring developers to manually store it.
but what If i want a
but what If i want a different node? Say I want my height: { end: to look something like: (animate a node position:absolute to the top edge of the node beneath it)
var other = dojo.byId("bottom"); dojo.animateProperty({ node: "top", properties: { height: { end: function(){ return dojo.coords(other).t; } } } }).play();My point is its impossible to assume what a given user would want passed to the functions. The hook is there for you to use, in normal JS manner. No magic happening. If we add magic, it a) will most likely go unused by the rest of the variable using population, and b) add just a tiny piece of bloat to something that otherwise has a solution should you need the functionality (and it seems like you do).
passing the animated node seems entirely reasonable...
the most common case is when you want to calculate something about the node in question and not have it be subject to the vagaries of timing and intermediate node manipulation. In that case (which is common) passing the node seems entirely reasonable. Lets get an enhancement bug filed for it.
Regards
okay, while we're at it can
okay, while we're at it can we add this:
dojo.anim(n,{ end: "+=100" });
-= too :)
I'll file both. :)