Improve fading
This commit is contained in:
parent
04d63d393d
commit
c5abcc6895
2 changed files with 8 additions and 7 deletions
|
@ -37,11 +37,7 @@ public class API{
|
|||
obj.put("lat",node.getLatitude());
|
||||
obj.put("lng",node.getLongitude());
|
||||
obj.put("type",service.getType());
|
||||
long ttl = (300_000-(System.currentTimeMillis()-service.getLastSeen()));
|
||||
if(ttl<0){
|
||||
ttl = 0;
|
||||
}
|
||||
obj.put("ttl",ttl/1000);
|
||||
obj.put("notSeenTime",System.currentTimeMillis() - service.getLastSeen());
|
||||
points.put(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,10 @@ const POINT_COLOR = {
|
|||
hub: '#FF0000',
|
||||
};
|
||||
|
||||
const POINT_TTL = {
|
||||
blockchain: 60,
|
||||
};
|
||||
|
||||
const POINT_RADIUS = {
|
||||
blockchain: 0.125,
|
||||
dht: 0.1,
|
||||
|
@ -51,8 +55,9 @@ const POINT_RADIUS = {
|
|||
globe.pointAltitude(point => POINT_ALTITUDE[point.type]);
|
||||
globe.pointColor(function(point){
|
||||
var color = POINT_COLOR[point.type];
|
||||
if(point.ttl!==undefined){
|
||||
color += Math.round(point.ttl/300*256).toString(16).padStart(2,'0');
|
||||
var ttl = POINT_TTL[point.type];
|
||||
if(point.notSeenTime!==undefined && ttl!==undefined){
|
||||
color += (point.notSeenTime/ttl*255).toString(16).padStart(2,'0');
|
||||
}
|
||||
return color;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue