hloel
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
<title>hoel - Admin</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<link rel="icon" href="favicon.png" type="image/png">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Admin Panel -->
|
||||
|
||||
@ -106,7 +106,7 @@ Asteroid.prototype.initializeTypeSpecificProperties = function() {
|
||||
this.planetColors = CONFIG.GIANT_COLORS[Math.floor(Math.random() * CONFIG.GIANT_COLORS.length)];
|
||||
// Initialize rings
|
||||
this.rings = [];
|
||||
var ringCount = Math.floor(Math.random() * 4); // 0-3 rings
|
||||
var ringCount = Math.floor(Math.random() * 4) + 1; // 1–4 rings
|
||||
for (var i = 0; i < ringCount; i++) {
|
||||
this.rings.push({
|
||||
color: CONFIG.GIANT_RING_COLORS[Math.floor(Math.random() * CONFIG.GIANT_RING_COLORS.length)],
|
||||
@ -432,40 +432,23 @@ function BlackHole(x, y, radius) {
|
||||
};
|
||||
|
||||
BlackHole.prototype.draw = function(ctx, consumptionRate) {
|
||||
// Calculate jet intensity based on consumption rate
|
||||
var jetMin = 1e7; // Start triggering at 10 Mt/s (Comets)
|
||||
var jetMax = 1e22; // max intensity
|
||||
var minVisible = 0.1; // 10% intensity floor
|
||||
|
||||
var targetIntensity = 0;
|
||||
|
||||
if (consumptionRate && consumptionRate > jetMin) {
|
||||
var logMin = 10; // log10(1e10)
|
||||
var logMax = 22; // log10(1e22)
|
||||
var logRate = Math.log10(consumptionRate);
|
||||
|
||||
// Log-scaled 0..1
|
||||
targetIntensity = Math.max(0, Math.min(
|
||||
(logRate - logMin) / (logMax - logMin),
|
||||
1
|
||||
));
|
||||
|
||||
// Perceptual tweaks
|
||||
targetIntensity = Math.pow(targetIntensity, 0.35); // boost low end
|
||||
targetIntensity = minVisible + (1 - minVisible) * targetIntensity;
|
||||
}
|
||||
|
||||
// Smooth transition for jet intensity
|
||||
if (!this.jetIntensity) this.jetIntensity = 0;
|
||||
|
||||
var transitionSpeed = 0.05; // Lower = slower fade (0.01 = very slow, 0.05 = fast)
|
||||
|
||||
if (targetIntensity > this.jetIntensity) {
|
||||
if (!this.targetJetIntensity) this.targetJetIntensity = 0;
|
||||
|
||||
var transitionSpeed = 0.05; // Fade speed
|
||||
|
||||
if (this.targetJetIntensity > this.jetIntensity) {
|
||||
// Fade in
|
||||
this.jetIntensity = Math.min(this.jetIntensity + transitionSpeed, targetIntensity);
|
||||
} else if (targetIntensity < this.jetIntensity) {
|
||||
this.jetIntensity = Math.min(this.jetIntensity + transitionSpeed, this.targetJetIntensity);
|
||||
} else if (this.targetJetIntensity < this.jetIntensity) {
|
||||
// Fade out
|
||||
this.jetIntensity = Math.max(this.jetIntensity - transitionSpeed, targetIntensity);
|
||||
this.jetIntensity = Math.max(this.jetIntensity - transitionSpeed, this.targetJetIntensity);
|
||||
}
|
||||
|
||||
// Decay target intensity over time (jets fade after consumption)
|
||||
if (this.targetJetIntensity > 0) {
|
||||
this.targetJetIntensity = Math.max(0, this.targetJetIntensity - 0.01);
|
||||
}
|
||||
|
||||
// Draw jets first (behind the black hole)
|
||||
@ -544,6 +527,28 @@ BlackHole.prototype.consumeAsteroid = function(asteroid) {
|
||||
// Blend with existing pulseColor instead of replacing
|
||||
if (!this.pulseColor) this.pulseColor = newColor;
|
||||
else this.pulseColor = this.blendColors(this.pulseColor, newColor, 0.3);
|
||||
var jetMin = 1e7; // Start triggering at 10 Mt (Comets)
|
||||
var jetMax = 1e29; // Max intensity (M-Type range)
|
||||
|
||||
if (asteroid.massKg >= jetMin) {
|
||||
var logMin = Math.log10(jetMin);
|
||||
var logMax = Math.log10(jetMax);
|
||||
var logMass = Math.log10(asteroid.massKg);
|
||||
|
||||
// Log-scaled 0..1
|
||||
var targetIntensity = Math.max(0, Math.min(
|
||||
(logMass - logMin) / (logMax - logMin),
|
||||
1
|
||||
));
|
||||
|
||||
// Perceptual tweaks
|
||||
targetIntensity = Math.pow(targetIntensity, 0.35); // boost low end
|
||||
targetIntensity = 0.1 + 0.9 * targetIntensity; // 10%-100% range
|
||||
|
||||
// Set jet properties
|
||||
this.targetJetIntensity = targetIntensity;
|
||||
this.jetColor = newColor; // Match the object's color
|
||||
}
|
||||
};
|
||||
|
||||
// Helper function to blend two hex colors by weight (0–1)
|
||||
@ -563,10 +568,23 @@ BlackHole.prototype.blendColors = function(c1, c2, weight) {
|
||||
};
|
||||
|
||||
BlackHole.prototype.drawJets = function(ctx, intensity) {
|
||||
// Get jet color from consumed object (default to blue if not set)
|
||||
var baseColor = this.jetColor || '#6496ff';
|
||||
|
||||
// Convert hex to RGB
|
||||
var r = parseInt(baseColor.substr(1, 2), 16);
|
||||
var g = parseInt(baseColor.substr(3, 2), 16);
|
||||
var b = parseInt(baseColor.substr(5, 2), 16);
|
||||
|
||||
// Lighten the color for the core
|
||||
var coreR = Math.min(255, r + 50);
|
||||
var coreG = Math.min(255, g + 50);
|
||||
var coreB = Math.min(255, b + 50);
|
||||
|
||||
// Jet configuration (easily adjustable)
|
||||
var config = {
|
||||
color: 'rgba(100, 150, 255, 0.8)', // Blue-white jet color
|
||||
coreColor: 'rgba(200, 220, 255, 0.9)', // Bright core
|
||||
color: 'rgba(' + r + ', ' + g + ', ' + b + ', 0.8)',
|
||||
coreColor: 'rgba(' + coreR + ', ' + coreG + ', ' + coreB + ', 0.9)',
|
||||
length: this.radius * 8, // Jet length (8x black hole radius)
|
||||
width: this.radius * 0.2, // Jet width at base
|
||||
coreWidth: this.radius * 0.05, // Bright core width
|
||||
@ -595,7 +613,7 @@ BlackHole.prototype.drawJets = function(ctx, intensity) {
|
||||
var jetColor = config.color.replace(/[\d.]+\)/, (alpha * 0.6) + ')');
|
||||
jetGradient.addColorStop(0, jetColor);
|
||||
jetGradient.addColorStop(0.3, jetColor.replace(/[\d.]+\)/, (alpha * 0.4) + ')'));
|
||||
jetGradient.addColorStop(1, 'rgba(100, 150, 255, 0)');
|
||||
jetGradient.addColorStop(1, 'rgba(' + r + ', ' + g + ', ' + b + ', 0)');
|
||||
|
||||
ctx.fillStyle = jetGradient;
|
||||
ctx.beginPath();
|
||||
@ -614,7 +632,7 @@ BlackHole.prototype.drawJets = function(ctx, intensity) {
|
||||
var coreColor = config.coreColor.replace(/[\d.]+\)/, alpha + ')');
|
||||
coreGradient.addColorStop(0, coreColor);
|
||||
coreGradient.addColorStop(0.5, coreColor.replace(/[\d.]+\)/, (alpha * 0.5) + ')'));
|
||||
coreGradient.addColorStop(1, 'rgba(200, 220, 255, 0)');
|
||||
coreGradient.addColorStop(1, 'rgba(' + coreR + ', ' + coreG + ', ' + coreB + ', 0)');
|
||||
|
||||
ctx.fillStyle = coreGradient;
|
||||
ctx.beginPath();
|
||||
|
||||
Reference in New Issue
Block a user