Component
3D Buy Card Animation in Framer
This is a 3D buy card interaction in Framer, based on Farrel's original concept. Feel free to remix the project to see how it's built or copy the component into your own project and customize it with component properties.
About the resource
This interaction can easily be achieved with Framer's 3D transforms functionality. You can apply these transforms to elements to project them in 3D space. That's how the card pack is "modelled." Each face is a different frame with a different 3D rotation.
Once the card pack is created, we can use that component within the purchase card component. It has a default and a hover variant, and we change the Y rotation on hover to 360 so it makes a full flip.
About the resource
This interaction can easily be achieved with Framer's 3D transforms functionality. You can apply these transforms to elements to project them in 3D space. That's how the card pack is "modelled." Each face is a different frame with a different 3D rotation.
Once the card pack is created, we can use that component within the purchase card component. It has a default and a hover variant, and we change the Y rotation on hover to 360 so it makes a full flip.
About the resource
This interaction can easily be achieved with Framer's 3D transforms functionality. You can apply these transforms to elements to project them in 3D space. That's how the card pack is "modelled." Each face is a different frame with a different 3D rotation.
Once the card pack is created, we can use that component within the purchase card component. It has a default and a hover variant, and we change the Y rotation on hover to 360 so it makes a full flip.
A little trick: if you want to further transform components that have 3D transforms within, apply a Preserve 3D override within the component (in this case on the "Card Packaging" component) to make sure it stays in 3D space. You can find the override below.
Preserve 3D override
You can create a code override in your project and replace the auto-generated code with the one below. If you apply this override to the component, it will get the "preserve 3D" style.
This override is useful because you can't natively apply transforms to the primary variants of the components.
A little trick: if you want to further transform components that have 3D transforms within, apply a Preserve 3D override within the component (in this case on the "Card Packaging" component) to make sure it stays in 3D space. You can find the override below.
Preserve 3D override
You can create a code override in your project and replace the auto-generated code with the one below. If you apply this override to the component, it will get the "preserve 3D" style.
This override is useful because you can't natively apply transforms to the primary variants of the components.
A little trick: if you want to further transform components that have 3D transforms within, apply a Preserve 3D override within the component (in this case on the "Card Packaging" component) to make sure it stays in 3D space. You can find the override below.
Preserve 3D override
You can create a code override in your project and replace the auto-generated code with the one below. If you apply this override to the component, it will get the "preserve 3D" style.
This override is useful because you can't natively apply transforms to the primary variants of the components.
import { useState, useEffect, ComponentType } from "react"
export function withPreserve3d(Component): ComponentType {
return (props) => {
return (
<Component {...props} style={{ transformStyle: "preserve-3d" }} />
)
}
}
import { useState, useEffect, ComponentType } from "react"
export function withPreserve3d(Component): ComponentType {
return (props) => {
return (
<Component {...props} style={{ transformStyle: "preserve-3d" }} />
)
}
}
import { useState, useEffect, ComponentType } from "react"
export function withPreserve3d(Component): ComponentType {
return (props) => {
return (
<Component {...props} style={{ transformStyle: "preserve-3d" }} />
)
}
}