File tree Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 1+ import { InterpolationFunc } from "./types" ;
2+
3+ export const linear : InterpolationFunc = ( progress : number ) => {
4+ return progress ;
5+ }
6+
7+ export const ease : InterpolationFunc = ( progress : number ) => {
8+ return 0.5 + 0.5 * Math . sin ( Math . PI * ( progress + 1.5 ) ) ;
9+ } ;
10+
11+ export const easeStart : InterpolationFunc = ( progress : number ) => {
12+ return progress ** 2 ;
13+ } ;
14+
15+ export const easeEnd : InterpolationFunc = ( progress : number ) => {
16+ return 1 - ( progress - 1 ) ** 2 ;
17+ } ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import {Shape} from "../types";
22import { split , splitLine , mod } from "../util" ;
33
44// TODO percentage > 1
5- // TODO interpolation function (ex. easing)
65
76const interpolateAngle = ( percentage : number , a : number , b : number ) : number => {
87 const tau = Math . PI * 2 ;
Original file line number Diff line number Diff line change 1- import { Shape } from "../types" ;
2-
3- export interface EasingFunc {
1+ export interface InterpolationFunc {
42 ( progress : number ) : number ;
53}
6-
7- export interface Keyframe {
8- shape : Shape ;
9- easeIn : EasingFunc ;
10- easeOut : EasingFunc ;
11- }
You can’t perform that action at this time.
0 commit comments