<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Pratik Parmar - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Pratik Parmar - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 16 Jun 2026 05:47:43 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/hackyroot/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to wish someone Happy Birthday using Augmented Reality ]]>
                </title>
                <description>
                    <![CDATA[ I have a friend who’s birthday was coming up, so I wanted to do something special for her. As she is a TechGeek just like me, so I couldn’t just get her a simple birthday present like a teddy bear or chocolates. So, I started looking for unique ways ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-wish-someone-happy-birthday-using-augmented-reality-3809776cb655/</link>
                <guid isPermaLink="false">66bb8ede7a6500a14ba5b781</guid>
                
                    <category>
                        <![CDATA[ Apps ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Augmented Reality ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Virtual Reality ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Pratik Parmar ]]>
                </dc:creator>
                <pubDate>Fri, 29 Jun 2018 17:43:43 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*R6c3P43LzQgB6d3khSNnRQ.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I have a friend who’s birthday was coming up, so I wanted to do something special for her. As she is a TechGeek just like me, so I couldn’t just get her a simple birthday present like a teddy bear or chocolates. So, I started looking for unique ways to wish her a happy birthday on the Web.</p>
<p>I ended up watching a <a target="_blank" href="https://youtu.be/O_EUnGMJtLA">video</a> where a guy was proposing to a girl using VR. So, I decided — that was it! That was how I was gonna do it. Not the proposal part though.</p>
<p>While I was contributing to Mozilla, I’d created few small VR projects using <a target="_blank" href="https://aframe.io/"><strong>A-Frame</strong></a> <strong>—</strong> Mozilla’s web-framework for building virtual reality experiences. And believe me, even if you don’t know much about VR or AR, you can easily create a VR scene using A-Frame. The only prerequisite is HTML, which you can learn easily <a target="_blank" href="https://www.w3schools.com/Html/">here</a>. For a better understanding, though, I recommend that you go through <a target="_blank" href="https://aframe.io/aframe-school/#/">A-Frame School</a>, which is a great collection of tutorials intended for beginners.</p>
<p>So I’d decided that I was gonna use A-Frame, but I wanted more than just a simple VR scene displaying “Happy Birthday.” In the end, I chose to create an AR scene. I found a great project called <a target="_blank" href="https://github.com/jeromeetienne/AR.js/blob/master/README.md">AR.js</a><strong>.</strong> If you wanna get started with AR.js, here is a <a target="_blank" href="https://medium.com/arjs/augmented-reality-in-10-lines-of-html-4e193ea9fdbf">great article for beginners</a><strong>.</strong></p>
<h3 id="heading-building-a-basic-ar-web-app">Building a basic AR web app</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*R6c3P43LzQgB6d3khSNnRQ.jpeg" alt="Image" width="800" height="600" loading="lazy">
<em>AR Scene, created using AR.js</em></p>
<p>To watch the AR scene, you have to:</p>
<ul>
<li>Open this <a target="_blank" href="https://jeromeetienne.github.io/AR.js/data/images/HIRO.jpg">HIRO marker image</a> in your desktop browser.</li>
<li>Open this AR web app in your phone browser, and point it to your screen.</li>
</ul>
<p>When you scan a marker (here, a HIRO marker), it’ll display an AR scene on your phone, just like the image above. I used a plain HIRO marker, but you can <a target="_blank" href="https://medium.com/arjs/how-to-create-your-own-marker-44becbec1105">create your own marker as well</a>.</p>
<p>So, after adding all these libraries, my code looked like this:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*VpWtY3jmzmc5ftAM23SRPA.png" alt="Image" width="800" height="265" loading="lazy">
_Basic AR web app [ [Demo](https://hackyroot.github.io/A-Frame-Examples/Happy_Birthday/Basic.html" rel="noopener" target="<em>blank" title=") ]</em></p>
<p>Please note that while accessing any AR web app, if you get any prompt asking permission to access the webcam, please allow it. Otherwise the app won’t work.</p>
<h3 id="heading-add-3d-models-and-fonts">Add 3D models and fonts</h3>
<p>So, now we have simple AR web app working on our device. But what’s a birthday without <strong>cake</strong>?! Fortunately, A-Frame supports three types of 3D models: <a target="_blank" href="https://aframe.io/docs/0.8.0/components/gltf-model.html">glTF</a>, <a target="_blank" href="https://aframe.io/docs/0.8.0/components/obj-model.html">OBJ</a>, and <a target="_blank" href="https://aframe.io/docs/0.8.0/components/collada-model.html">COLLADA</a>. Learn more about 3D models in A-Frame <a target="_blank" href="https://aframe.io/docs/0.8.0/introduction/models.html">here</a>.</p>
<p>I downloaded some 3D model files of cake from <a target="_blank" href="https://poly.google.com/">Google Poly</a><strong>.</strong> You can import any asset files in A-Frame using the _ tag. You can also import separate fonts, in case you want to use a different font.</p>
<p>I was pretty convinced that A-Frame couldn’t be more awesome. But, wait…</p>
<h3 id="heading-add-audio">Add audio</h3>
<p>Birthdays are also not complete without the birthday song, right? And A-Frame supports Audio files as well. You can use the _ tag to import your files, under the  tag.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*Z7Bj8EeI8PA_MfGnUzdv5w.png" alt="Image" width="800" height="78" loading="lazy">
<em>Import asset files</em></p>
<h3 id="heading-add-particles">Add particles</h3>
<p>What’s the thing that comes to your mind when you hear about a birthday — after cake, of course? A <strong>party,</strong> right? So, let’s add confetti to our AR scene, using <a target="_blank" href="https://github.com/IdeaSpaceVR/aframe-particle-system-component">A-Frame’s Particle System Component</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*WRq3LqBLvxy8aQIuH3J2zA.png" alt="Image" width="800" height="50" loading="lazy">
<em>Add libraries for confetti and 3D text</em></p>
<h3 id="heading-lets-put-it-all-together">Let’s put it all together</h3>
<h4 id="heading-3d-models">3D Models</h4>
<p>This code will display the 3D model of the cake. But as you can see, I’ve added a few values in the <em>rotation</em> and <em>scale</em> fields. So, let’s discuss that. According to A-frame’s <a target="_blank" href="https://github.com/aframevr/aframe/blob/master/docs/components/rotation.md">GitHub page</a>:</p>
<ul>
<li><strong>Rotation</strong>: the rotation component defines the orientation of an entity in degrees. It takes the pitch (<code>x</code>), yaw (<code>y</code>), and roll (<code>z</code>) as three space-delimited numbers indicating degrees of rotation.</li>
<li><strong>Scale</strong>: the scale component defines a shrinking, stretching, or skewing transformation of an entity. It takes three scaling factors for the X, Y, and Z axes.</li>
<li><strong>MTL:</strong> stands for Material Library File (.<strong>mtl</strong>) Material library <strong>files</strong> contain one or more material definitions, each of which includes the color, texture, and reflection map of individual materials. These are applied to the surfaces and vertices of objects. Material <strong>files</strong> are stored in ASCII format and have the .<strong>mtl</strong> extension.</li>
<li><strong>OBJ</strong>: a file format that was created as a simple way to import and export geometry from different 3D applications. This is a common file type used by many 3D design solutions.</li>
<li><strong>Suggestion</strong>: If you don’t see your model, try scaling it down. OBJ models generally have extremely large scales in comparison to A-Frame’s scale.</li>
</ul>
<p>If you’re wondering how I knew the exact values for rotation, well I didn’t. I used an amazing tool created by the Mozilla team called <a target="_blank" href="https://github.com/aframevr/aframe-inspector">A-Frame Inspector</a>, built for this purpose only.</p>
<p>To learn more about <em>&lt;a-obj-model</em>&gt;, visit <a target="_blank" href="https://aframe.io/docs/0.8.0/primitives/a-obj-model.html">thi</a>s link.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*588pLp64QgtSVHgXeq-4rg.png" alt="Image" width="800" height="45" loading="lazy">
<em>Display 3D model of Cake</em></p>
<h4 id="heading-particles">Particles</h4>
<p>Well, this code may look overwhelming at first sight, but believe me, it’s not. We discussed Rotation earlier, but let’s talk about other fields as well:</p>
<ul>
<li><strong>Position</strong>: places entities at certain spots in 3D space. The Position takes a coordinate value as three space-delimited numbers.</li>
<li><strong>Preset</strong>: preset configuration. Possible values are: <code>default</code>, <code>dust</code>, <code>snow</code>, <code>rain</code>. Here we chose default in order to display starts.</li>
<li><strong>Color</strong>: describes a particle’s color. This property is a “value-over-lifetime” property, meaning an array of values can be given to describe specific value changes over a particle’s lifetime.</li>
<li><strong>Acceleration Value</strong>: describes this emitter’s base acceleration.</li>
<li><strong>Particle Count</strong>: the total number of particles this emitter will hold.</li>
<li><strong>Direction</strong>: the direction of the emitter. If the value is <code>1</code>, the emitter will start at beginning of particle's lifecycle. If the value is <code>-1</code>, the emitter will start at end of particle's lifecycle and work it's way backward.</li>
<li><strong>Rotation Axis</strong>: Describes this emitter’s axis of rotation. Possible values are <code>x</code>, <code>y</code> and <code>z</code>.</li>
</ul>
<p>To know more about A-Frame’s Particle Component System<em>,</em> visit this <a target="_blank" href="https://www.npmjs.com/package/aframe-particle-system-component">link</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*lryKm0DHjxWdXL2on4uiig.png" alt="Image" width="800" height="72" loading="lazy"></p>
<h4 id="heading-text-and-audio">Text and Audio</h4>
<p>Well, you use can use _ as well, but I decided to go <a target="_blank" href="https://www.npmjs.com/package/aframe-text-geometry-component">with Text Geometry Com</a>ponent for more options. It’s used to generate text as a single geometry.</p>
<ul>
<li><strong>Material</strong> : The text geometry component defines just the geometry. We can apply any three.js material to the geometry.</li>
</ul>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">a-entity</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"value: HELLO"</span> <span class="hljs-attr">material</span>=<span class="hljs-string">"color: red; src: #texture"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">a-entity</span>&gt;</span>
</code></pre>
<p>For more details, visit three.js’s <a target="_blank" href="https://threejs.org/docs/">documentation</a>.</p>
<ul>
<li><strong>Text Geometry</strong>: string and font value. (you should edit the text in this part, otherwise you’ll end up wishing happy birthday to my friend ??)</li>
<li><strong>Sound</strong>: defines the entity as a source of sound or audio.</li>
<li><strong>Autoplay</strong><em>:</em> describes whether to automatically play the sound once set.</li>
<li><strong>Loop</strong><em>:</em> describes whether to loop the sound once the sound finishes playing.</li>
<li><strong>On</strong>: an event for the entity to listen to before playing sound.</li>
</ul>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*YVFBn6QETdSUvbtRwLS5zw.png" alt="Image" width="800" height="119" loading="lazy"></p>
<h3 id="heading-resources">Resources:</h3>
<ul>
<li><a target="_blank" href="https://github.com/HackyRoot/A-Frame-Examples/tree/master/Happy_Birthday">Source code</a></li>
<li><a target="_blank" href="https://hackyroot.github.io/A-Frame-Examples/Happy_Birthday/demo.html">Demo</a></li>
</ul>
<p>Yes, you made it ? ? ?. You’ve created your fi<strong>rst AR application. I</strong>f you did everything correctly, you should now see something like the image below:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*zZc5N-LaMQm9iXPFOG6I5g.jpeg" alt="Image" width="720" height="720" loading="lazy">
<em>Finally, Happy Birthday Krupa!</em></p>
<p>If you like my work, please follow me on Medium @<a target="_blank" href="https://www.freecodecamp.org/news/how-to-wish-someone-happy-birthday-using-augmented-reality-3809776cb655/undefined">Pratik Parmar</a> or add me on <a target="_blank" href="https://www.linkedin.com/in/pratik-parmar-8853597a/">LinkedIn</a>. Feel free to reach out to me on Twitter: <a target="_blank" href="https://www.freecodecamp.org/news/how-to-wish-someone-happy-birthday-using-augmented-reality-3809776cb655/undefined">Pratik Parmar</a> or comment down below, in case you need any help.</p>
<p>Apart from Open-source contributions at Mozilla, I’m a Microsoft Student Partner and community member at GDG Baroda. I would like to thank <a target="_blank" href="https://www.freecodecamp.org/news/how-to-wish-someone-happy-birthday-using-augmented-reality-3809776cb655/undefined">Mozilla</a> and the <a target="_blank" href="https://twitter.com/MozillaIN">MozillaIN</a> community for providing me a chance and the resources to learn about VR/AR and Open Source.</p>
<p>This is me, <strong>Pratik Parmar</strong> signing off till the next tech adventure. Over and Out…</p>
<p>[ Edit: Thank you <a target="_blank" href="https://www.freecodecamp.org/news/how-to-wish-someone-happy-birthday-using-augmented-reality-3809776cb655/undefined">Vikranth Kanumuru</a> for drawing my attention that URL of source code was broken. It’s been updated now, please go ahead and try now. Keep coding, keep rocking ]</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
