3D animated TIlt card design
3D animated TIlt card design
It seems like you're building a blog post and providing various code snippets and tutorial content. Below is the refined and improved version of your HTML example, along with comments added to the code for clarity. This code is specifically for creating 3D animated tilt cards using Tilt.js and CSS.
3D Tilt Card Design Example (HTML, CSS, and JS)
index.html
style.css
Explanation and Comments:
-
HTML Structure:
- The HTML contains a
.container
div that holds multiple.card
divs. Each card is decorated with adata-tilt
attribute, which is used by Tilt.js to activate the tilt animation when hovered over. - The
<img>
tags inside the cards load images, which are used to visually represent the card.
- The HTML contains a
-
CSS Styling:
* { box-sizing: border-box; }
: Ensures that padding and borders are included in the element's total width and height.- The
.container
is styled to useflexbox
to arrange the cards in a row with equal spacing. - Each
.card
is given a fixed width and height, with rounded corners and a shadow effect to create the appearance of a 3D card. card:hover
: This provides a small scaling effect when the user hovers over the card to give it a subtle interactive feel.
-
Tilt.js Setup:
- Tilt.js is a lightweight library used to create 3D tilt animations on elements. It is initialized with specific options such as
scale
,maxTilt
,speed
, andeasing
. scale: 1.1
: Increases the card size when hovered for a more pronounced tilt effect.maxTilt: 25
: The card can tilt up to 25 degrees.speed: 400
: The transition speed for the tilt effect.easing
: Specifies the easing function for the tilt animation.
- Tilt.js is a lightweight library used to create 3D tilt animations on elements. It is initialized with specific options such as
-
jQuery:
- jQuery is used to ensure that the DOM is fully loaded before applying the
tilt()
function to the.card
elements.
- jQuery is used to ensure that the DOM is fully loaded before applying the
Conclusion:
This setup creates an interactive, 3D tilt effect on the cards using Tilt.js, which is powered by jQuery for better browser compatibility. You can easily add or remove cards and customize the images as needed. The effect adds a professional touch to any website, especially for portfolios or product showcases.
Feel free to adapt the code to your blog content by following the structure and adding your own content!
Comments
Post a Comment