diff --git a/index.html b/index.html index 0334c2e..427fd43 100644 --- a/index.html +++ b/index.html @@ -5337,16 +5337,22 @@ function animateBuildings(timestamp) { if (!buildingAnimationEnabled) return; - // Single multiplier for all buildings: 100% to 150% - // (sin + 1) gives 0 to 2, multiply by 0.25 gives 0 to 0.5, add 1 gives 1.0 to 1.5 - const multiplier = 1 + (Math.sin(timestamp * buildingAnimationSpeed) + 1) * 0.25; + // Two multipliers 180° out of phase: when one grows, the other shrinks + // Range: 100% to 150% + const sinVal = Math.sin(timestamp * buildingAnimationSpeed); + const multiplierA = 1 + (sinVal + 1) * 0.25; // 1.0 → 1.5 + const multiplierB = 1 + (-sinVal + 1) * 0.25; // 1.5 → 1.0 (inverted) - // Update building height + // Alternate based on floor of height being even/odd if (map.getLayer('buildings-3d')) { map.setPaintProperty('buildings-3d', 'fill-extrusion-height', [ '*', ['get', 'render_height'], - multiplier + ['case', + ['==', ['%', ['floor', ['get', 'render_height']], 2], 0], + multiplierA, + multiplierB + ] ]); }