<?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: Rahul Bhatt</title>
    <description>The latest articles on DEV Community by Rahul Bhatt (@rahulbhatt43).</description>
    <link>https://dev.to/rahulbhatt43</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%2F1184685%2F583700a2-25af-439a-b1d5-d7a51a0982e5.jpeg</url>
      <title>DEV Community: Rahul Bhatt</title>
      <link>https://dev.to/rahulbhatt43</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahulbhatt43"/>
    <language>en</language>
    <item>
      <title>Vanilla-Tilt Js</title>
      <dc:creator>Rahul Bhatt</dc:creator>
      <pubDate>Sat, 14 Oct 2023 04:23:06 +0000</pubDate>
      <link>https://dev.to/rahulbhatt43/vanilla-tilt-js-5e51</link>
      <guid>https://dev.to/rahulbhatt43/vanilla-tilt-js-5e51</guid>
      <description>&lt;p&gt;A smooth 3D tilt JavaScript library forked from Tilt.js.&lt;/p&gt;

&lt;p&gt;Installation using &lt;strong&gt;npm&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i vanilla-tilt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/vanilla-tiltjs-y5c78r"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
    &amp;lt;title&amp;gt;Vanilla Tilt Js&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: Arial, Helvetica, sans-serif;
      }

      .container {
        height: 100vh;
        width: 100%;
        background-color: #111;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      .card {
        width: 300px;
        height: 400px;
        border-radius: 15px;
        text-align: center;
        color: white;
        display: flex;
        flex-direction: column;
        gap: 10px;
        background-color: black;
        border: 2px solid white;
        padding: 10px 15px;
        transform-style: preserve-3d;
        transform: perspective(1000px);
        transition: 0.4s all linear;
        padding: 20px 15px;
        overflow: hidden;
      }
      .card p {
        transform: translateY(100px);
        opacity: 0;
        transition: 0.2s ease;
      }

      .card:hover {
        border: 2px solid red;
        box-shadow: 0px 0px 12px 5px red;
      }
      .card:hover p {
        transform: translateY(0px);
        opacity: 1;
      }

      .innerElem {
        transform: translateZ(20px) translateY(-100px);
        opacity: 0;
        transition: 0.2s ease;
      }
      .card:hover .innerElem {
        opacity: 1;
        transform: translateY(0px);
      }
      .card h1 {
        transition: 0.3s ease;
        font-size: 2.5rem;
      }
      .card:hover h1 {
        transform: translateY(-30px);
        opacity: 0;
        font-size: 0px;
        letter-spacing: 40px;
      }

      .innerElem img {
        object-fit: cover;
        aspect-ratio: 1/1;
        width: 140px;
        border-radius: 50%;
        transition: 0.5s all ease-in-out linear;
      }

      .card:hover img {
        outline: 4px solid black;
        outline-offset: 4px;
      }
      p button {
        border: none;
        padding: 8px 15px;
        border-radius: 20px;
        cursor: pointer;
        transition: 0.4s all ease;
      }
      p button:hover {
        background-color: #111;
        border: 1.5px solid white;
        color: white;
      }
    &amp;lt;/style&amp;gt;
  &amp;lt;/head&amp;gt;

  &amp;lt;body&amp;gt;
    &amp;lt;div class="container"&amp;gt;
      &amp;lt;div class="card" data-tilt data-tilt-scale="1.1"&amp;gt;
        &amp;lt;div class="innerElem"&amp;gt;
          &amp;lt;img
            class="image"
            src="https://cdn.pixabay.com/photo/2014/04/03/10/32/user-310807_640.png"
            alt=""
          /&amp;gt;
          &amp;lt;h3&amp;gt;Susan&amp;lt;/h3&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;h1&amp;gt;Hover Me&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;
          Lorem ipsum, dolor sit amet consectetur adipisicing elit. Rem
          exercitationem ipsum quo! Temporibus magni non doloribus quam quos
          ipsa animi eius dolores, sunt exercitationem iure. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
          &amp;lt;button&amp;gt;Read more&amp;lt;/button&amp;gt;
        &amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script type="text/javascript" src="vanilla-tilt.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="text/javascript"&amp;gt;
      VanillaTilt.init(document.querySelector(".card"), {
        max: 25,
        speed: 400,
        glare: true
      });
      VanillaTilt.init(document.querySelector(".image"), {
        max: 25,
        speed: 400
      });

      //It also supports NodeList
      // VanillaTilt.init(document.querySelectorAll(".your-element"));
    &amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Methods:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const element = document.querySelector(".js-tilt");
VanillaTilt.init(element);

// Destroy instance
element.vanillaTilt.destroy();

// Get values of instance
element.vanillaTilt.getValues();

// Reset instance
element.vanillaTilt.reset();

// It also supports NodeList
const elements = document.querySelectorAll(".js-tilt");
VanillaTilt.init(elements);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forget to download and link the vanilla-tilt.js file(if working with the static sites)&lt;/p&gt;

</description>
      <category>reactjsdevelopment</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
