![Project Banner](https://private-user-images.githubusercontent.com/151519281/292991449-a7ad05c5-28a5-423f-b6ac-c98f8a5c428a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MTU1NzIsIm5iZiI6MTcyNDYxNTI3MiwicGF0aCI6Ii8xNTE1MTkyODEvMjkyOTkxNDQ5LWE3YWQwNWM1LTI4YTUtNDIzZi1iNmFjLWM5OGY4YTVjNDI4YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxOTQ3NTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03MWE1NWU4ODBhODg5OTc1M2NkZjg2MjMwNjk3ZTY3NjRjZjQwYzgyN2MzNTJhNWFjYzNmYzczMjc4ODE5OTk5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Xm6Di0jdVfstMl6mpgbBB57RV7z6_65la_4E5EPvJaQ)
π Table of Contents
- π€ Introduction
- βοΈ Tech Stack
- π Features
- π€Έ Quick Start
- πΈοΈ Snippets
- π Links
- π More
This repository contains the code corresponding to an in-depth tutorial available on our YouTube channel, JavaScript Mastery.
If you prefer visual learning, this is the perfect resource for you. Follow our tutorial to learn how to build projects like these step-by-step in a beginner-friendly manner!
Create your own style with our new 3D Swag Customization App. Pick colors, add logos, and try AI designs to make your virtual swag unique. Built using React.js, Three.js, and OpenAI to show the usage of a 3D world with AI
If you're getting started and need assistance or face any bugs, join our active Discord community with over 27k+ members. It's a place where people help each other out.
- React.js
- Three.js
- React Three Fiber
- React Three Drei
- Vite
- Tailwind CSS
- Node.js
- Express.js
- OpenAI
- Framer Motion
- Valtio
π 3D Swag Generation: Generate unique 3D shirts/swag items dynamically
π Color Customization: Apply any color to the 3D shirt/swag for personalized styling.
π Logo Upload Functionality: Enable users to upload any file as a logo, integrating it seamlessly onto the 3D shirt.
π Texture Image Upload: Allow users to upload texture images to style the 3D shirt/swag.
π AI-Generated Logo Integration: Utilize AI to generate logos and intelligently apply them to the 3D shirt.
π AI-Generated Textures: Implement AI-generated textures for enhanced 3D shirt customization.
π Download Options:Dynamically change the application theme based on the selected color, enhancing user experience.
π Theme Change with Color Selection: Dynamically change the application theme based on the selected color, enhancing user experience
π Responsive 3D Application: Ensure the application is responsive, delivering a seamless experience across various devices.
π Framer Motion Animation: Implement framer motion animations for smooth transitions between different 3D models.
and many more, including code architecture and reusability
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
Cloning the Repository
git clone https://github.com/adrianhajdin/project_threejs_ai.git
cd project_threejs_ai
Installation
Install the project dependencies using npm in both client and server folders:
npm install
Set Up Environment Variables
Create a new file named .env
in the root of your project and add the following content:
OPENAI_API_KEY=
Replace the placeholder values with your actual OpenAI credentials. You can obtain these credentials by signing up on the Open website.
Running the Project
- Server
npm start
- Client
npm run dev
Open http://localhost:5173 in your browser to view the project.
Customizer.jsx
<button className='download-btn' onClick={downloadCanvasToImage}>
<img
src={download}
alt='download_image'
className='w-3/5 h-3/5 object-contain'
/>
</button>
index.css
@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,200;0,600;1,900&display=swap");
@import url("https://rsms.me/inter/inter.css");
@tailwind base;
@tailwind components;
@tailwind utilities;
html {
font-family: "Inter", sans-serif;
}
@supports (font-variation-settings: normal) {
html {
font-family: "Inter var", sans-serif;
}
}
.app {
@apply relative w-full h-screen overflow-hidden;
}
.home {
@apply w-fit xl:h-full flex xl:justify-between justify-start items-start flex-col xl:py-8 xl:px-36 sm:p-8 p-6 max-xl:gap-7 absolute z-10;
}
.home-content {
@apply flex-1 xl:justify-center justify-start flex flex-col gap-10;
}
.head-text {
@apply xl:text-[10rem] text-[6rem] xl:leading-[11rem] leading-[7rem] font-black text-black;
}
.download-btn {
@apply w-14 h-14 flex justify-center items-center rounded-full glassmorphism cursor-pointer outline-none;
}
.editortabs-container {
@apply glassmorphism w-16 border-[2px] rounded-lg flex flex-col justify-center items-center ml-1 py-4 gap-4;
}
.filtertabs-container {
@apply absolute z-10 bottom-5 right-0 left-0 w-full flex justify-center items-center flex-wrap gap-4;
}
.aipicker-container {
@apply absolute left-full ml-3 glassmorphism p-3 w-[195px] h-[220px] rounded-md flex flex-col gap-4;
}
.aipicker-textarea {
@apply w-full bg-transparent text-sm border border-gray-300 p-2 outline-none flex-1;
}
.filepicker-container {
@apply absolute left-full ml-3 glassmorphism p-3 w-[195px] h-[220px] flex flex-col rounded-md;
}
.filepicker-label {
@apply border border-gray-300 py-1.5 px-2 rounded-md shadow-sm text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 cursor-pointer w-fit;
}
.tab-btn {
@apply w-14 h-14 flex justify-center items-center cursor-pointer select-none;
}
.glassmorphism {
background: rgba(255, 255, 255, 0.25);
box-shadow: 0 2px 30px 0 rgba(31, 38, 135, 0.07);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.18);
}
input[type="file"] {
z-index: -1;
position: absolute;
opacity: 0;
}
.sketch-picker {
width: 170px !important;
background: rgba(255, 255, 255, 0.25) !important;
box-shadow: 0 2px 30px 0 rgba(31, 38, 135, 0.07) !important;
backdrop-filter: blur(4px) !important;
-webkit-backdrop-filter: blur(4px) !important;
border: 1px solid rgba(255, 255, 255, 0.18) !important;
border-radius: 6px !important;
}
.sketch-picker > div:nth-child(3) {
display: none !important;
}
Assets used in the project are here
Advance your skills with Next.js 14 Pro Course
Enjoyed creating this project? Dive deeper into our PRO courses for a richer learning adventure. They're packed with detailed explanations, cool features, and exercises to boost your skills. Give it a go!
![Project Banner](https://private-user-images.githubusercontent.com/151519281/289158181-557837ce-f612-4530-ab24-189e75133c71.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MTU1NzIsIm5iZiI6MTcyNDYxNTI3MiwicGF0aCI6Ii8xNTE1MTkyODEvMjg5MTU4MTgxLTU1NzgzN2NlLWY2MTItNDUzMC1hYjI0LTE4OWU3NTEzM2M3MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxOTQ3NTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01NTQ0NDkzNjBjYjk2ZTc3MWJjNzEwMTljOTE4OTYyMjdlMTQ1Zjc1N2ZlZWVhYjgzN2VmZjA5MjI4NzUxYWQ1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.WXPYUyegKfDBRh7nXINsjjt7VET1BPTXZqQtmaynYEo)
Accelerate your professional journey with the Expert Training program
And if you're hungry for more than just a course and want to understand how we learn and tackle tech challenges, hop into our personalized masterclass. We cover best practices, different web skills, and offer mentorship to boost your confidence. Let's learn and grow together!
![Project Banner](https://private-user-images.githubusercontent.com/151519281/289158263-fed352ad-f27b-400d-9b8f-c7fe628acb84.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MTU1NzIsIm5iZiI6MTcyNDYxNTI3MiwicGF0aCI6Ii8xNTE1MTkyODEvMjg5MTU4MjYzLWZlZDM1MmFkLWYyN2ItNDAwZC05YjhmLWM3ZmU2MjhhY2I4NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxOTQ3NTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNDhlMGRiZTdjNjhhZDIxMTZhMzAxMzNkZjJlOWVhNjcwZWNhNmM3ZjBjZTBmYzVmMWIzNzljZmE0MDM4N2UxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.DC8NHsqtD5BCjYKJDM4lpRki3hnx1j71BTFoeX3WJsQ)