Each Wish makes a FoF W0rld discovery chain

This commit is contained in:
fred 2023-03-19 15:11:43 +01:00
parent 192763dc80
commit 0ecd9ee77b
6 changed files with 95 additions and 236 deletions

View File

@ -129,7 +129,7 @@ echo ">>> ${QRCODE} g1_to_ipfs $ASTROTOIPFS"
###########################################""
MYPLAYERKEY=$(grep ${QRCODE} ~/.zen/game/players/*/secret.dunikey | cut -d ':' -f 1)
[[ ! $MYPLAYERKEY ]] && MYPLAYERKEY="$HOME/.zen/game/players/.current/secret.dunikey"
echo "SELECTES KEY : $(cat MYPLAYERKEY)"
echo "SELECTED KEY : $(cat MYPLAYERKEY)"
echo
## PARRAIN ID EXTRACTION
@ -143,16 +143,17 @@ echo "CURRENT PLAYER : $CURCOINS G1"
## WALLET JAMAIS SERVI
###########################################
if [[ $CURCOINS == "null" ]]; then
echo "NULL"
echo "NULL. PLEASE CHARGE. REDIRECT TO WSTATION HOME"
sed "s~_TWLINK_~$(cat ~/.zen/WSTATION)~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect
echo "url='"${myIPFSGW}$(cat ~/.zen/WSTATION)"'" >> ~/.zen/tmp/${MOATS}/index.redirect
(
cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
echo "BLURP $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
) &
exit 0
fi
# MOA
# DETECT WALLET EVOLUTION
###########################################
if [[ ${CURG1} == ${QRCODE} ]]; then
@ -162,7 +163,7 @@ else
# PAS MOA
###########################################
## GET VISITOR G1 WANNET AMOUNT : VISITORCOINS
echo "${MY_PATH}/../tools/jaklis/jaklis.py balance -p ${QRCODE}"
echo "COINScheck : ${MY_PATH}/../tools/jaklis/jaklis.py balance -p ${QRCODE}"
VISITORCOINS=$(~/.zen/Astroport.ONE/tools/COINScheck.sh ${QRCODE} | tail -f 1)
## PALPE COMBIEN ?
@ -179,13 +180,13 @@ else
[[ ! -s ~/.zen/tmp/coucou/${QRCODE}.g1history.json ]] \
&& ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 $MY_PATH/../tools/jaklis/jaklis.py history -p ${QRCODE} -j > ~/.zen/tmp/coucou/${QRCODE}.g1history.json &
## SCAN CCHANGE +
## SCAN GCHANGE +
[[ ! -s ~/.zen/tmp/coucou/${QRCODE}.gchange.json ]] \
&& ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 curl -s ${myDATA}/user/profile/${QRCODE} > ~/.zen/tmp/coucou/${QRCODE}.gchange.json &
GFOUND=$(cat ~/.zen/tmp/coucou/${QRCODE}.gchange.json | jq -r '.found')
[[ $GFOUND == "false" ]] \
&& echo "AUCUN GCHANGE" \
&& echo "G1BILLET. NO GCHANGE YET. REDIRECT" \
&& sed "s~_TWLINK_~${myGCHANGE}~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect \
&& echo "url='"${myGCHANGE}"'" >> ~/.zen/tmp/${MOATS}/index.redirect \
&& ( cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1) &
@ -240,9 +241,9 @@ else
## MESSAGE CESIUM +
$MY_PATH/../tools/jaklis/jaklis.py -n $myCESIUM -k $MYPLAYERKEY send -d "${QRCODE}" -t "CADEAU" \
-m "ASTRO:${CURPLAYER} VOUS ENVOI ${PALPE} JUNE.
GAGNEZ PLUS DE JUNE... RELIEZ CE PORTEFEUILLE Cesium SUR https://gchange.fr \
PUIS REVENEZ SCANNER VOTRE QRCODE"
-m "ASTRO:${CURPLAYER} A ENVOYE ${PALPE} JUNE.
GAGNEZ PLUS DE JUNE... INSCRIVEZ VOUS SUR GCHANGE https://gchange.fr \
PUIS SCANNEZ VOTRE QRCODE SUR UNE STATION ASTROPORT"
fi
@ -333,6 +334,7 @@ if [[ $AND == "url" ]]; then
' > ~/.zen/tmp/${WHAT}.${MOATS}.import.json
## TODO ASTROBOT "G1AstroAPI" READS ~/.zen/tmp/${WHAT}.${MOATS}.import.json
## INSERT IN TW
(echo "$HTTPCORS OK - ~/.zen/tmp/${WHAT}.${MOATS}.import.json WORKS IF YOU MAKE THE WISH voeu 'AstroAPI'" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 0

View File

@ -110,26 +110,68 @@ do
## Search in Local World (NB! G1Voeu TW copied by Connect_PLAYER_To_Gchange.sh)
FINDEX=($( ls $HOME/.zen/game/players/${PLAYER}/FRIENDS/*/index.html))
## PREPARE Ŋ1 WORLD MAP
echo "var examples = {};
examples['locations'] = function() {
var locations = {" > ~/.zen/tmp/world.js
floop=1
for FRIENDTW in ${FINDEX[@]};
do
[[ ! -s $FRIENDTW ]] && echo "$FRIENDTW VIDE (AMI SANS TW)" && continue
[[ ! -s $FRIENDTW ]] && echo "$FRIENDTW VIDE (AMI SANS TW)" && ((floop++)) && continue
APLAYER=$(ls $FRIENDTW | cut -d '/' -f 7)
rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${APLAYER}.tiddlers.json ## CLEANING OLD FORMAT (TODO REMOVE)
rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.json
echo "TRY EXPORT [tag[G1${WISHNAME}]] FROM $FRIENDTW"
tiddlywiki --load $FRIENDTW \
--output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME} --render '.' _${APLAYER}'.tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]]'
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.json ]] && echo "NO ${WISHNAME} - CONTINUE -" && continue
[[ $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.json) == "[]" ]] && echo "EMPTY ${WISHNAME} - CONTINUE -" && continue
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.json ]] && echo "NO ${WISHNAME} - CONTINUE -" && ((floop++)) && continue
[[ $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.json) == "[]" ]] && echo "EMPTY ${WISHNAME} - CONTINUE -" && ((floop++)) && continue
echo "## TIDDLERS FOUND ;) MIAM >>> (◕‿‿◕) <<<"
echo ">>> G1FRIEND § $myIPFS/$VOEUNS/_${APLAYER}.tiddlers.json ${WISHNAME}"
tiddlywiki --load ${FRIENDTW} --output ~/.zen/tmp --render '.' "${APLAYER}.${WISHNAME}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${WISHNAME}"
WISHNS=$(cat ~/.zen/tmp/${APLAYER}.${WISHNAME}.json | jq -r '.[].wishns')
echo ">>> ${myIPFS}${WISHNS}"
[[ $floop == ${#FINDEX[@]} ]] && virgule="" || virgule=","
echo "
${APLAYER}: {
alpha: Math.random() * 2 * Math.PI,
delta: Math.random() * 2 * Math.PI,
name: '"${WISNAME} ${APLAYER}"',
link: '"${myIPFS}${WISHNS}"'
}$virgule
" >> ~/.zen/tmp/world.js
((floop++))
done
##################################
## TODO JOIN WITH FRIENDS JSONS
## FINISH LOCATIONS
echo"};
$('#sphere').earth3d({
locationsElement: $('#locations'),
dragElement: $('#locations'),
locations: locations
});
};
$(document).ready(function() {
selectExample('locations');
$('#example').change(function() {
selectExample($(this).val());
});
});
" >> ~/.zen/tmp/world.js
cat ~/.zen/tmp/world.js
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
echo "CREATING /ipfs/${IAMAP}/world.js"
##################################
## MAKE MY OWN JSON
################################## MOA MAINTENANT
echo ">>> EXPORT [tag[G1${WISHNAME}]!tag[G1Voeu]] § $myIPFSGW$VOEUNS/_${PLAYER}.tiddlers.json"
tiddlywiki --load $INDEX \
@ -141,8 +183,11 @@ do
echo
# echo "DEBUG : s~_LIBRA_~$(myIpfsGw)~g s~_G1VOEU_~${WISHNAME}~g s~_PLAYER_~${PLAYER}~g s~_VOEUNS_~${VOEUNS}~g s~_ASTRONAUTENS_~${ASTRONAUTENS}~g"
echo
##################################
## INSERT PLAYER G1 QRCODE : QRG1avatar.png
#~ [[ ! -s ~/.zen/game/players/${PLAYER}/QRG1avatar.dir.ipfs ]] # REACTIVATE .?
ipfs add -qrw ~/.zen/game/players/${PLAYER}/QRG1avatar.png | tail -n 1 > ~/.zen/game/players/${PLAYER}/QRG1avatar.dir.ipfs
ipfs add -qw ~/.zen/game/players/${PLAYER}/QRG1avatar.png | tail -n 1 > ~/.zen/game/players/${PLAYER}/QRG1avatar.dir.ipfs
QRLINK=$(cat ~/.zen/game/players/${PLAYER}/QRG1avatar.dir.ipfs)
##################################
@ -151,6 +196,7 @@ do
-e "s~_G1VOEU_~${WISHNAME}~g" \
-e "s~_PLAYER_~${PLAYER}~g" \
-e "s~_VOEUNS_~${VOEUNS}~g" \
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
-e "s~QmWUpjGFuF7NhpXgkrCmx8Tbu4xjcFpKhE7Bsvt6HeKYxu/g1ticket_qrcode.png~${QRLINK}/QRG1avatar.png~g" \
-e "s~http://127.0.0.1:8080~${myIPFS}~g" \
@ -169,7 +215,7 @@ do
echo ">>> $VOEUKEY : Ŋ1 FLUX $(myIpfsGw)${VOEUNS}"
echo "~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}"
mv -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/* ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/
cp -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/* ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/
done < ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt

View File

@ -142,7 +142,7 @@ echo '[
"story": "'/ipfs/${IPFSROOT}'",
"size": "'${FILE_BSIZE}'",
"ipfs": "'/ipfs/${IPFSID}/output.mp4'",
"gif_ipfs": "'/ipfs/${ANIMH}'",
"gifanime": "'/ipfs/${ANIMH}'",
"player": "'${PLAYER}'",
"tags": "'${PLAYER} G1Vlog vlog ipfs'",
"modified": "'${MOATS}'"

View File

@ -181,7 +181,7 @@ a {
</script>
<button id="ainfo" onclick="javascript:var x = document.getElementById('yellow'); if (x.style.visibility === 'hidden') {x.style.visibility = 'visible';} else {x.style.visibility = 'hidden';}">0/1</button>
<div id="yellow" >Menu
<iframe id="aframe" src="_STATION_" width="100%" height="300px"></iframe>
<iframe name="aframe" id="aframe" src="_STATION_" width="100%" height="300px"></iframe>
</div>
<script>

View File

@ -4,24 +4,25 @@
<head>
<title>_PLAYER_ : _G1VOEU_ : http://astroport.localhost:1234</title>
<meta charset="UTF-8">
<link rel="icon" type="image/x-icon" href="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/favicon.ico">
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/demo.css">
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/jquery-ui.min.css">
<link rel="icon" type="image/x-icon" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/favicon.ico">
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/demo.css">
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery-ui.min.css">
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/requestanimationframe.polyfill.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/requestanimationframe.polyfill.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/instascan.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/html5-qrcode.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/instascan.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/html5-qrcode.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/jquery-ui.0.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/sphere-hacked.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery-ui.0.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/sphere-hacked.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/jquery.earth-3d.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery.earth-3d.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/index_fichiers/demo.js"></script>
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/demo.js"></script>
<script src="http://127.0.0.1:8080/ipfs/QmRyLAbPErFY4nv56Dun1C1KBhE4wyP38ivpeV7rDFb7Fq/astro.js"></script>
@ -74,13 +75,14 @@
font-size: 40px;
}
#glow-shadows.earth {
#glow-shadows.earth {
background: url(http://127.0.0.1:8080/ipfs/QmTVspfoaNL1BK2CR1vVNrEnwo4PfUjwdQxEt57mGJjsLX/earth-glow-shadows.png);
}
#glow-shadows.mars {
background: url(http://127.0.0.1:8080/ipfs/QmTVspfoaNL1BK2CR1vVNrEnwo4PfUjwdQxEt57mGJjsLX/mars-glow-shadows.png);
}
.flight {
position: absolute;
width: 24px;
@ -93,25 +95,27 @@
margin-top: -12.5px;
cursor: pointer;
}
#yellow {
background: black;
position: absolute;
bottom: 2%;
left: 2%;
width: 60%;
}
}
#ainfo {
background: grey;
position: absolute;
top: 2%;
left: 2%;
}
}
</style>
</head>
<body>
<a href="javascript:history.go(-1)"><img style="width:40% height:40% position: absolute; top: 0; right: 0; border: 0;" src="http://127.0.0.1:8080/ipfs/QmX2K94hw9RBULFHS59uGHgB2HGco3Zp7wAfDjp1ak5aV9/l0g0.png" alt="BAck in Le Claude"></a>
<a href="javascript:history.go(-1)"><img style="width:40% height:40% position: absolute; top: 0; right: 0; border: 0;" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/l0g0.png" alt="BAck in Le Claude"></a>
<div id="countdown"></div>
<div class="subtitle">A Friendly Planet of Friends</div>
@ -230,11 +234,15 @@ TODO:
<div class="choose_example">
Choose example: <select id="example">
<!--
<option value="simple">Simple earth</option>
<option value="simple_tilted">Simple tilted earth</option>
-->
<option value="simple_mars">Simple mars</option>
<!--
<option value="flights">Earth with locations and flights</option>
<option value="locations" selected>Earth with locations</option>
-->
<option value="locations" selected >Ŋ1 Friends</option>
</select>
</div>
<div class="code">
@ -246,7 +254,7 @@ TODO:
<button id="ainfo" onclick="javascript:var x = document.getElementById('yellow'); if (x.style.visibility === 'hidden') {x.style.visibility = 'visible';} else {x.style.visibility = 'hidden';}">0/1</button>
<div id="yellow" >
<iframe id="aframe" src="_STATION_" width="100%" height="280px"></iframe>
<iframe name="aframe" id="aframe" src="_STATION_" width="100%" height="300px"></iframe>
</div>
</body></html>

View File

@ -1,206 +1,9 @@
var examples = {};
examples['simple'] = function() {
$('#sphere').earth3d({
dragElement: $('#locations') // where do we catch the mouse drag
});
};
examples['simple_tilted'] = function() {
$('#sphere').earth3d({
dragElement: $('#locations'), // where do we catch the mouse drag
sphere: { // rotation and size of the planet
tilt: 40,
turn: 20,
r: 10
}
});
};
examples['locations'] = function() {
/* defining locations to display.
Each position must have a key, an alpha and delta position (or x and y if you want to display a static location).
Any additional key can be reached via callbacks functions.
*/
var locations = {
obj1: {
alpha: Math.PI / 4,
delta: 0,
name: '_usa_',
link: 'https://oasis.astroport.com#usa'
},
obj2: {
alpha: 1 * Math.PI / 4,
delta: -2 * Math.PI / 4,
name: '_africa_',
link: 'https://oasis.astroport.com#africa'
},
obj3: {
alpha: 2 * Math.PI / 4,
delta: 0,
name: '_hawai_',
link: 'https://oasis.astroport.com#awai'
},
obj4: {
alpha: 3 * Math.PI / 4,
delta: 3 * Math.PI / 4,
name: '_australia_',
link: 'https://oasis.astroport.com#australia'
},
obj5: {
alpha: 2.2 * Math.PI / 4,
delta: -0.9 * Math.PI / 4,
name: '_southamerica_',
link: 'https://oasis.astroport.com#southamerica'
},
obj6: {
alpha: 1.2 * Math.PI / 4,
delta: -2 * Math.PI / 4,
name: '_europe_',
link: 'https://oasis.astroport.com#europe'
}
};
$('#sphere').earth3d({
locationsElement: $('#locations'),
dragElement: $('#locations'), // where do we catch the mouse drag
locations: locations
});
};
examples['flights'] = function() {
/* defining locations to display.
Each position must have a key, an alpha and delta position (or x and y if you want to display a static location).
Any additional key can be reached via callbacks functions.
*/
var locations = {
obj1: {
alpha: Math.PI / 4,
delta: 0,
name: '_usa_',
link: 'https://oasis.astroport.com#usa'
},
obj2: {
alpha: 1 * Math.PI / 4,
delta: -2 * Math.PI / 4,
name: '_africa_',
link: 'https://oasis.astroport.com#africa'
},
obj3: {
alpha: 2 * Math.PI / 4,
delta: 0,
name: '_hawai_',
link: 'https://oasis.astroport.com#awai'
},
obj4: {
alpha: 3 * Math.PI / 4,
delta: 3 * Math.PI / 4,
name: '_australia_',
link: 'https://oasis.astroport.com#australia'
},
obj5: {
alpha: 2.2 * Math.PI / 4,
delta: -0.9 * Math.PI / 4,
name: '_southamerica_',
link: 'https://oasis.astroport.com#southamerica'
},
obj6: {
alpha: 1.2 * Math.PI / 4,
delta: -2 * Math.PI / 4,
name: '_europe_',
link: 'https://oasis.astroport.com#europe'
},
zero: {
alpha: 0 * Math.PI / 4,
delta: 0 * Math.PI / 4,
name: '_CraftYourWorld_',
link: 'https://ipfs.copylaradio.com/ipfs/QmNcNcYRDUFmR1Ey1MAyhzzZRJEi1Dfq8YXRTXq6XZ9n4A'
},
pi: {
alpha: -3 * Math.PI / 4,
delta: -3 * Math.PI / 4,
name: '_OpenTW_',
link: 'https://astroport.copylaradio.com'
}
};
/* defining paths to display.
Each path must have a key, an origin and a destination. The values are the location's key.
You can, if you want to, define flights on these paths.
Each flight has a key, a destination (the location's key) and a position.
The position is the progress a fleet has made on its path.
Any additional key can be reach via callbacks functions.
*/
var paths = {
path: {
origin: 'obj1',
destination: 'obj2',
flights: {
flight: {
position: 0.25,
destination: 'obj2',
name: 'Flight 1'
},
flight2: {
position: 0.25,
destination: 'obj1',
name: 'Flight 2'
}
}
},
path2: {
origin: 'obj1',
destination: 'obj3',
flights: {
flight3: {
position: 0.5,
destination: 'obj3',
name: 'Flight 3'
}
}
},
path3: {
origin: 'obj1',
destination: 'obj4',
flights: {
flight4: {
position: 0.5,
destination: 'obj4',
name: 'Flight 4'
}
}
},
path4: {
origin: 'obj1',
destination: 'obj5'
},
path7: {
origin: 'obj1',
destination: 'obj5',
flights: {
flight5: {
position: 0.25,
destination: 'obj7',
name: 'Flight 5'
}
}
}
}
$('#sphere').earth3d({
flightsCanvas: $('#flights'),
locationsElement: $('#locations'),
dragElement: $('#locations'), // where do we catch the mouse drag
paths: paths,
locations: locations
});
};
function selectExample(example) {
$('#sphere').earth3d('destroy');
$('#sphere').replaceWith($('<canvas id="sphere" width="400" height="400"></canvas>'));
$('.location').remove();
$('.flight').remove();
$('#flights')[0].getContext('2d').clearRect(0, 0, 400, 400);
//~ $('.flight').remove();
//~ $('#flights')[0].getContext('2d').clearRect(0, 0, 400, 400);
if (example == 'simple_mars') {
$('#glow-shadows').removeClass('earth').addClass('mars');
} else {
@ -221,7 +24,7 @@ function selectExample(example) {
$(document).ready(function() {
selectExample('flights');
selectExample('locations');
$('#example').change(function() {
selectExample($(this).val());