Skip to content

Instantly share code, notes, and snippets.

@gjcourt
Created July 28, 2011 21:39
Show Gist options
  • Save gjcourt/1112643 to your computer and use it in GitHub Desktop.
Save gjcourt/1112643 to your computer and use it in GitHub Desktop.
this.decay = function(feat, time, callback) {
var steps = 100;
var ts = time / steps;
for (var i = 0; i < steps; ++i) {
var opacity = 1 - ((i / steps)*.5);
(function(i, opacity){setTimeout(function() {
feat.style.fillOpacity = opacity;
feat.style.pointRadius = 4 * opacity;
commentsLayer.drawFeature(feat);
if (i == steps - 1) {
callback(feat);
}
}, i * ts)})(i, opacity);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment