Widget:TwinSuns: Difference between revisions

From WyrdeWiki
No edit summary
No edit summary
Line 157: Line 157:
     var oc = openingClosing(delta, phase);
     var oc = openingClosing(delta, phase);
     el.rel.textContent = fmtDeg(delta) + " (" + oc + ")";
     el.rel.textContent = fmtDeg(delta) + " (" + oc + ")";
     el
     el.eq.textContent  = fmtDeg(eq);
 
    // convert degrees to pixels for stage
    var w = el.stage.clientWidth;
    var h = el.stage.clientHeight;
    var cx = w * 0.5;
    var cy = h * 0.33;  // place suns in upper third
 
    // horizontal visual cue: center pair around cx with SEP/2 offset
    var dx = (SEP/2) * DEGPX; // pixels
 
    // vertical:
    // barycenter seasonal tilt (eq) plus split wobble offsets
    var solOff =  (delta * (SOL_SHARE/SUM)) * DEGPX;  // Solara goes positive with +Δ
    var vaeOff = -(delta * (VAE_SHARE/SUM)) * DEGPX;  // Vaelus opposite
 
    var yBase = cy - (eq * DEGPX);
 
    // place
    el.s.style.left = (cx - dx) + "px";
    el.v.style.left = (cx + dx) + "px";
    el.s.style.top  = (yBase - solOff) + "px";
    el.v.style.top  = (yBase - vaeOff) + "px";
  }
 
  // slider & play
  var timer=null, playing=false, interval = 1000/Math.max(1,FPS);
  function step(){
    var v = parseInt(el.rng.value,10);
    v = (v>=479)?1:(v+1);
    el.rng.value = v;
    update();
  }
  el.rng.addEventListener("input", function(){
    // keep cosine image width exactly matching slider—nothing to do here, width is CSS-bound
    update();
  });
  el.play.addEventListener("click", function(){
    if(!playing){
      playing = true; el.play.textContent = "■";
      timer = setInterval(step, interval);
    } else {
      playing = false; el.play.textContent = "▶";
      clearInterval(timer); timer=null;
    }
  });
 
  update();
})();
</script>
</includeonly>

Revision as of 20:25, 11 November 2025

This widget shows WyrdeHaven’s twin suns with seasonal wobble & calendar.

Usage

1 / 479
Date: Fortnight of Renewal (Dawning), day 8 (FR 8)
Sky Solara Vaelus
Relative Solar Inclination (Δ): +2.50° (Closing)
Seasonal Equatorial Inclination (barycenter): -8.00°

param meaning default
size max stage width (px) 768
fps play speed (frames/s) 5
wobble solar relative wobble amplitude (Δ, degrees) 2.5
equator seasonal/barycenter max tilt (degrees) 8
sep visible horizontal separation between suns (degrees) 2.5
degpx vertical degree→pixel scale (px per degree) 10