Code Monkey home page Code Monkey logo

Comments (1)

TheFern2 avatar TheFern2 commented on June 14, 2024

The finalMs doesn't change at all I dunno if is the only bug in there, but it looks very suspicious to me.
If you have 3x, and hit replay, then 2x while is playing you can see the whole period that is waiting to put the next letter, but if you select a faster speed it just jumps and finish quickly. We might also have to reassign playBackDateStart when speed is changed.

Basically when the speed is changed all variables should readjust, start time and end time should get recalculated, then start from the same position when you hit the speed button as you've mentioned. Might also need ms to change according to speed. text-utils.ts might have some bugs too. But well this bug might be low priority until gif feature is released.

Edit 1: The loop length should also change accordingly.

const playBackDateStart = new Date().getTime();
    const finalMs = recordingSteps[recordingSteps.length - 1][0];
    let i = 0;
    while (i < recordingSteps.length) {
      const [ms, changeBlock] = recordingSteps[i];
      const currentDuration =
        (new Date().getTime() - playBackDateStart) * speed;
      if (currentDuration < ms) {
        progress.set(currentDuration / finalMs);
        await sleep(10);
        continue;
      }
      executeChanges(textChunks, changeBlock);
      textChunks = textChunks;
      i++;
    }

from vscode-stories.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.