Trái đất quay quanh mặt trời :-)
October 21st, 2008
Chịu thua! Hổng biết làm sao để viết code nữa
Ai muốn thử thì cứ thử nhe. Code ở đây nè!
Sun/Earth/Moon simulation
1 // remove all innerHTML ops to make it work in older Geckos
2 example3 = function() {
3 var year = 2005;
4
5 // show earth/moon
6 $('earth').style.display = 'block';
7 $('moon').style.display = 'block';
8
9 var earth = new Run({
10 elements: 'earth',
11 style: {
12 // use Run.SINUS/COSINUS for circular motion
13 left: ['0px','280px',Run.SINUS],
14 top: ['0px','280px',Run.COSINUS]
15 },
16 onfirst: function() {
17 // count years
18 $('year').innerHTML = 'Year: '+year++;
19 },
20 time:15,
21
22 // repeat infinite
23 iterations:0
24 });
25
26 var moon = new Run({
27 elements: 'moon',
28 style: {
29 left: ['0px','95px',Run.SINUS],
30 top: ['0px','95px',Run.COSINUS]
31 },
32 time:1.5,
33 iterations:0
34 });
35 };
Javascript, Lập trình web http://aka-fotos.de/run/examples.php
Ðược xem 1011 lần, 1 hôm nay
Bài viết liên quan
Nhận xét (0)
Trackbacks (0)
Nhận xét
Trackback