<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Himanshu Jain</title>
    <description>The latest articles on DEV Community by Himanshu Jain (@himj266).</description>
    <link>https://dev.to/himj266</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F483037%2F85ab76ee-b9e1-4b62-b51d-1870a2e3525d.jpg</url>
      <title>DEV Community: Himanshu Jain</title>
      <link>https://dev.to/himj266</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/himj266"/>
    <language>en</language>
    <item>
      <title>My Journey into Framer Motion: Building a Typewriter</title>
      <dc:creator>Himanshu Jain</dc:creator>
      <pubDate>Tue, 23 Dec 2025 09:36:42 +0000</pubDate>
      <link>https://dev.to/himj266/my-journey-into-framer-motion-building-a-typewriter-5dgf</link>
      <guid>https://dev.to/himj266/my-journey-into-framer-motion-building-a-typewriter-5dgf</guid>
      <description>&lt;p&gt;So, I’ve been diving into &lt;strong&gt;Framer Motion&lt;/strong&gt; lately and decided to create the classic: &lt;strong&gt;Typewriter effect&lt;/strong&gt;. It looks super professional, but once you break it down, the logic is actually really elegant. Here’s how I built it and what I learned along the way.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Strategy: Break It Down
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;const characters = Array.from(text);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The first thing the code does is split the text. We use &lt;code&gt;Array.from(text)&lt;/code&gt; to turn a string into an array of individual characters.&lt;/p&gt;

&lt;p&gt;The reason for this is simple: to animate each character individually, they each need their own "seat" (an HTML element) in the DOM. If the text stayed as one long string, Framer Motion would just animate the whole block at once.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The Power of Variants
&lt;/h3&gt;

