Skip to content

Commit

Permalink
rewrite lesson 5 in vite and r3f
Browse files Browse the repository at this point in the history
  • Loading branch information
mprcodes committed Mar 3, 2023
1 parent 9c1f761 commit 78cc2bd
Show file tree
Hide file tree
Showing 35 changed files with 2,052 additions and 6,647 deletions.
24 changes: 24 additions & 0 deletions 05 Transforming Objects/Vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions 05 Transforming Objects/Vite/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.14.2
24 changes: 24 additions & 0 deletions 05 Transforming Objects/Vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 05. Transforming Objects

I've set up a custom Vite config to use TypeScript and Sass.

## Setup

Run this following commands to install the dependencies, start the development server, and build for production:

```bash
# Install dependencies (only the first time)
pnpm install

# Run the local server at localhost:5173
pnpm dev

# Build for production in the dist/ directory
pnpm build
```

## Lesson

There are four properties to transform objects: `position`, `scale`, `rotation`, and `quaternion`. All these properties are compiled to matrices.

All of the `Object3D` inheriting classes have those properties. For instance, `PerspectiveCamera` or `Mesh`.
15 changes: 15 additions & 0 deletions 05 Transforming Objects/Vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/threejs-journey-logo.svg" />
<title>04 - Local Server</title>
</head>
<body>
<canvas id="webgl"></canvas>

<script src="/src/main.ts" type="module"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions 05 Transforming Objects/Vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "vite-local-server",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {
"@types/three": "^0.149.0",
"sass": "^1.58.3",
"typescript": "^4.9.3",
"vite": "^4.1.0"
},
"dependencies": {
"three": "^0.150.1"
}
}
Loading

0 comments on commit 78cc2bd

Please sign in to comment.