Adding in sweeping changes
This commit is contained in:
BIN
src/assets/textures/SurfaceImperfections003_1K_Normal.jpg
Normal file
BIN
src/assets/textures/SurfaceImperfections003_1K_Normal.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
src/assets/textures/SurfaceImperfections003_1K_var1.jpg
Normal file
BIN
src/assets/textures/SurfaceImperfections003_1K_var1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 552 KiB |
BIN
src/assets/videos/drei.mp4
Normal file
BIN
src/assets/videos/drei.mp4
Normal file
Binary file not shown.
@@ -1,16 +1,25 @@
|
|||||||
import '../styles/styles.scss';
|
import '../styles/styles.scss';
|
||||||
|
import * as THREE from 'three';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { Canvas, useFrame } from '@react-three/fiber';
|
import { Canvas, useFrame, useThree } from '@react-three/fiber';
|
||||||
import { PresentationControls } from '@react-three/drei';
|
import { MeshReflectorMaterial, Environment, ContactShadows, Text } from '@react-three/drei';
|
||||||
|
import { gsap } from 'gsap';
|
||||||
|
|
||||||
const Box = (props) => {
|
const Box = (props) => {
|
||||||
// This reference gives us direct access to the THREE.Mesh object
|
// This reference gives us direct access to the THREE.Mesh object
|
||||||
const ref = useRef()
|
const ref = useRef();
|
||||||
|
|
||||||
// Hold state for hovered and clicked events
|
// Hold state for hovered and clicked events
|
||||||
const [hovered, hover] = useState(false)
|
const [hovered, hover] = useState(false);
|
||||||
const [clicked, click] = useState(false)
|
const [clicked, click] = useState(false);
|
||||||
|
|
||||||
// Subscribe this component to the render-loop, rotate the mesh every frame
|
// Subscribe this component to the render-loop, rotate the mesh every frame
|
||||||
useFrame((state, delta) => (ref.current.rotation.x += 0.01))
|
useFrame((state, delta) => {
|
||||||
|
gsap.to( ref.current.rotation, {
|
||||||
|
x: "+= 0.1"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Return the view, these are regular Threejs elements expressed in JSX
|
// Return the view, these are regular Threejs elements expressed in JSX
|
||||||
return (
|
return (
|
||||||
<mesh
|
<mesh
|
||||||
@@ -27,21 +36,42 @@ const Box = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
|
const [video] = useState(() => Object.assign(document.createElement('video'), { src: '../assets/videos/drei.mp4', crossOrigin: 'Anonymous', loop: true }))
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<nav>
|
<Canvas flat dpr={[1, 2]} camera={{ fov: 25, position: [-8, 0, 0] }} id="canvas-container" style={{position: 'absolute'}}>
|
||||||
<h1 className="underline text-xl">Nav</h1>
|
<color attach="background" args={['#191920']} />
|
||||||
</nav>
|
<fog attach="fog" args={['#191920', 0, 15]} />
|
||||||
<div id="canvas-container">
|
<ambientLight intensity={0.5} />
|
||||||
<Canvas>
|
<pointLight position={[10, 10, 10]} />
|
||||||
<PresentationControls global zoom={0.8} rotation={[0, -Math.PI / 4, 0]} polar={[0, Math.PI / 4]} azimuth={[-Math.PI / 4, Math.PI / 4]}>
|
<Text font='' position={[0, 0.5, 0]} fontSize={2} letterSpacing={-0.06} rotation={[0, -Math.PI / 2, 0]}>
|
||||||
<ambientLight />
|
drei
|
||||||
<pointLight position={[10, 10, 10]} />
|
<meshBasicMaterial toneMapped={false}>
|
||||||
<Box position={[-1.2, 0, 0]} />
|
<videoTexture attach="map" args={[video]} encoding={THREE.sRGBEncoding} />
|
||||||
<Box position={[1.2, 0, 0]} />
|
</meshBasicMaterial>
|
||||||
</PresentationControls>
|
</Text>
|
||||||
</Canvas>
|
<group position={[0, -0.5, 0]}>
|
||||||
</div>
|
{/* <Box position={[-1.2, 1, 0]} />
|
||||||
|
<Box position={[1.2, 1, 0]} /> */}
|
||||||
|
<mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, 0, 0]}>
|
||||||
|
<planeBufferGeometry args={[50, 50]}></planeBufferGeometry>
|
||||||
|
<MeshReflectorMaterial
|
||||||
|
blur={[300, 100]}
|
||||||
|
resolution={2048}
|
||||||
|
mixBlur={1}
|
||||||
|
mixStrength={40}
|
||||||
|
roughness={1}
|
||||||
|
depthScale={1.2}
|
||||||
|
minDepthThreshold={0.4}
|
||||||
|
maxDepthThreshold={1.4}
|
||||||
|
color="#101010"
|
||||||
|
metalness={0.5}
|
||||||
|
/>
|
||||||
|
</mesh>
|
||||||
|
</group>
|
||||||
|
<Environment preset="city" />
|
||||||
|
<ContactShadows frames={1}></ContactShadows>
|
||||||
|
</Canvas>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
|
@tailwind preflight;
|
||||||
@tailwind base;
|
@tailwind base;
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
main {
|
html,
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#root {
|
||||||
|
position: relative;
|
||||||
|
height: 100vh;
|
||||||
#canvas-container {
|
#canvas-container {
|
||||||
canvas {
|
position: absolute;
|
||||||
width: 100%;
|
top: 0;
|
||||||
height: 100%;
|
left: 0;
|
||||||
}
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
purge: ['./src/**/*.html', './src/components/**/*.jsx'],
|
content: [
|
||||||
content: ["./src/**/*.{html,js,jsx}"],
|
"./src/**/*.{html,js}",
|
||||||
|
'./src/components/**/*.jsx'
|
||||||
|
],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {},
|
extend: {},
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||||
|
|
||||||
// let htmlPageNames = [];
|
// let htmlPageNames = [];
|
||||||
// let multipleHtmlPlugins = htmlPageNames.map(name => {
|
// let multipleHtmlPlugins = htmlPageNames.map(name => {
|
||||||
@@ -59,8 +60,11 @@ module.exports = {
|
|||||||
// Images
|
// Images
|
||||||
|
|
||||||
{
|
{
|
||||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
test: /\.(png|svg|jpg|jpeg|gif|mp4)$/i,
|
||||||
type: 'asset',
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'assets/[name].[ext]'
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
// {
|
||||||
@@ -107,10 +111,14 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new CleanWebpackPlugin(),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.resolve(__dirname, './src/views/index.html'),
|
template: path.resolve(__dirname, './src/views/index.html'),
|
||||||
inject: 'body',
|
inject: 'body',
|
||||||
}),
|
}),
|
||||||
|
new MiniCSSExtractPlugin({
|
||||||
|
filename: 'css/[name].[contenthash].css',
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
optimization: {
|
optimization: {
|
||||||
moduleIds: 'deterministic',
|
moduleIds: 'deterministic',
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const { merge } = require('webpack-merge');
|
const { merge } = require('webpack-merge');
|
||||||
const webpack = require( 'webpack' );
|
const webpack = require( 'webpack' );
|
||||||
const commonConfiguration = require('./webpack.common.js');
|
const commonConfiguration = require('./webpack.common.js');
|
||||||
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const hotMiddlewareScript =
|
const hotMiddlewareScript =
|
||||||
@@ -17,16 +15,11 @@ module.exports = merge(commonConfiguration, {
|
|||||||
filename: 'js/[name].[contenthash].js',
|
filename: 'js/[name].[contenthash].js',
|
||||||
path: path.resolve(__dirname, './dist'),
|
path: path.resolve(__dirname, './dist'),
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
clean: true,
|
clean: true
|
||||||
// hotUpdateChunkFilename: 'hot/hot-update.js',
|
|
||||||
// hotUpdateMainFilename: 'hot/hot-update.json'
|
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
new MiniCSSExtractPlugin({
|
|
||||||
filename: 'css/[name].[contenthash].css',
|
|
||||||
}),
|
|
||||||
// new ImageMinimizerPlugin({
|
// new ImageMinimizerPlugin({
|
||||||
// minimizerOptions: {
|
// minimizerOptions: {
|
||||||
// // Lossless optimization with custom option
|
// // Lossless optimization with custom option
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
const { merge } = require('webpack-merge');
|
const { merge } = require('webpack-merge');
|
||||||
const commonConfiguration = require('./webpack.common.js');
|
const commonConfiguration = require('./webpack.common.js');
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
const HtmlCriticalPlugin = require('html-critical-webpack-plugin');
|
const HtmlCriticalPlugin = require('html-critical-webpack-plugin');
|
||||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||||
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = merge(commonConfiguration, {
|
module.exports = merge(commonConfiguration, {
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
@@ -16,14 +13,9 @@ module.exports = merge(commonConfiguration, {
|
|||||||
output: {
|
output: {
|
||||||
filename: 'js/[name].[contenthash].js',
|
filename: 'js/[name].[contenthash].js',
|
||||||
path: path.resolve(__dirname, './dist'),
|
path: path.resolve(__dirname, './dist'),
|
||||||
clean: true,
|
clean: true
|
||||||
assetModuleFilename: 'assets/images/[name][ext][query]',
|
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CleanWebpackPlugin(),
|
|
||||||
new MiniCSSExtractPlugin({
|
|
||||||
filename: 'css/[name].[contenthash].css',
|
|
||||||
}),
|
|
||||||
// new ImageMinimizerPlugin({
|
// new ImageMinimizerPlugin({
|
||||||
// minimizerOptions: {
|
// minimizerOptions: {
|
||||||
// // Lossless optimization with custom option
|
// // Lossless optimization with custom option
|
||||||
|
|||||||
Reference in New Issue
Block a user