-
Notifications
You must be signed in to change notification settings - Fork 94
/
index.html
499 lines (450 loc) · 22.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VirtualSky</title>
<!--
VirtualSky <canvas> application
(c) 2010 Stuart Lowe (Las Cumbras Observatory Global Telescope)
-->
<style>
body {
font-family: 'Trebuchet MS',Tahoma,Helvetica,Verdana,sans-serif;
color: black;
margin: 0px;
padding: 0px;
}
#bgholder {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
height: 400px;
width: 100%;
}
#bg {
width: 100%;
height: 100%;
}
.content {
max-width:940px;
margin:auto;
position: relative;
padding: 2em;
background-color: white;
margin-top: 100px;
}
#forkme_banner {
background: url("https://slowe.github.io/graph/images/blacktocat.png") no-repeat scroll 95% 50% #0090FF;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
color: #FFFFFF;
display: block;
font-weight: 700;
padding: 10px 50px 10px 10px;
position: absolute;
right: 0px;
top: -100px;
z-index: 10;
text-decoration: none;
}
ol {
margin: 0px;
padding: 0px;
counter-reset: li; /* Initiate a counter */
list-style: none; /* Remove default numbering */
*list-style: decimal; /* Keep using default numbering for IE6/7 */
}
ol li.example:before{
content: "Example " counter(li) ": ";
counter-increment: li;
font-size: 1.5em;
line-height: 2em;
text-align: left;
font-weight: bold;
display: block;
}
li.example { margin-bottom: 4em; }
.planetarium { max-width: 100%; height: 0;}
h2 { margin-top: 3em; padding-top: 3em; border-top: 1px solid #999; }
.hljs { background: #111111; padding: 1em; display:block; overflow-x:auto; margin: 1em auto; background:#111; tab-size: 4; -moz-tab-size: 4; }
.hljs a { color: inherit; }
.hljs, .hljs-subst { color:#fff; }
.hljs-name, .hljs-tag { color: #89bdff; }
.hljs-string { color: #65B042; }
.hljs-meta, .hljs-symbol, .hljs-template-tag, .hljs-template-variable, .hljs-addition { color:#0DBC37; }
.hljs-comment, .hljs-quote {color:#aaa; }
.hljs-number, .hljs-built_in { color: #3387CC; }
.hljs-regexp, .hljs-literal, .hljs-bullet, .hljs-link { color:#31a354; }
.hljs-deletion, .hljs-variable { color:#88f; }
.hljs-selector-tag, .hljs-title, .hljs-section, .hljs-doctag, .hljs-type, .hljs-selector-id, .hljs-selector-class, .hljs-strong { color:#2254F4; }
.hljs-keyword { color: #E28964; }
.hljs-emphasis { font-style:italic; }
.hljs-attribute { color:#D73058; }
.hljs-attr { color: #bdb76b; }
</style>
<script src="extra/highlight.pack.js" type="text/javascript"></script>
</head>
<body>
<div id="bgholder"><div id="bg"></div></div>
<div class="content">
<a id="forkme_banner" href="https://github.com/slowe/VirtualSky">Fork Me on GitHub</a>
<h1>VirtualSky</h1>
<p>VirtualSky a browser-based planetarium that lets you see what is visible in the sky from any location on Earth. It can be <a href="https://slowe.github.io/VirtualSky/custom">customized and included on your own website</a>, blog etc. It is provided freely for educational and non-profit use.</p>
<div id="starmap-splash" class="planetarium" style="width:100%;height:300px;"></div>
<h2>Contents</h2>
<ul>
<li><a href="#new">What's new?</a></li>
<li><a href="#keys">Keyboard shortcuts</a></li>
<li><a href="#instructions">Instructions for embedding</a>
<ul>
<li><a href="#ex1">Example 1</a></li>
<li><a href="#ex2">Example 2</a></li>
<li><a href="#ex3">Example 3</a></li>
<li><a href="#ex4">Example 4</a></li>
<li><a href="#ex5">Example 5</a></li>
<li><a href="#ex6">Example 6</a></li>
<li><a href="#ex7">Example 7</a></li>
<li><a href="#ex8">Example 8</a></li>
<li><a href="#ex9">Example 9</a></li>
<li><a href="#ex10">Example 10</a></li>
</ul>
</li>
<li><a href="#options">Options</a>
<li><a href="#tech">Technical details</a>
</ul>
<h2 id="new">What's new?</h2>
<h3 id="0.7.4">Version 0.7.4 / 15 September 2019</h3>
<p>Changes:</p>
<ul>
<li>Update links</li>
<li>Make sure atmosphere gradient displays on first draw <a href="https://github.com/slowe/VirtualSky/issues/63">#63</a></li>
<li>Improve the size of the keyboard shortcuts</li>
<li>Fix bug with time input</li>
</ul>
<h3 id="0.7.3">Version 0.7.3 / 6 August 2019</h3>
<p>There have been some improvements to the code:</p>
<ul>
<li>Fixed <a href="https://github.com/slowe/VirtualSky/issues/52">issue #52</a> to improve touch move handling</li>
<li>Improved performance of drawing</li>
<li>Fixed part of <a href="https://github.com/slowe/VirtualSky/issues/25">issue #25</a> to get RA/dec of cursor position</li>
</ul>
<h3 id="0.7.0">Version 0.7.0 / 15 October 2018</h3>
<p>There has been a major overhaul to remove the need for jQuery (replaced with <a href="https://slowe.github.io/stuquery/">stuQuery</a>). This has reduced the initial page load from 337kB to 200kB so it should hopefully load more quickly and save bandwidth. Also:</p>
<ul>
<li>Can set the width of gridlines (<code>gridlineswidth=5</code>) <a href="https://github.com/slowe/VirtualSky/issues/46">#46</a></li>
<li>Can set the width of constellation lines (<code>constellationwidth=5</code>)</li>
<li>Can set the width of constellation boundaries (<code>constellationboundarieswidth=5</code>)</li>
<li>Can set the width of the galaxy (<code>galaxywidth=5</code>)</li>
<li>Help screen can be accessed with the mouse</li>
<li>The place-search API was deprecated by Yahoo so the place lookup now uses static files split by starting letter (to keep it quick)</li>
<li>Switched to date/time input fields to make date selection easier with controls native to the browser</li>
<li>Bug fix: manually set constellation boundaries work again. <a href="https://github.com/slowe/VirtualSky/issues/41">#41</a></li>
</ul>
<p>Please <a href="https://github.com/slowe/VirtualSky/issues">report any bugs on Github</a> giving your browser make/version. You can also suggest new features there (although they may not happen for ages or at all as this is an entirely spare time project).</p>
<h2 id="keys">Keyboard shortcuts</h2>
<p>Press the "?" key (with your mouse over VirtualSky) to see the full list of keyboard controls.</p>
<h2 id="instructions">Instructions for embedding</h2>
<p>The <a href="https://slowe.github.io/VirtualSky/custom">easiest way to include VirtualSky</a> on your website is to use the custom form to create an embed link (uses an <code><iframe></code>).</p>
<p>Sometimes an <code><iframe></code> just doesn't give you the flexibility you need (or you might want to include it in an offline page during a public talk). In that case you could download a copy of <a href="https://github.com/slowe/VirtualSky">the source from GitHub</a> and include VirtualSky in your page using Javascript. You will need to include the following in your page:</p>
<div class="example-code">
<!-- Make sure the scripts point to the correct locations for the Javascript files. -->
<script src="stuquery.min.js"></script>
<script src="virtualsky.min.js" type="text/javascript"></script>
<script>
var planetarium;
S(document).ready(function() {
planetarium = S.virtualsky({
id: 'starmap' // This should match the ID used in the DOM
});
});
</script>
<div id="starmap" style="width:400px;height:400px;"></div>
</div>
<script>
S(document).ready(function() {
var vs = S.virtualsky({id:'starmap-splash',projection:'stereo',gridlines_az:true,gridlines_eq:true,constellations:true,live:true,az:90});
// Add version number to title
S('h1').append(' <span style="font-size: 1em;">v'+vs.version+'</span>');
var planetariumbg = S.virtualsky({id:'bg',az:120,gridlines_eq:true,showorbits:true,showstarlabels:true,meteorshowers:true,constellations:true,projection:'stereo',credit:false,showdate:false,showposition:false});
});
</script>
<p>That is a version of VirtualSky with all the default options. However, one of the great things about VirtualSky is that it can be customised. Here are some examples to give you some ideas:</p>
<ol>
<li class="example" id="ex1">A <code>stereo</code> projection set for Santa Barbara's lat/long:
<div class="example-code">
<script>
var planetarium1;
S(document).ready(function() {
var planetarium1 = S.virtualsky({
id: 'starmap1',
projection: 'stereo',
latitude: 34.4326,
longitude: -119.86286
});
});
</script>
<div id="starmap1" style="width:100%;height:500px;"></div>
</div>
</li>
<li class="example" id="ex2">A <code>lambert</code> projection, with constellations shown, no keyboard control and a black-on-white view. It is based in Manchester,UK and facing north:
<div class="example-code">
<script>
var planetarium2;
S(document).ready(function() {
planetarium2 = S.virtualsky({
id: 'starmap2',
projection: 'lambert',
mouse: true,
keyboard: false,
az: 0,
negative: true,
constellations: true,
latitude: 53.5,
longitude: -2.5
});
});
</script>
<div id="starmap2" style="width:500px;height:300px;"></div>
</div>
</li>
<li class="example" id="ex3">A <code>stereo</code> projection with no keyboard or mouse input and with a Galactic grid and the Meridian line displayed. The view is facing south east from Hill Valley, California at 1:21 am on October 25, 1985.
<div class="example-code">
<script>
var planetarium3;
S(document).ready(function() {
planetarium3 = S.virtualsky({
id: 'starmap3',
projection: 'stereo',
keyboard: false,
mouse: false,
az: 135,
meridian: true,
latitude: 38.25,
longitude: -122.6,
clock: new Date("October 25, 1985 01:21:00"),
gridlines_gal: true
});
});
</script>
<div id="starmap3" style="width:650px;height:300px;"></div>
</div>
</li>
<li class="example" id="ex4">A <code>mollweide</code> projection with with star labels drawn and the ground blocking half the sky.
<div class="example-code">
<script>
var planetarium4;
S(document).ready(function() {
planetarium4 = S.virtualsky({
id: 'starmap4',
projection: 'mollweide',
showstarlabels: true,
ground: true
});
});
</script>
<div id="starmap4" style="width:920px;height:460px;"></div>
</div>
</li>
<li class="example" id="ex5">A default view with a <code>stereo</code> projection, constellation lines and two manually specified constellation boundaries (note that RA/Dec for boundaries are assumed to be in B1875).
<div class="example-code">
<script>
var planetarium5;
S(document).ready(function() {
planetarium5 = S.virtualsky({
id: 'starmap5',
az: 225,
projection: 'stereo',
constellations: true,
constellationboundaries: true,
boundaries: [
["And",343,34.5,343,52.5,350,52.5,350,50,353.75,50,353.75,48,2.5,48,2.5,46,13,46,13,48,16.75,48,16.75,50,20.5,50,25,50,25,47,30.625,47,30.625,50.5,37.75,50.5,37.75,36.75,30,36.75,30,35,21.125,35,21.125,33,10.75,33,10.75,23.75,12.75,23.75,12.75,21,2.125,21,2.125,22,1,22,1,28,0,28,0,31.33333,356.25,31.33333,356.25,32.08333,352.5,32.08333,352.5,34.5,343,34.5],
["Ori",69.25,0,69.25,15.5,74.5,15.5,74.5,16,80,16,80,15.5,84,15.5,84,12.5,86.5,12.5,86.5,18,85.5,18,85.5,22.83333,88.25,22.83333,88.25,21.5,93.25,21.5,93.25,17.5,94.625,17.5,94.625,12,94.625,10,93.625,10,93.625,0,93.625,-4,87.5,-4,87.5,-11,76.25,-11,76.25,-4,70,-4,70,0,69.25,0]
],
clock:new Date("July 17, 2013 18:39:00 GMT")
});
});
</script>
<div id="starmap5" style="width:944px;height:400px;"></div>
</div>
</li>
<li class="example" id="ex6">A default view using <code>stereo</code> projection with a place marker
<div class="example-code">
<script>
var planetarium6;
S(document).ready(function() {
planetarium6 = S.virtualsky({
id: 'starmap6',
projection: 'stereo',
clock:new Date("July 17, 2019 18:39:00 GMT")
});
planetarium6.addPointer({
'ra':83.8220792,
'dec':-5.3911111,
'label':'Orion Nebula',
'img':'http://server7.sky-map.org/imgcut?survey=DSS2&w=128&h=128&ra=5.58813861333333&de=-5.3911111&angle=1.25&output=PNG',
'url':'http://simbad.u-strasbg.fr/simbad/sim-id?Ident=M42',
'credit':'Wikisky',
'colour':'rgb(255,220,220)'
})
});
</script>
<div id="starmap6" style="width:944px;height:400px;"></div>
</div>
</li>
<li class="example" id="ex7">A default view using <code>gnomic-tan</code> projection centred on M42
<div class="example-code">
<script>
var planetarium7;
S(document).ready(function() {
planetarium7 = S.virtualsky({
'id': 'starmap7',
'projection': 'gnomic',
'ra': 83.8220833,
'dec': -5.3911111,
'ground': false,
'constellations': true,
'fov': 15
});
});
</script>
<div id="starmap7" style="width:944px;height:400px;"></div>
</div>
</li>
<li class="example" id="ex8">A default view using <code>gnomic-tan</code> projection centred on Orion with a button to move, and a handler for <code>contextmenu</code> (try the right mouse button...)
<div class="example-code">
<script>
var planetarium8;
S(document).ready(function() {
planetarium8 = S.virtualsky({
'id': 'starmap8',
'projection': 'gnomic',
'ra': 83.8220833,
'dec': -5.3911111,
'ground': false,
'constellations': true,
'fov': 15,
'callback': {
'contextmenu': function(e){
console.log('contextmenu callback', e);
if(e.ra && e.dec){
planetarium8.addPointer({
ra: e.ra,
dec: e.dec,
label: "Clicked here",
colour: "#ffffff",
});
planetarium8.draw();
}
},
'click': function(e){
e.nearest = e.data.sky.nearestObject(e.x,e.y);
console.log(e.nearest,e.ra,e.dec);
}
}
});
S('button#pleiades').on('click',function(){ planetarium8.panTo(56.8690917,24.1053111,3000); });
S('button#M82').on('click',function(){ planetarium8.panTo(148.9684583,69.6797028,3000); });
S('button#M1').on('click',function(){ planetarium8.panTo(83.6330833,22.0145000,3000); });
S('button#M42').on('click',function(){ planetarium8.panTo(83.8220833,-5.3911111,3000); });
});
</script>
<div id="starmap8" style="width:944px;height:400px;"></div>
<button id="pleiades">Move to The Pleiades</button>
<button id="M1">Move to M1</button>
<button id="M82">Move to M82</button>
<button id="M42">Move to M42</button>
</div>
</li>
<li class="example" id="ex9">A default view using <code>stereo</code> projection in Arabic
<div class="example-code">
<script>
var planetarium9;
S(document).ready(function() {
planetarium9 = S.virtualsky({
id: 'starmap9',
projection: 'stereo',
lang: 'ar'
});
});
</script>
<div id="starmap9" style="width:944px;height:400px;"></div>
</div>
</li>
<li class="example" id="ex10">A default view using <code>stereo</code> projection showing <code>objects</code> (in this case the Messier catalogue) included from a <a href="messier.json">local JSON file</a>:
<p>If you have multiple files of objects you can separate them with semi-colons e.g. <code>objects: 'messier.json;caldwell.json'</code>.</p>
<div class="example-code">
<script>
var planetarium10;
S(document).ready(function(){
planetarium10 = S.virtualsky({
id: 'starmap10',
projection: 'stereo',
objects: 'messier.json'
});
});
</script>
<div id="starmap10" style="width:944px;height:400px;"></div>
</div>
</li>
</ol>
<h2 id="options">Options</h2>
<p>There are a range of options to try (default values in brackets):</p>
<ul>
<li><code>id</code> ('starmap') - The ID for the HTML element where you want the sky inserted</li>
<li><code>projection</code> ('polar') - The projection type as 'polar', 'stereo', 'lambert', 'ortho', 'equirectangular', 'mollweide', 'planechart' or 'fisheye'</li>
<li><code>width</code> (500) - Set the width of the sky unless you've set the width of the element</li>
<li><code>height</code> (250) - Set the height of the sky unless you've set the height of the element</li>
<li><code>planets</code> - either an object containing an array of planets or a JSON file</li>
<li><code>magnitude</code> (5) - the magnitude limit of displayed stars</li>
<li><code>longitude</code> (53.0) - the longitude of the observer</li>
<li><code>latitude</code> (-2.5) - the latitude of the observer</li>
<li><code>clock</code> (now) - a Javascript Date() object with the starting date/time</li>
<li><code>background</code> ('rgba(0,0,0,0)') - the background colour</li>
<li><code>transparent</code> (false) - make the background transparent</li>
<li><code>color</code> ('rgb(255,255,255)') - the text colour</li>
<li><code>az</code> (180) - an azimuthal offset with 0 = north and 90 = east</li>
<li><code>negative</code> (false) - invert the default colours i.e. to black on white</li>
<li><code>gradient</code> (true) - reduce the brightness of stars near the horizon</li>
<li><code>ground</code> (false) - show/hide the local ground (for full sky projections)</li>
<li><code>keyboard</code> (true) - allow keyboard controls</li>
<li><code>mouse</code> (true) - allow mouse controls</li>
<li><code>cardinalpoints</code> (true) - show/hide the N/E/S/W labels</li>
<li><code>constellations</code> (false) - show/hide the constellation lines</li>
<li><code>constellationlabels</code> (false) - show/hide the constellation labels</li>
<li><code>constellationwidth</code> (0.7) - set the width of the constellations in pixels</li>
<li><code>constellationboundaries</code> (false) - show/hide the constellation boundaries</li>
<li><code>constellationboundarieswidth</code> (0.7) - set the width of the constellation boundaries in pixels</li>
<li><code>meteorshowers</code> (false) - show/hide current meteor shower radiants</li>
<li><code>showplanets</code> (true) - show/hide the planets</li>
<li><code>showplanetlabels</code> (true) - show/hide the planet labels</li>
<li><code>showorbits</code> (false) - show/hide the orbits of the planets</li>
<li><code>showstars</code> (true) - show/hide the stars</li>
<li><code>showstarlabels</code> (false) - show/hide the star labels for the brightest stars</li>
<li><code>scalestars</code> (1) - the factor by which to scale the star sizes</li>
<li><code>showdate</code> (true) - show/hide the date and time</li>
<li><code>showposition</code> (true) - show/hide the latitude and longitude</li>
<li><code>gridlines_az</code> (false) - show/hide the azimuth/elevation grid lines</li>
<li><code>gridlines_eq</code> (false) - show/hide the RA/Dec grid lines</li>
<li><code>gridlines_gal</code> (false) - show/hide the Galactic grid lines</li>
<li><code>gridlineswidth</code> (0.7) - set the width of the gridlines in pixels</li>
<li><code>gridstep</code> (30) - the size of the grid step when showing grid lines</li>
<li><code>ecliptic</code> (false) - show the line of the Ecliptic</li>
<li><code>meridian</code> (false) - show the line of the Meridian</li>
<li><code>showgalaxy</code> (false) - show an outline of the Milky Way</li>
<li><code>galaxywidth</code> (0.7) - set the width of the Milky Way outline in pixels</li>
<li><code>live</code> (false) - update the display in real time</li>
<li><code>fontsize</code> - if, from a design point of view, you need a very specific font size (currently only in pixels), this is how you override the automatic font scaling. e.g. "10px"</li>
<li><code>fontfamily</code> - VirtualSky inherits the font family when it is added to an element on a page but can't when using an iframe. To solve that situation, you can provide a CSS <code>font-family</code> string.</li>
<li><code>lang</code> - VirtualSky will attempt to auto-detect the preferred language of the person's browser but you can specify a language explicitly</li>
<li><code>callback.contextmenu</code> - VirtualSky will invoke the given callback on right click or long press on the map. The event sent to the callback includes the RA,DEC coordinates in the skyPos property, if applicable.</li>
</ul>
<h2 id="tech">Technical details</h2>
<p>Virtual Sky uses the <a href="http://diveintohtml5.org/canvas.html#divingin"><canvas> element</a> - part of the <a href="http://whatwg.org/html5">HTML5 proposal</a> - so should work in most modern browsers such as Firefox (there are issues in Firefox 3.0 on Ubuntu), Opera, Chrome and Safari. It should also work in Internet Explorer 7.0 and 8.0 through the use of the <a href="http://code.google.com/p/explorercanvas/">excanvas.js</a> library. The <a href="https://github.com/slowe/VirtualSky">code can be found on Github</a>.</p>
<h2 id="alt">Alternatives</h2>
<p>There are other browser-based planetaria available online e.g. <a href="http://ivan.ivanych.net/dev/starmap-canvas/">Ivan Boldyrev's Starchartjs</a>, <a href="http://canvas.staratlas.com/">Luther Huffman's StarAtlas</a> and <a href="http://tonightsky.free.fr/all-sky-map/">Thomas Boch's All Sky Map</a>. On the desktop, <a href="http://stellarium.org/">Stellarium</a> is a highly featured planetarium program that works on Windows, Mac and Linux platforms (VirtualSky uses many of the same keyboard shortcuts).</p>
</div>
<script language="javascript" type="text/javascript" src="formatexamples.js"></script>
</body>
</html>