<commit_before>/**
 *  Taken from https://github.com/dmitru/threejs-atom.
 */

function initVisualization() {
  var ww, wh;
  var renderer, scene, camera, world, material, controls;
  var opacityAnimation, pulseAnimations;
  var currentVolumeIsZero = true;
  var isFullscreen = false;
  var controlsShown = false;
  var sceneSavedMargin;
  var paused = false;

  var Config = {
    AUDIO_SENSITIVITY: { min: 0, max: 1.0, step: 0.001, value: 0.1 },
    AUDIO_AVERAGING: { min: 0, max: 1.0, step: 0.0001, value: 0.97 },

    LAYERS: { min: 1, max: 10, step: 1, value: 3 },
    N: { min: 10, max: 1500, step: 10, value: 230 },

    RADIUS: { min: 10, max: 500, step: 10, value: 210 },
    RADIUS_POWER: { min: 0.1, max: 3, step: 0.01, value: 0.49 },
    RADIUS_VARIABILITY: { min: 0.00, max: 2.0, step: 0.005, value: 0.08 },
    RADIUS_VARIABILITY_POWER: { min: 0.2, max: 4.0, step: 0.005, value: 0.805 },

    OPACITY: { min: 0.01, max: 0.5, step: 0.001, value: 0.184 },
    OPACITY_VARIABILITY: { min: 0.00, max: 2.0, step: 0.01, value: 0.2 },
    OPACITY_PULSE_PERIOD: { min: 0.1, max: 10, step: 0.01, value: 0.91 },
    OPACITY_PULSE_DEPTH: { min: 0.00, max: 1.0, step: 0.01, value: 0.43 },

    PULSE_DEPTH: { min: 0.00, max: 1.0, step: 0.001, value: 0.015 },
    PULSE_PERIOD: { min: 0.00, max: 20.0, step: 0.01, value: 0.96 },
    PULSE_VARIABILITY: { min: 0.00, max: 2.0, step: 0.01, value: 0.0 },

    ROTATION: { min: 0, max: 0.005, step: 0.00005, value: 0.0015 },

    JITTER_PROBABILITY: { min: 0, max: 1.0, step: 0.01, value: 0 },
    JITTER_INTENSITY: { min: 0, max: 1.0, step: 0.01, value: 0 },
  };

  function buildLayerConfigs(Config) {
    const layerConfigs = [];
    for (var layerIndex = 1; layerIndex <= Config.LAYERS.max; layerIndex += 1) {
      layerConfigs.push({
        rotX: layerIndex * Config.ROTATION.value * (layerIndex % 2 === 0 ? 1 : -1),
        rotY: layerIndex * Config.ROTATION.value * (layerIndex % 2 === 0 ? 1 : -1),
        rotZ: layerIndex * Config.ROTATION.value * (layerIndex % 2 === 0 ? 1 : -1),

        n: Config.N.value,

        radius: Config.RADIUS.value / Math.pow(layerIndex, Config.RADIUS_POWER.value),
        radiusVariability: Config.RADIUS_VARIABILITY.value / layerIndex,
        radiusVariabilityPower: Config.RADIUS_VARIABILITY_POWER.value,
      });
    }
    return layerConfigs;
  }

  var layerConfigs = buildLayerConfigs(Config);

  function onParametersChanged() {
    layerConfigs = buildLayerConfigs(Config);
    recreateScene();
  }

  function recreateScene() {
    if (scene) {
      scene.remove(world);
    }
    world = createWorld();
    scene.add(world);
  }

  function toggleControls() {
    if (controlsShown) {
      controls.animate({ opacity: 0 }, 150);
      setTimeout(function() { controls.css({ display: 'none' }); }, 150)
    } else {
      controls.css({ opacity: 0, display: 'block' })
        .animate({ opacity: 1 }, 150);
    }
  }

  function toggleFullscreen() {
    isFullscreen = !isFullscreen;
    const canvasHeight = $('#canvas').height();
    const screenHeight = $(window).height();

    if (isFullscreen) {
      $('.show-on-mouse-over-scene').animate({ opacity: 0 }, 1000);
      $('.hide-on-fullscreen').animate({ opacity: 0 }, 250);
      sceneSavedMargin = $('#scene').css('margin-top');
      $('#scene').animate({ 'margin-top': (screenHeight - canvasHeight) / 2 });
    } else {
      $('.hide-on-fullscreen').animate({ opacity: 1 }, 250);
      $('#scene').animate({ 'margin-top': sceneSavedMargin });
    }
  }

  function initControls() {
    controls = $('#controls');
    controls.click(function(e) { e.stopPropagation(); });
    $('#scene').mouseover(function(e) {<commit_msg>Fixed not being able to hide controls once opened<commit_after>/**
 *  Taken from https://github.com/dmitru/threejs-atom.
 */

function initVisualization() {
  var ww, wh;
  var renderer, scene, camera, world, material, controls;
  var opacityAnimation, pulseAnimations;
  var currentVolumeIsZero = true;
  var isFullscreen = false;
  var controlsShown = false;
  var sceneSavedMargin;
  var paused = false;

  var Config = {
    AUDIO_SENSITIVITY: { min: 0, max: 1.0, step: 0.001, value: 0.1 },
    AUDIO_AVERAGING: { min: 0, max: 1.0, step: 0.0001, value: 0.97 },

    LAYERS: { min: 1, max: 10, step: 1, value: 3 },
    N: { min: 10, max: 1500, step: 10, value: 230 },

    RADIUS: { min: 10, max: 500, step: 10, value: 210 },
    RADIUS_POWER: { min: 0.1, max: 3, step: 0.01, value: 0.49 },
    RADIUS_VARIABILITY: { min: 0.00, max: 2.0, step: 0.005, value: 0.08 },
    RADIUS_VARIABILITY_POWER: { min: 0.2, max: 4.0, step: 0.005, value: 0.805 },

    OPACITY: { min: 0.01, max: 0.5, step: 0.001, value: 0.184 },
    OPACITY_VARIABILITY: { min: 0.00, max: 2.0, step: 0.01, value: 0.2 },
    OPACITY_PULSE_PERIOD: { min: 0.1, max: 10, step: 0.01, value: 0.91 },
    OPACITY_PULSE_DEPTH: { min: 0.00, max: 1.0, step: 0.01, value: 0.43 },

    PULSE_DEPTH: { min: 0.00, max: 1.0, step: 0.001, value: 0.015 },
    PULSE_PERIOD: { min: 0.00, max: 20.0, step: 0.01, value: 0.96 },
    PULSE_VARIABILITY: { min: 0.00, max: 2.0, step: 0.01, value: 0.0 },

    ROTATION: { min: 0, max: 0.005, step: 0.00005, value: 0.0015 },

    JITTER_PROBABILITY: { min: 0, max: 1.0, step: 0.01, value: 0 },
    JITTER_INTENSITY: { min: 0, max: 1.0, step: 0.01, value: 0 },
  };

  function buildLayerConfigs(Config) {
    const layerConfigs = [];
    for (var layerIndex = 1; layerIndex <= Config.LAYERS.max; layerIndex += 1) {
      layerConfigs.push({
        rotX: layerIndex * Config.ROTATION.value * (layerIndex % 2 === 0 ? 1 : -1),
        rotY: layerIndex * Config.ROTATION.value * (layerIndex % 2 === 0 ? 1 : -1),
        rotZ: layerIndex * Config.ROTATION.value * (layerIndex % 2 === 0 ? 1 : -1),

        n: Config.N.value,

        radius: Config.RADIUS.value / Math.pow(layerIndex, Config.RADIUS_POWER.value),
        radiusVariability: Config.RADIUS_VARIABILITY.value / layerIndex,
        radiusVariabilityPower: Config.RADIUS_VARIABILITY_POWER.value,
      });
    }
    return layerConfigs;
  }

  var layerConfigs = buildLayerConfigs(Config);

  function onParametersChanged() {
    layerConfigs = buildLayerConfigs(Config);
    recreateScene();
  }

  function recreateScene() {
    if (scene) {
      scene.remove(world);
    }
    world = createWorld();
    scene.add(world);
  }

  function toggleControls() {
    if (controlsShown) {
      controls.animate({ opacity: 0 }, 150);
      setTimeout(function() { controls.css({ display: 'none' }); }, 150)
    } else {
      controls.css({ opacity: 0, display: 'block' })
        .animate({ opacity: 1 }, 150);
    }
    controlsShown = !controlsShown;
  }

  function toggleFullscreen() {
    isFullscreen = !isFullscreen;
    const canvasHeight = $('#canvas').height();
    const screenHeight = $(window).height();

    if (isFullscreen) {
      $('.show-on-mouse-over-scene').animate({ opacity: 0 }, 1000);
      $('.hide-on-fullscreen').animate({ opacity: 0 }, 250);
      sceneSavedMargin = $('#scene').css('margin-top');
      $('#scene').animate({ 'margin-top': (screenHeight - canvasHeight) / 2 });
    } else {
      $('.hide-on-fullscreen').animate({ opacity: 1 }, 250);
      $('#scene').animate({ 'margin-top': sceneSavedMargin });
    }
  }

  function initControls() {
    controls = $('#controls');
    controls.click(function(e) { e.stopPropagation(); });
    $('#scene').mouseover(function(e) {
{'fraction_non_alphanumeric': 0.172751677852349, 'fraction_numerical': 0.06120805369127517, 'mean_word_length': 2.993033226152197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3801197', 'n_tokens_mistral': 3098, 'n_tokens_neox': 2703, 'n_words': 666}