Let’s start by changing the store to a tweened value:

    1. <script>
    2. import { tweened } from 'svelte/motion';
    3. import { cubicOut } from 'svelte/easing';
    4. const progress = tweened(0, {
    5. duration: 400,
    6. easing: cubicOut
    7. </script>
    • delay — milliseconds before the tween starts
    • duration — either the duration of the tween in milliseconds, or a function allowing you to (e.g.) specify longer tweens for larger changes in value
    • interpolate — a custom (from, to) => t => value function for interpolating between arbitrary values. By default, Svelte will interpolate between numbers, dates, and identically-shaped arrays and objects (as long as they only contain numbers and dates or other valid arrays and objects). If you want to interpolate (for example) colour strings or transformation matrices, supply a custom interpolator

    You can also pass these options to progress.set and progress.update as a second argument, in which case they will override the defaults. The set and update methods both return a promise that resolves when the tween completes.