mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-15 18:25:18 +02:00
chore: ran linting
This commit is contained in:
parent
323f7f2b4a
commit
c674fb3054
37 changed files with 972 additions and 920 deletions
|
|
@ -2,12 +2,12 @@ import * as Babel from "@babel/standalone";
|
|||
import React from "react";
|
||||
import {
|
||||
AbsoluteFill,
|
||||
useCurrentFrame,
|
||||
useVideoConfig,
|
||||
spring,
|
||||
Easing,
|
||||
interpolate,
|
||||
Sequence,
|
||||
Easing,
|
||||
spring,
|
||||
useCurrentFrame,
|
||||
useVideoConfig,
|
||||
} from "remotion";
|
||||
import { DURATION_IN_FRAMES } from "./constants";
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ function createStagger(totalFrames: number) {
|
|||
frame: number,
|
||||
fps: number,
|
||||
index: number,
|
||||
total: number,
|
||||
total: number
|
||||
): { opacity: number; transform: string } {
|
||||
const enterPhase = Math.floor(totalFrames * 0.2);
|
||||
const exitStart = Math.floor(totalFrames * 0.8);
|
||||
|
|
@ -43,9 +43,7 @@ function createStagger(totalFrames: number) {
|
|||
|
||||
const opacity = s * (1 - exit);
|
||||
const translateY =
|
||||
interpolate(s, [0, 1], [40, 0]) +
|
||||
interpolate(exit, [0, 1], [0, -30]) +
|
||||
ambient;
|
||||
interpolate(s, [0, 1], [40, 0]) + interpolate(exit, [0, 1], [0, -30]) + ambient;
|
||||
const scale = interpolate(s, [0, 1], [0.97, 1]);
|
||||
|
||||
return {
|
||||
|
|
@ -97,7 +95,7 @@ export function prepareSource(code: string): string {
|
|||
const codeWithoutImports = code.replace(/^import\s+.*$/gm, "").trim();
|
||||
|
||||
const match = codeWithoutImports.match(
|
||||
/export\s+(?:const|function)\s+(\w+)\s*(?::\s*React\.FC\s*)?=?\s*\(\s*\)\s*=>\s*\{([\s\S]*)\};?\s*$/,
|
||||
/export\s+(?:const|function)\s+(\w+)\s*(?::\s*React\.FC\s*)?=?\s*\(\s*\)\s*=>\s*\{([\s\S]*)\};?\s*$/
|
||||
);
|
||||
|
||||
if (match) {
|
||||
|
|
@ -137,18 +135,10 @@ export function compileCheck(code: string): CompileResult {
|
|||
}
|
||||
}
|
||||
|
||||
export function compileToComponent(
|
||||
code: string,
|
||||
durationInFrames?: number,
|
||||
): React.ComponentType {
|
||||
const staggerFn = durationInFrames
|
||||
? createStagger(durationInFrames)
|
||||
: defaultStagger;
|
||||
export function compileToComponent(code: string, durationInFrames?: number): React.ComponentType {
|
||||
const staggerFn = durationInFrames ? createStagger(durationInFrames) : defaultStagger;
|
||||
|
||||
const jsCode = transpile(code);
|
||||
const factory = new Function(
|
||||
...INJECTED_NAMES,
|
||||
`${jsCode}\nreturn DynamicComponent;`,
|
||||
);
|
||||
const factory = new Function(...INJECTED_NAMES, `${jsCode}\nreturn DynamicComponent;`);
|
||||
return factory(...buildInjectedValues(staggerFn)) as React.ComponentType;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue