Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
dev_server.log

# local env files
.env*.local
Expand All @@ -34,3 +35,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# screenshots
portfolio-3d-view.png
2 changes: 0 additions & 2 deletions dev_server.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
> portfolio@0.1.0 dev
> next dev

▲ Next.js 14.0.4
- Local: http://localhost:3000
Binary file modified portfolio-3d-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions src/app/_components/Projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import React, {
useState,
Suspense,
useEffect,
useMemo,
} from "react";
import { Canvas, useFrame, useThree } from "@react-three/fiber";
import { OrbitControls, Preload, Image as ImageImpl } from "@react-three/drei";
import { OrbitControls, Preload, Image as ImageImpl, type ImageProps } from "@react-three/drei";
import { a as aThree } from "@react-spring/three";
import * as THREE from "three";

Expand Down Expand Up @@ -47,12 +48,13 @@ import React, {

const damp = THREE.MathUtils.damp;

function Image({ c = new THREE.Color(), ...props }) {
const ref = useRef(null!);
function Image({ ...props }: ImageProps) {
const c = useMemo(() => new THREE.Color(), []);
const ref = useRef<THREE.Mesh>(null!);
const [hovered, hover] = useState(false);

useFrame((state, delta) => {
ref.current.material.color.lerp(
(ref.current.material as THREE.MeshBasicMaterial).color.lerp(
c.set(hovered ? "white" : "#ccc"),
hovered ? 0.4 : 0.05
);
Expand All @@ -78,9 +80,8 @@ import React, {
<Image
key={i}
url={img}
alt={projects[i].title}
position={positions[i]}
scale={[2, 2, 2]}
scale={2}
onClick={() => onImageClick(i)}
/>
))}
Expand Down
1 change: 1 addition & 0 deletions verify.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { test, expect } from '@playwright/test';

test('homepage has a canvas for the 3D portfolio', async ({ page }) => {
test.setTimeout(60000); // 60 seconds
const FgRed = "\x1b[31m"
page.on('console', msg => {
if (msg.type() === 'error')
Expand Down