
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
🚀🚀Using bezier curve to build animation easily.
npm i funcurve
or
yarn add funcurve
import funcurve from 'funcurve';
const fc = funcurve({
controlPoints: [
{ x: 100, y: 200 },
{ x: 400, y: 500 },
],
onUpdate({ point }) {
console.log(point.x, point.y);
},
onEnd({ point, finished }) {
console.log(point.x, point.y, finished);
},
}).start();
If you want't stop current running process, call stop()
, after that onEnd
callback will be fired with finished
being false
.
fc.stop();
A funcuve instance can call start
serveral times. Before next process start, previous process will be stopped and call onEnd
callback immediately.
fc.start();
setTimeout(() => {
fc.start();
}, 500);
funcurve
funcurve(config: FuncurveConfig):IFuncurve
returns a funcure instance.
config
key | type | description |
---|---|---|
controlPoints | Point[] | bezier control point array. |
duration | number | the duration(ms) of process, default value is 1000 |
onUpdate | UpdateInfo | the callback of each animation frame |
onEnd | UpdateInfo&{finished:boolean} | the callback of the end of process |
export interface Point {
x: number;
y: number;
}
interface UpdateInfo {
point: Point;
progress: number;
}
export interface FuncurveConfig {
controlPoints: Point[];
duration?: number;
onUpdate?(res: UpdateInfo): void;
onEnd?(res: UpdateInfo & { finished?: boolean }): void;
}
UpdateInfo
key | type | description |
---|---|---|
point | Point | current point of curve. |
progress | number | current progress. 0 - 1 |
finished | boolean | onEnd callback has an extra finished prop to indicate whether the process has finished. |
IFuncurve
start()
Stop previous process and Start a new process.
stop()
Stop current process.
FAQs
A simple and funny way to get curve.
We found that funcurve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.