-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
140 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use client" | ||
import React, { useEffect, useRef } from 'react'; | ||
import * as THREE from 'three'; | ||
|
||
|
||
|
||
const AsciiCube = () => { | ||
const canvasRef = useRef<HTMLCanvasElement>(null!); | ||
|
||
useEffect(() => { | ||
const canvas = canvasRef.current; | ||
const renderer = new THREE.WebGLRenderer({ canvas }); | ||
|
||
const width = 380; | ||
const height = 400; | ||
|
||
canvas.style.width = `${width}px`; | ||
canvas.style.height = `${height}px`; | ||
|
||
renderer.setSize(width, height); | ||
|
||
const scene = new THREE.Scene(); | ||
const camera = new THREE.PerspectiveCamera( | ||
30, | ||
width / height, | ||
0.1, | ||
1000 | ||
); | ||
camera.position.z = 5; | ||
|
||
const geometry = new THREE.BoxGeometry(1, 1, 1); | ||
const material = new THREE.MeshBasicMaterial({ color: 0xffffff }); | ||
const cube = new THREE.Mesh(geometry, material); | ||
scene.add(cube); | ||
|
||
const animate = () => { | ||
requestAnimationFrame(animate); | ||
|
||
cube.rotation.x += 0.01; | ||
cube.rotation.y += 0.01; | ||
|
||
renderer.render(scene, camera); | ||
}; | ||
|
||
animate(); | ||
}, []); | ||
|
||
return <canvas ref={canvasRef} />; | ||
}; | ||
|
||
export default AsciiCube; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.windowContainer | ||
{ | ||
width: 50%; | ||
width: 60%; | ||
box-sizing: border-box; | ||
animation: bottom 1s ease; | ||
} | ||
|