&lt;p&gt;This is where it gets cool. I learned and used a concept called &lt;strong&gt;Variants&lt;/strong&gt; in Framer Motion. Think of variants as "labels" for your animation states. Instead of writing messy inline styles, you define a &lt;code&gt;hidden&lt;/code&gt; state and a &lt;code&gt;visible&lt;/code&gt; state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const containerVariants = {
    hidden: { opacity: 1 },
    visible: {
      opacity: 1,
      transition: {
        delayChildren: delay,
        staggerChildren: duration,
      },
    },
  };

  const characterVariants = {
    hidden: { opacity: 0, y: 5 },
    visible: {
      opacity: 1,
      y: 0,
      transition: {
        type: "spring" as AnimationGeneratorType,
        damping: 12,
        stiffness: 200,
      },
    },
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s powerful here is the &lt;strong&gt;Parent-Child control&lt;/strong&gt;. By giving the container a variant label like "visible," it automatically tells all the children (the letters) to switch to their "visible" state too. It’s like a conductor leading an orchestra.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The "Double Hiding" Gotcha
&lt;/h3&gt;

&lt;p&gt;One thing that tripped me up was setting the container's opacity. You’ll notice in the &lt;code&gt;hidden&lt;/code&gt; variant, the container is actually set to &lt;code&gt;opacity: 1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Wait, why? Well, if the container is hidden &lt;em&gt;and&lt;/em&gt; the letters are hidden, you get "double hiding." When the animation starts, the whole box would fade in while the letters are also fading in—it looks messy. By keeping the container at &lt;code&gt;opacity: 1&lt;/code&gt;, the "box" is always there, and we only see the magic of the letters appearing one by one.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Orchestration: Staggering
&lt;/h3&gt;

&lt;p&gt;The "typewriter" feel comes from two specific transition properties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;delayChildren&lt;/strong&gt;: This sets a countdown before the first letter even thinks about moving.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;staggerChildren&lt;/strong&gt;: This is the secret sauce. It sets a tiny time gap (like 0.05s) between each subsequent character. Instead of a "pop," you get that rhythmic, rolling reveal.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Adding Some "Spring"
&lt;/h3&gt;

&lt;p&gt;Instead of a boring, flat animation, I used a &lt;code&gt;spring&lt;/code&gt; transition for the characters. By playing with &lt;code&gt;stiffness&lt;/code&gt; and &lt;code&gt;damping&lt;/code&gt;, the letters don't just appear—they kind of snap into place with a bit of life. It makes the digital text feel a bit more tactile and physical.&lt;/p&gt;




&lt;p&gt;

&lt;iframe src="https://codesandbox.io/embed/r43jzd"&gt;
&lt;/iframe&gt;


&lt;/p&gt;

&lt;h3&gt;
  
  
  What's next?
&lt;/h3&gt;

&lt;p&gt;Now that We've got the basics down, we can try thinking about how to speed it up. If we wanted to write "two words at a time" for a faster read, how can we achieve that?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>tutorial</category>
      <category>animation</category>
    </item>
    <item>
      <title>Authentication Vs Authorization</title>
      <dc:creator>Himanshu Jain</dc:creator>
      <pubDate>Sun, 06 Jul 2025 20:40:59 +0000</pubDate>
      <link>https://dev.to/himj266/authentication-vs-authorization-37eb</link>
      <guid>https://dev.to/himj266/authentication-vs-authorization-37eb</guid>
      <description>&lt;p&gt;I recently stumbled upon this age-old question about the difference between &lt;strong&gt;Authentication and Authorization&lt;/strong&gt; while working on the sign-in page using OAuth 2.0 for a project. I realised OAuth 2.0 is primarily an authorization protocol and uses OIDC (Open ID Connect) to authenticate.&lt;/p&gt;

&lt;p&gt;Here's how I like to think about the difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication is &lt;strong&gt;Who You are?&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Authorization is &lt;strong&gt;What You Are Allowed To Access?&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's break it down with an example. Suppose you(client application) want to check into a hotel, you'll first need to provide the booking details and some identity card(login info) for the hotel to identify you (&lt;strong&gt;Who You Are&lt;/strong&gt;). The hotel authenticates you and then provides you access to a single room and other amenities like the pool, the gym, breakfast area, i.e, you are allowed to access only certain areas (&lt;strong&gt;What You Are Allowed To Access&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;A real-world example is, when we click on a sign-in using Google button in an application we are first routed to a sign in page (&lt;strong&gt;Authentication&lt;/strong&gt;) which prompts us to enter the password if the user is not already signed in and then we go to the page where we are asked to select all the permission that we are allowing the application to access on behalf of our user (&lt;strong&gt;Authorization&lt;/strong&gt;)&lt;/p&gt;

&lt;p&gt;These two are mostly implemented separately because they provide: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability: We can have different authentication providers that are responsible for Authentication while needing the same Authorization needs for the application.&lt;/li&gt;
&lt;li&gt;Security: Even if someone bypasses authentication, they will still need authorization access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the separation of concerns allows granular and maintainable implementations.&lt;/p&gt;

</description>
      <category>oauth</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>React Fiber - Rotating A Cube</title>
      <dc:creator>Himanshu Jain</dc:creator>
      <pubDate>Wed, 14 May 2025 23:51:27 +0000</pubDate>
      <link>https://dev.to/himj266/react-fiber-rotating-a-cube-4mm3</link>
      <guid>https://dev.to/himj266/react-fiber-rotating-a-cube-4mm3</guid>
      <description>&lt;p&gt;In the previous post, we successfully rendered our first cube! (See it in action) &lt;iframe src="https://codesandbox.io/embed/3d-cube-78wyw6"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Now, let's add some movement and transform that static cube into a dynamic object.&lt;/p&gt;

&lt;p&gt;For A quick refresher on  three js and three fiber you can follow this &lt;a href="https://dev.to/himj266/delving-into-the-world-of-3d-web-from-webgl-to-threejs-and-react-three-fiber-23kh"&gt;article&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We'll be using the &lt;a href="https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe" rel="noopener noreferrer"&gt;useFrame&lt;/a&gt; hook from react-three/fiber. This hook plays a crucial role in creating animations&lt;/p&gt;

&lt;h2&gt;
  
  
  UseFrame
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useFrame&lt;/code&gt; hook takes a callback function as an argument and calls it just before each animation loop. The callback function receives two arguments &lt;code&gt;state&lt;/code&gt; and &lt;code&gt;delta&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;State&lt;/strong&gt; - This is the object that stores a lot of information about the current state, It contains information like:

&lt;ol&gt;
&lt;li&gt;Clock - A three js clock object which tell us the current time and the delta time.&lt;/li&gt;
&lt;li&gt;Camera - A reference to the current active camera in the scene.&lt;/li&gt;
&lt;li&gt;Scene - A reference to the root scene object.&lt;/li&gt;
&lt;li&gt;gl - reference to the webGL rendering context.&lt;/li&gt;
&lt;li&gt;size - an object with height and width of the canvas.&lt;/li&gt;
&lt;li&gt;Viewport - an object containing the size of viewport in pixels.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delta&lt;/strong&gt; - This number denotes the time elapsed after the last frame in seconds. It can be used to create the frame-independent animations, for eg: we can multiply the delta value with the desired change in position or rotation to ensure no matter what the frame rate of the device is, the objects are at the correct position.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While useFrame is powerful for animations, it's important to avoid performing heavy calculations within the callback function. This can negatively impact performance and cause stuttering in your animation. &lt;/p&gt;

&lt;h2&gt;
  
  
  Rotating the Cube
&lt;/h2&gt;

&lt;p&gt;Enough theory, let's get into the action, we will store the reference of our Box geometry and in each animation loop, change the rotation by some factor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useRef } from "react";

import { OrbitControls, Box } from "@react-three/drei";
import { Canvas, useFrame } from "@react-three/fiber";

//type
import type { Mesh } from "three";

const ROTATION_SPEED = 0.005;

function Cube() {
  const boxRef = useRef&amp;lt;Mesh&amp;gt;(null);

  useFrame(() =&amp;gt; {
    if (boxRef.current) {
      boxRef.current.rotation.x += ROTATION_SPEED;
      boxRef.current.rotation.y += ROTATION_SPEED;
    }
  });

  return (
    &amp;lt;Box ref={boxRef}&amp;gt;
      &amp;lt;meshBasicMaterial color="orange" /&amp;gt;
    &amp;lt;/Box&amp;gt;
  );
}

export default function App() {
  return (
    &amp;lt;div style={{ height: "100vh", width: "100vw" }}&amp;gt;
      &amp;lt;Canvas&amp;gt;
        &amp;lt;OrbitControls /&amp;gt;
        &amp;lt;gridHelper /&amp;gt;
        &amp;lt;Cube /&amp;gt;
      &amp;lt;/Canvas&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/3d-cube-rotation-gkxtqs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;As a fun practice exercise, try creating a sphere that moves up and down repeatedly. &lt;/p&gt;

</description>
      <category>threejs</category>
      <category>webdev</category>
      <category>react</category>
      <category>3dweb</category>
    </item>
    <item>
      <title>Delving into the World of 3D Web: From WebGL to ThreeJs and React Three Fiber</title>
      <dc:creator>Himanshu Jain</dc:creator>
      <pubDate>Wed, 19 Mar 2025 10:49:00 +0000</pubDate>
      <link>https://dev.to/himj266/delving-into-the-world-of-3d-web-from-webgl-to-threejs-and-react-three-fiber-23kh</link>
      <guid>https://dev.to/himj266/delving-into-the-world-of-3d-web-from-webgl-to-threejs-and-react-three-fiber-23kh</guid>
      <description>&lt;p&gt;Have you came across some interesting websites like this famous one &lt;a href="https://bruno-simon.com/" rel="noopener noreferrer"&gt;https://bruno-simon.com/&lt;/a&gt; and wondered how all this is achieved in a web browser since creating these complex animations isn't possible with just HTML and CSS. Well, the magic lies in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API" rel="noopener noreferrer"&gt;WebGL&lt;/a&gt;, a Javascript API to render high-performant 2d and 3d elements. WebGL leverages the hardware GPUs and hence can render the high interactive elements.&lt;br&gt;
While WebGL offers all such advantages, it is still a very low-level API, and creating things out of it requires quite a bit of code. This is where &lt;strong&gt;ThreeJs&lt;/strong&gt; steps in&lt;/p&gt;
&lt;h2&gt;
  
  
  ThreeJs
&lt;/h2&gt;

&lt;p&gt;ThreeJs is an open-source library that uses WebGL renderer and provides a more declarative and a lot easier way to create and render 2d and 3d graphics and animation on the web browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://threejs.org/manual/#en/fundamentals" rel="noopener noreferrer"&gt;The official documentation&lt;/a&gt; offers a comprehensive deep dive into ThreeJS. Let's quickly go through the main objects of it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F366wedm1ips9tbwjdw8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F366wedm1ips9tbwjdw8h.png" alt="Three JS App" width="226" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Renderer&lt;/strong&gt; - This is the main object that renders the objects that are part of the area covered by the camera, it can be your webGL renderer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scene&lt;/strong&gt; - This consists of all your various objects, like &lt;strong&gt;light&lt;/strong&gt;, &lt;strong&gt;camera&lt;/strong&gt;, &lt;strong&gt;geometries&lt;/strong&gt;, &lt;strong&gt;meshes&lt;/strong&gt;. These all things are arranged in scenes in a parent-child tree structure and are referred to as &lt;a href="https://threejs.org/manual/#en/scenegraph" rel="noopener noreferrer"&gt;scenegraph&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geometry&lt;/strong&gt; - This is an object consisting of the vertex of the shapes like sphere, cube etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Material&lt;/strong&gt; - While geometry represents the vertices the material represents the surface properties of our shapes, for eg: the color of the surfaces, the transparency, reflection properties, etc:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mesh&lt;/strong&gt;- A mesh combines a geometry and a material, giving your object a visible representation. You can have multiple meshes with the same geometry and material to create identical objects in different locations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Texture&lt;/strong&gt; - These represents loaded images that can be used by our materials over which we can wrap these images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Light&lt;/strong&gt; -  Lights objects illuminate your scene and create a sense of depth and dimension. Various types of lights exist, such as point lights, ambient lights, and directional lights.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  React Three Fiber
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://r3f.docs.pmnd.rs/getting-started/introduction" rel="noopener noreferrer"&gt;React Three Fiber&lt;/a&gt; acts as a bridge between the powerful capabilities of Three.js and the declarative nature of React development. It streamlines the process of creating and manipulating 3D scenes within your React applications.&lt;/p&gt;

&lt;p&gt;Here's how with normal three js we will need to do the following things to create a scene. Render a canvas element get its reference, create renderer, camera, and scene objects, define our geometry material and mesh then add all of them to the scene object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const canvas = document.querySelector('#c');
const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000)

const renderer = new THREE.WebGLRenderer()
renderer.setSize(width, height)
document.querySelector('#canvas-container').appendChild(renderer.domElement)

const mesh = new THREE.Mesh()
mesh.geometry = new THREE.BoxGeometry()
mesh.material = new THREE.MeshStandardMaterial()

scene.add(mesh)

function animate() {
  requestAnimationFrame(animate)
  renderer.render(scene, camera)
}

animate()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;whereas with react three fiber it is as simple as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Canvas} from "@react-three/fiber";

&amp;lt;Canvas&amp;gt;
 &amp;lt;mesh&amp;gt;
    &amp;lt;boxGeometry /&amp;gt;
    &amp;lt;meshBasicMaterial /&amp;gt;
  &amp;lt;/mesh&amp;gt;
&amp;lt;/Canvas&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next Step: &lt;a href="https://dev.to/himj266/react-three-fiber-hello-world-5415"&gt;Let's learn to write our hello world code with react three fiber&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>3dweb</category>
      <category>threejs</category>
      <category>beginners</category>
    </item>
    <item>
      <title>React Three Fiber - Hello World</title>
      <dc:creator>Himanshu Jain</dc:creator>
      <pubDate>Wed, 19 Mar 2025 10:42:50 +0000</pubDate>
      <link>https://dev.to/himj266/react-three-fiber-hello-world-5415</link>
      <guid>https://dev.to/himj266/react-three-fiber-hello-world-5415</guid>
      <description>&lt;p&gt;Creating this series &lt;br&gt;
In the world of 3d development, the classic "Hello World" program generally involves rendering a cube. Let's create one ourselves using React Three Js and React Three Fiber.&lt;/p&gt;

&lt;p&gt;Creating a cube is fairly simple with react three fiber and react three drei but we will first setup our scene before rendering any of the geometry or meshes.&lt;/p&gt;

&lt;p&gt;If terms like Meshes, geometry, and scene sound unfamiliar, fear not! Before diving in, we recommend checking out this helpful resource also: &lt;a href="https://dev.to/himj266/delving-into-the-world-of-3d-web-from-webgl-to-threejs-and-react-three-fiber-23kh"&gt;What is ThreeJS and ReactThree Fiber&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0897amke30omx45zn3zx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0897amke30omx45zn3zx.png" alt="They're speaking language of gods meme" width="736" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's get started with setting up our scene&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { OrbitControls } from "@react-three/drei";
import { Canvas } from "@react-three/fiber";

export default function App() {
  return (
    &amp;lt;div style={{ height: "100vh", width: "100vw" }}&amp;gt;
      &amp;lt;Canvas&amp;gt;
        &amp;lt;OrbitControls /&amp;gt;
        &amp;lt;gridHelper /&amp;gt;
      &amp;lt;/Canvas&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Scene Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Canvas&lt;/code&gt; - This is the essential component for most React Three Fiber applications. It acts as a container, providing context for other Three.js components like lights, cameras, and meshes. It also renders the HTML &lt;code&gt;canvas&lt;/code&gt; element where your 3D graphics are displayed and updates it for animations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;OrbitControls&lt;/code&gt; - This component allows you to explore the scene using your mouse, similar to how a camera can pan, zoom, and rotate around a physical space. We're using it with gridHelper for beginners to visualize the scene layout easily.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;gridHelper&lt;/code&gt; - It helps to generate a grid of lines with specified dimensions which helps us to visualize the scale of the scene by providing reference points.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should now see a gray line in the browser. If you move your mouse while clicking, you'll see the entire grid appear.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/kl2kc3"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Rendering The Cube
&lt;/h2&gt;

&lt;p&gt;Now, let's render the cube using BoxGeometry from Three.js and meshBasicMaterial to define its color.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { ..., Box } from "@react-three/drei";

export default function App() {
  return (
    &amp;lt;div style={{ height: "100vh", width: "100vw" }}&amp;gt;
      &amp;lt;Canvas&amp;gt;
      ...
        &amp;lt;Box&amp;gt;
          &amp;lt;meshBasicMaterial color="orange" /&amp;gt;
        &amp;lt;/Box&amp;gt;
      &amp;lt;/Canvas&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Box&lt;/code&gt;: This component from @react-three/drei is a simple wrapper around Three.js's BoxGeometry. Geometry defines the shape of an object using sets of point coordinates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;meshBasicMaterial&lt;/code&gt;: This is a basic material provided by Three.js. Materials describe the visual properties of a geometry's faces, including color, opacity, and more.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/3d-cube-78wyw6"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Congratulations, we have just rendered our first 3d scene.🎉🎉🎉&lt;br&gt;
Next Step: Let's learn to &lt;a href="https://dev.to/himj266/react-fiber-rotating-a-cube-4mm3"&gt;rotate the cube&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fffrclfmw2hflgpcmamgm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fffrclfmw2hflgpcmamgm.png" alt="Hello world meme" width="800" height="731"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>threejs</category>
      <category>3dweb</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
