Improve fading

This commit is contained in:
Ben van Hartingsveldt 2025-07-11 18:26:28 +02:00
parent 04d63d393d
commit c5abcc6895
No known key found for this signature in database
GPG key ID: 261AA214130CE7AB
2 changed files with 8 additions and 7 deletions

View file

@ -37,11 +37,7 @@ public class API{
obj.put("lat",node.getLatitude()); obj.put("lat",node.getLatitude());
obj.put("lng",node.getLongitude()); obj.put("lng",node.getLongitude());
obj.put("type",service.getType()); obj.put("type",service.getType());
long ttl = (300_000-(System.currentTimeMillis()-service.getLastSeen())); obj.put("notSeenTime",System.currentTimeMillis() - service.getLastSeen());
if(ttl<0){
ttl = 0;
}
obj.put("ttl",ttl/1000);
points.put(obj); points.put(obj);
} }
} }

View file

@ -42,6 +42,10 @@ const POINT_COLOR = {
hub: '#FF0000', hub: '#FF0000',
}; };
const POINT_TTL = {
blockchain: 60,
};
const POINT_RADIUS = { const POINT_RADIUS = {
blockchain: 0.125, blockchain: 0.125,
dht: 0.1, dht: 0.1,
@ -51,8 +55,9 @@ const POINT_RADIUS = {
globe.pointAltitude(point => POINT_ALTITUDE[point.type]); globe.pointAltitude(point => POINT_ALTITUDE[point.type]);
globe.pointColor(function(point){ globe.pointColor(function(point){
var color = POINT_COLOR[point.type]; var color = POINT_COLOR[point.type];
if(point.ttl!==undefined){ var ttl = POINT_TTL[point.type];
color += Math.round(point.ttl/300*256).toString(16).padStart(2,'0'); if(point.notSeenTime!==undefined && ttl!==undefined){
color += (point.notSeenTime/ttl*255).toString(16).padStart(2,'0');
} }
return color; return color;
}); });