var paper = new Raphael(document.getElementById('my_container'), 200, 200); var C = paper.circle( 40, 50, 20 ).attr({ 'fill': 'red' }) function animateball() { C.animate({ 'cx': 80, 'r': 90, 'fill': 'blue' }, 3000, "bounce" ); }
var paper = new Raphael(document.getElementById('my_container'), 200, 200); var P = paper.path( "M 60,150 L 160,150 L 105,50 Z" ).attr({ 'fill': 'blue' }) function toSquare() { P.animate({ 'path': "M 60,150 L 160,150 L 160,50 L 60,50 Z", 'fill': 'yellow' }, 3000, "linear", toDiamond ); } function toDiamond() { P.animate({ 'transform': "r45" }, 2000, "elastic" ); }
var paper = new Raphael(document.getElementById('my_container'), 200, 200); var s1 = paper.rect(20,20,30,30).attr({ 'fill': 'red', 'stroke-width': 0 }) var s2 = paper.rect(150,20,30,30).attr({ 'fill': 'blue', 'stroke-width': 0 }) var sAnimation = Raphael.animation({ 'width': 80, 'height': 80, 'fill': 'purple', 'x': 60, 'y': 50 }, 4000, "easeInOut") function animateSquares() { s1.animate( sAnimation ); s2.animate( sAnimation ); }
var paper = new Raphael(document.getElementById('my_container'), 200, 200); var R = paper.rect( 50,50,40,40 ).attr({ 'fill': 'red', 'stroke-width': 0 }) var keepRotating = Raphael.animation({ 'transform': 'r360' }, 2000 ).repeat( 'Infinity' ) R.animate( keepRotating )
var paper = new Raphael(document.getElementById('pauseex'), 200, 200); var square3 = paper.rect( 50, 50, 100, 100 ).attr({'fill':'green'}) var square3Anim = Raphael.animation( { 'transform': 'r360'}, 1500 ).repeat('Infinity') function startSquare() { square3.animate( square3Anim ) } function pauseSquare() { square3.pause() }
var paper = new Raphael(document.getElementById('my_container'), 200, 200); var s1 = paper.rect(20,20,30,30).attr({ 'fill': 'red', 'stroke-width': 0 }) var s2 = paper.rect(150,20,30,30).attr({ 'fill': 'blue', 'stroke-width': 0 }) var sAnimation = Raphael.animation({ 'width': 80, 'height': 80, 'fill': 'purple', 'x': 60, 'y': 50 }, 4000, "easeInOut") function animateSquares() { s1.animate( sAnimation ); s2.animate( sAnimation.delay( 1500 ) ); }