Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
prism.js
<script>
import * as easingFns from 'svelte/easing';
const fns = Object.entries(easingFns).map(([name, fn]) => ({ name, fn }));
// fix the function name for linear
fns.find(({name}) => name === 'linear').fn = linear;
function linear(t) {
return t;
};
import { prismJs } from './prism';
import { onDestroy } from 'svelte';

let fn = fns[0];
let value = 50;
let start = Date.now();
let duration;
let t = 0, u = 0;
let _delay = 0;
let _duration = 10000;
$: points = generatePoints(fn.fn);
let cx=0,cy=0;
function loop() {
const now = Date.now();
duration = (now - start) % (_delay + _duration);
t = Math.max((duration - _delay) / _duration, 0);
u = fn.fn(t);
value = u * 100;
cy = t * 200;
cx = fn.fn(t) * 200;
requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */