Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JavaScript Document
- window.onload= function(){
- var paper = new Raphael(0,0, 1250, 450);
- var background = paper.image("space.jpg", 0, 0, 1600, 450);
- function sun_enter(){
- var sun = paper.ellipse(0, 227.883, 100, 100);
- sun.attr({fill: "yellow"});
- sun.animate({cx: 140},50, mercury_enter);
- }
- sun_enter(); //call to the sun enter function
- function mercury_enter(){
- var mercury = paper.ellipse(-100, 235.971, 20, 20);
- mercury.attr({fill: "grey"});
- mercury.animate({cx: 290.588},50);
- venus_enter();
- }
- function venus_enter(){
- var venus = paper.ellipse(-100, 244.795, 30, 30);
- venus.attr({fill: "#D1B279"});
- var venus_anim = Raphael.animation({transform: ['t', 493.118,0 ]},50);
- venus.animate(venus_anim.delay(300));
- earth_enter();
- }
- function earth_enter(){
- var earth = paper.ellipse(-100, 256.588, 35, 35);
- earth.attr({fill: "45-green-blue"});
- var earth_anim = Raphael.animation({transform: ['t', 590.882,0 ]},50);
- earth.animate(earth_anim.delay(300));
- mars_enter();
- }
- function mars_enter(){
- var mars = paper.ellipse(-100, 251.412, 25, 25);
- mars.attr({fill: "75-brown-orange"});
- var mars_anim = Raphael.animation({transform: ['t', 670.471,0 ]},50);
- mars.animate(mars_anim.delay(600));
- saturn_enter();
- }
- function saturn_enter(){
- var saturn = paper.ellipse(-100, 291.485, 45, 45);
- saturn.attr({fill: "#CFC192"});
- var saturn_anim = Raphael.animation({transform: ['t', 766.647,0 ]},50);
- saturn.animate(saturn_anim.delay(600));
- jupiter_enter();
- }
- function jupiter_enter(){
- var jupiter = paper.ellipse(-100, 259.529, 29, 29);
- jupiter.attr({fill: "blue"});
- var jupiter_anim = Raphael.animation({transform: ['t', 890.882,0 ]},50);
- jupiter.animate(jupiter_anim.delay(1000));
- uranus_enter();
- }
- function uranus_enter(){
- var uranus = paper.ellipse(-100, 279.735, 23, 23);
- uranus.attr({fill: "#CFC192"});
- var uranus_anim = Raphael.animation({transform: ['t', 953.412,0 ]},50);
- uranus.animate(uranus_anim.delay(1000));
- neptune_enter();
- }
- function neptune_enter(){
- var neptune = paper.ellipse(-100, 291.485, 35, 35);
- neptune.attr({fill: "blue"});
- var neptune_anim = Raphael.animation({transform: ['t', 1089.441,0 ]},50);
- neptune.animate(neptune_anim.delay(1350));
- pluto_enter();
- }
- function pluto_enter(){
- var pluto = paper.ellipse(-100, 273.117, 13, 13);
- pluto.attr({fill: "grey"});
- var pluto_anim = Raphael.animation({transform: ['t', 1170.441,0 ]},50);
- pluto.animate(pluto_anim.delay(1350));
- sun_enter();
- }
- function sun_random(){
- var sun_anim = Raphael.animation({cx: 400},600);
- sun.animate(sun_anim.delay(1800));
- var sun_anim2 = Raphael.animation({cy: 250},500);
- sun.animate(sun_anim2.delay(2400));
- }
- function mercury_move(){
- mercury.animate({cx: 400, cy: 50 },600);
- }
- function planets_random(){
- sun_random();
- mercury_random();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement