Fixed ESLInt and stuff
This commit is contained in:
@@ -4,15 +4,8 @@ import { AnimatePresence, motion } from "motion/react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function PlaceholdersAndVanishInput({
|
||||
placeholders,
|
||||
onChange,
|
||||
onSubmit,
|
||||
}: {
|
||||
placeholders: string[];
|
||||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
|
||||
}) {
|
||||
|
||||
export function PlaceholdersAndVanishInput({placeholders, onChange, onSubmit,}: { placeholders: string[]; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; onSubmit: (e: React.FormEvent<HTMLFormElement>) => void; }) {
|
||||
const [currentPlaceholder, setCurrentPlaceholder] = useState(0);
|
||||
|
||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||
@@ -40,7 +33,7 @@ export function PlaceholdersAndVanishInput({
|
||||
}
|
||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
};
|
||||
}, [placeholders]);
|
||||
}, [handleVisibilityChange, placeholders, startAnimation]);
|
||||
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||
const newDataRef = useRef<any[]>([]);
|
||||
@@ -67,17 +60,18 @@ export function PlaceholdersAndVanishInput({
|
||||
|
||||
const imageData = ctx.getImageData(0, 0, 800, 800);
|
||||
const pixelData = imageData.data;
|
||||
const newData: any[] = [];
|
||||
const newData: never[] = [];
|
||||
|
||||
for (let t = 0; t < 800; t++) {
|
||||
let i = 4 * t * 800;
|
||||
const i = 4 * t * 800;
|
||||
for (let n = 0; n < 800; n++) {
|
||||
let e = i + 4 * n;
|
||||
const e = i + 4 * n;
|
||||
if (
|
||||
pixelData[e] !== 0 &&
|
||||
pixelData[e + 1] !== 0 &&
|
||||
pixelData[e + 2] !== 0
|
||||
) {
|
||||
// @ts-expect-error abcd
|
||||
newData.push({
|
||||
x: n,
|
||||
y: t,
|
||||
@@ -92,6 +86,7 @@ export function PlaceholdersAndVanishInput({
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newDataRef.current = newData.map(({ x, y, color }) => ({
|
||||
x,
|
||||
y,
|
||||
@@ -107,9 +102,10 @@ export function PlaceholdersAndVanishInput({
|
||||
const animate = (start: number) => {
|
||||
const animateFrame = (pos: number = 0) => {
|
||||
requestAnimationFrame(() => {
|
||||
const newArr = [];
|
||||
const newArr: any[] = [];
|
||||
for (let i = 0; i < newDataRef.current.length; i++) {
|
||||
const current = newDataRef.current[i];
|
||||
|
||||
if (current.x < pos) {
|
||||
newArr.push(current);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user