<commit_before>import { Group } from './lib/three';
import * as SDFText from './sdftext';
import viewer from './viewer';
import settings from './settings';
import { sleep } from './utils/async';

const { scene } = viewer;
const textCreator = SDFText.creator();
const { textColor } = settings;

const group = new Group();
let countdownVersion = 0;
let mainTextString;
let subTextString;

//  for alignment testing
// const mesh = new THREE.Mesh( new THREE.BoxGeometry(1,1,1), new THREE.MeshBasicMaterial({wireframe:true}) );
// group.add( mesh );

const subtext = textCreator.create('START IN', {
  scale: 2.25,
  align: 'center',
  color: textColor,
  mode: 'nowrap',
});

const mainText = textCreator.create('', {
  scale: 7.5,
  align: 'center',
  color: textColor,
  mode: 'nowrap',
});

mainText.position.y = -0.65;

group.add(subtext, mainText);

group.position.set(0, 2, -4);

const instructions = {
  add() {
    scene.add(group);
  },

  remove() {
    scene.remove(group);
  },

  reset() {
    countdownVersion += 1;
    instructions.remove();
    instructions.setSubText('');
    instructions.setMainText('');
  },

  setSubText(str) {
    if (str === subTextString) return;
    subtext.updateLabel(str);
    subTextString = str;
  },

  setMainText(str) {
    if (str === mainTextString) return;
    mainText.updateLabel(str);
    mainTextString = str;
  },

  async beginCountdown(seconds) {
    countdownVersion += 1;
    const version = countdownVersion;
    instructions.add();
    let remaining = seconds;
    while (remaining > 0) {
      if (version !== countdownVersion) {
        remaining = 0;
        continue;
      }
      instructions.setMainText(remaining.toString());
      remaining--;
      await sleep(1000);
    }
    if (version === countdownVersion) {
      instructions.remove();
    }
  },
};

export default instructions;<commit_msg>record mode: display ‘dance’ after countdown has ended - closes #221<commit_after>import { Group } from './lib/three';
import * as SDFText from './sdftext';
import viewer from './viewer';
import settings from './settings';
import { sleep } from './utils/async';

const { scene } = viewer;
const textCreator = SDFText.creator();
const { textColor } = settings;

const group = new Group();
let countdownVersion = 0;
let mainTextString;
let subTextString;

//  for alignment testing
// const mesh = new THREE.Mesh( new THREE.BoxGeometry(1,1,1), new THREE.MeshBasicMaterial({wireframe:true}) );
// group.add( mesh );

const subtext = textCreator.create('START IN', {
  scale: 2.25,
  align: 'center',
  color: textColor,
  mode: 'nowrap',
});

const mainText = textCreator.create('', {
  scale: 7.5,
  align: 'center',
  color: textColor,
  mode: 'nowrap',
});

mainText.position.y = -0.65;

group.add(subtext, mainText);

group.position.set(0, 2, -4);

const instructions = {
  add() {
    scene.add(group);
  },

  remove() {
    scene.remove(group);
  },

  reset() {
    countdownVersion += 1;
    instructions.remove();
    instructions.setSubText('');
    instructions.setMainText('');
  },

  setSubText(str) {
    if (str === subTextString) return;
    subtext.updateLabel(str);
    subTextString = str;
  },

  setMainText(str) {
    if (str === mainTextString) return;
    mainText.updateLabel(str);
    mainTextString = str;
  },

  async beginCountdown(seconds) {
    countdownVersion += 1;
    const version = countdownVersion;
    instructions.add();
    let remaining = seconds;
    while (remaining > -2) {
      if (version !== countdownVersion) {
        remaining = -2;
        continue;
      }
      if (remaining > 0) {
        instructions.setMainText(remaining.toString());
      } else {
        instructions.setMainText('');
        instructions.setSubText('DANCE');
      }
      remaining--;
      await sleep(1000);
    }
    if (version === countdownVersion) {
      instructions.remove();
    }
  },
};

export default instructions;
{'fraction_non_alphanumeric': 0.15118350725375412, 'fraction_numerical': 0.012725884448969204, 'mean_word_length': 3.1853035143769968, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '1415288', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1263, 'n_words': 300}