Created
December 23, 2011 03:23
-
-
Save jordanorelli/1513020 to your computer and use it in GitHub Desktop.
a circle appears and disappears
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="static/js/raphael-min.js"></script> | |
<span id="injection" style="display:none;"> </span> | |
<script>(function() { | |
var $injection = $("#injection"); | |
var $messageBody = $injection.parent(); // selects the <span> element that the message is written into. | |
var $username = $messageBody.siblings(".message-username"); | |
$username.html(" "); | |
$injection.remove(); | |
var containerId = 'a' + Math.random().toString(36).substring(2); | |
var containerTemplate = "<div id='{{id}}' style='width: {{width}}; border: {{border}};'> </canvas>"; | |
var containerConfig = { | |
id: containerId, | |
width: '600px', | |
border: 'none' | |
}; | |
var containerSrc = Mustache.to_html(containerTemplate, containerConfig); | |
$messageBody.append(containerSrc); | |
var paper = new Raphael(containerId, 600, 200); | |
paper.circle(120, 120, 40).animate({fill: "#223fa3", stroke: "#000", "stroke-width": 60, "stroke-opacity": 0.5}, 2000); | |
setTimeout(function(){ | |
var $container = $('#'+containerId); | |
$container.animate({opacity: 0.0}, 1000, function() { | |
$messageBody.parent().animate({height: 0.0}, 1000, function() { | |
$messageBody.parent().remove(); | |
}); | |
}); | |
}, 3000); | |
})();</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment