Credit Card CSS3 Animation

Developer
Size
5,511 Kb
Views
20,240

How do I make an credit card css3 animation?

Based off the Dribbble shot of Linn Fritz: https://dribbble.com/shots/1528058-Oh-you-credit-card. What is a credit card css3 animation? How do you make a credit card css3 animation? This script and codes were developed by Travis Arnold on 12 September 2022, Monday.

Credit Card CSS3 Animation Previews

Credit Card CSS3 Animation - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Credit Card CSS3 Animation</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ /**********************
GENERAL STYLING
**********************/
body { font-family: 'Verdana', sans-serif; padding: 0; margin: 0; background: #ff7b4a;
}
.credit-card { position: absolute; width: 100%; height: 100%; transform-style: preserve-3d; animation: flip 3.4s infinite linear;
}
@keyframes flip { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); }
}
.front, .back { position: absolute; top: calc(50% - 30px); left: calc(50% - 50px); display: block; width: 100px; height: 60px; border-radius: 5px; backface-visibility: hidden; background: #663554;
}
/**********************
FRONT OF CARD
**********************/
.front { transform: translate3d(0, 0, 0);
}
.box { position: absolute; top: 10px; left: 6px; display: block; width: 19px; height: 15px; border-radius: 2px; background: #ffd58c; transform-origin: 0; transform: scaleX(0);
}
.box:after { content: ''; display: block; width: 1px; height: 1px; box-shadow: 9px 0 #663554, 9px 1px #663554, 9px 2px #663554, 0 3px #663554, 1px 3px #663554, 2px 3px #663554, 3px 3px #663554, 4px 3px #663554, 5px 3px #663554, 6px 3px #663554, 7px 3px #663554, 8px 3px #663554, 9px 3px #663554, 4px 4px #663554, 4px 5px #663554, 4px 6px #663554, 13px 0 #663554, 13px 1px #663554, 13px 2px #663554, 13px 3px #663554, 13px 4px #663554, 13px 5px #663554, 13px 6px #663554, 13px 7px #663554, 14px 7px #663554, 15px 7px #663554, 16px 7px #663554, 17px 7px #663554, 18px 7px #663554, 0 7px #663554, 1px 7px #663554, 2px 7px #663554, 3px 7px #663554, 4px 7px #663554, 5px 7px #663554, 6px 7px #663554, 7px 7px #663554, 8px 7px #663554, 9px 7px #663554, 9px 8px #663554, 9px 9px #663554, 9px 10px #663554, 9px 11px #663554, 9px 12px #663554, 9px 13px #663554, 9px 14px #663554, 9px 15px #663554, 18px 11px #663554, 17px 11px #663554, 16px 11px #663554, 15px 11px #663554, 14px 11px #663554, 13px 11px #663554, 12px 11px #663554, 11px 11px #663554, 10px 11px #663554, 9px 11px #663554, 8px 11px #663554, 7px 11px #663554, 6px 11px #663554, 5px 11px #663554, 4px 11px #663554, 4px 12px #663554, 4px 13px #663554, 4px 14px #663554, 4px 15px #663554;
}
@keyframes scaleBox { from { transform: scaleX(0); } to { transform: scaleX(1); }
}
.logo, .logo:before, .logo:after { position: absolute; top: 10px; right: 6px; display: block; width: 17px; height: 17px; border-radius: 50%;
}
.logo:before { content: ''; top: 0; right: 8px; background: #b38570; transform: scale(0);
}
.logo:after { content: ''; top: 0; right: 10px; background: #ffd58c; transform: scale(0);
}
@keyframes scaleLogo { 0% { transform: scale(0); } 50% { transform: scale(1.1); } 100% { transform: scale(1); }
}
@keyframes scaleLogo2 { 0% { transform: scale(0) translate(0); } 50% { transform: scale(1.1) translate(5px); } 100% { transform: scale(1) translate(8px); }
}
.number { position: absolute; bottom: 12px; right: 6px; font-size: 8px; color: #ffd58c;
}
.number:after { content: ''; position: absolute; top: 0; left: -2px; display: block; width: 94px; height: 9px; background: #663554; transform-origin: 94px; transform: scaleX(1);
}
@keyframes scaleNumber { from { transform: skew(30deg) scaleX(1); } to { transform: skew(30deg) scaleX(0); }
}
/**********************
BACK OF CARD
**********************/
.back { transform: rotateY(180deg) translate3d(0, 0, 0);
}
.scan { position: absolute; top: 10px; display: block; width: 100px; height: 13px; overflow: hidden; background: #000; transform-origin: 0; transform: scale(0);
}
.scan:after { content: ''; display: block; width: 5px; height: 100%; background: #6d5e46; box-shadow: 10px 0 #6d5e46, 14px 0 #6d5e46, 25px 0 #6d5e46; transform: skewX(-40deg) translate(110px);
}
@keyframes highlight { from { transform: skewX(-40deg) translate(-35px); } to { transform: skewX(-40deg) translate(110px); }
}
.info, .info:after { position: absolute; left: 6px; bottom: 16px; display: block; width: 38px; height: 10px; background: #ffd58c; transform-origin: 0; transform: scale(0);
}
.info:after { content: ''; top: 0; left: 44px; width: 16px;
}
.animate .box { animation: scaleBox 0.48571s forwards;
}
.animate .logo:before { animation: scaleLogo2 0.48571s 0.15s forwards;
}
.animate .logo:after { animation: scaleLogo 0.48571s forwards;
}
.animate .number:after { animation: scaleNumber 1s forwards;
}
.animate .scan { animation: scaleBox .5s forwards;
}
.animate .scan:after { animation: highlight 1.75s forwards;
}
.animate .info, .animate .info:after { animation: scaleBox 1s forwards;
}
.animate .info:after { animation: scaleBox 1s .6s forwards;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="credit-card"> <div class="front animate"> <i class="box"></i> <i class="logo"></i> <span class="number">0000 0000 0000 0000</span> </div> <div class="back"> <i class="scan"></i> <i class="info"></i> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Credit Card CSS3 Animation - Script Codes CSS Codes

/**********************
GENERAL STYLING
**********************/
body { font-family: 'Verdana', sans-serif; padding: 0; margin: 0; background: #ff7b4a;
}
.credit-card { position: absolute; width: 100%; height: 100%; transform-style: preserve-3d; animation: flip 3.4s infinite linear;
}
@keyframes flip { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); }
}
.front, .back { position: absolute; top: calc(50% - 30px); left: calc(50% - 50px); display: block; width: 100px; height: 60px; border-radius: 5px; backface-visibility: hidden; background: #663554;
}
/**********************
FRONT OF CARD
**********************/
.front { transform: translate3d(0, 0, 0);
}
.box { position: absolute; top: 10px; left: 6px; display: block; width: 19px; height: 15px; border-radius: 2px; background: #ffd58c; transform-origin: 0; transform: scaleX(0);
}
.box:after { content: ''; display: block; width: 1px; height: 1px; box-shadow: 9px 0 #663554, 9px 1px #663554, 9px 2px #663554, 0 3px #663554, 1px 3px #663554, 2px 3px #663554, 3px 3px #663554, 4px 3px #663554, 5px 3px #663554, 6px 3px #663554, 7px 3px #663554, 8px 3px #663554, 9px 3px #663554, 4px 4px #663554, 4px 5px #663554, 4px 6px #663554, 13px 0 #663554, 13px 1px #663554, 13px 2px #663554, 13px 3px #663554, 13px 4px #663554, 13px 5px #663554, 13px 6px #663554, 13px 7px #663554, 14px 7px #663554, 15px 7px #663554, 16px 7px #663554, 17px 7px #663554, 18px 7px #663554, 0 7px #663554, 1px 7px #663554, 2px 7px #663554, 3px 7px #663554, 4px 7px #663554, 5px 7px #663554, 6px 7px #663554, 7px 7px #663554, 8px 7px #663554, 9px 7px #663554, 9px 8px #663554, 9px 9px #663554, 9px 10px #663554, 9px 11px #663554, 9px 12px #663554, 9px 13px #663554, 9px 14px #663554, 9px 15px #663554, 18px 11px #663554, 17px 11px #663554, 16px 11px #663554, 15px 11px #663554, 14px 11px #663554, 13px 11px #663554, 12px 11px #663554, 11px 11px #663554, 10px 11px #663554, 9px 11px #663554, 8px 11px #663554, 7px 11px #663554, 6px 11px #663554, 5px 11px #663554, 4px 11px #663554, 4px 12px #663554, 4px 13px #663554, 4px 14px #663554, 4px 15px #663554;
}
@keyframes scaleBox { from { transform: scaleX(0); } to { transform: scaleX(1); }
}
.logo, .logo:before, .logo:after { position: absolute; top: 10px; right: 6px; display: block; width: 17px; height: 17px; border-radius: 50%;
}
.logo:before { content: ''; top: 0; right: 8px; background: #b38570; transform: scale(0);
}
.logo:after { content: ''; top: 0; right: 10px; background: #ffd58c; transform: scale(0);
}
@keyframes scaleLogo { 0% { transform: scale(0); } 50% { transform: scale(1.1); } 100% { transform: scale(1); }
}
@keyframes scaleLogo2 { 0% { transform: scale(0) translate(0); } 50% { transform: scale(1.1) translate(5px); } 100% { transform: scale(1) translate(8px); }
}
.number { position: absolute; bottom: 12px; right: 6px; font-size: 8px; color: #ffd58c;
}
.number:after { content: ''; position: absolute; top: 0; left: -2px; display: block; width: 94px; height: 9px; background: #663554; transform-origin: 94px; transform: scaleX(1);
}
@keyframes scaleNumber { from { transform: skew(30deg) scaleX(1); } to { transform: skew(30deg) scaleX(0); }
}
/**********************
BACK OF CARD
**********************/
.back { transform: rotateY(180deg) translate3d(0, 0, 0);
}
.scan { position: absolute; top: 10px; display: block; width: 100px; height: 13px; overflow: hidden; background: #000; transform-origin: 0; transform: scale(0);
}
.scan:after { content: ''; display: block; width: 5px; height: 100%; background: #6d5e46; box-shadow: 10px 0 #6d5e46, 14px 0 #6d5e46, 25px 0 #6d5e46; transform: skewX(-40deg) translate(110px);
}
@keyframes highlight { from { transform: skewX(-40deg) translate(-35px); } to { transform: skewX(-40deg) translate(110px); }
}
.info, .info:after { position: absolute; left: 6px; bottom: 16px; display: block; width: 38px; height: 10px; background: #ffd58c; transform-origin: 0; transform: scale(0);
}
.info:after { content: ''; top: 0; left: 44px; width: 16px;
}
.animate .box { animation: scaleBox 0.48571s forwards;
}
.animate .logo:before { animation: scaleLogo2 0.48571s 0.15s forwards;
}
.animate .logo:after { animation: scaleLogo 0.48571s forwards;
}
.animate .number:after { animation: scaleNumber 1s forwards;
}
.animate .scan { animation: scaleBox .5s forwards;
}
.animate .scan:after { animation: highlight 1.75s forwards;
}
.animate .info, .animate .info:after { animation: scaleBox 1s forwards;
}
.animate .info:after { animation: scaleBox 1s .6s forwards;
}

Credit Card CSS3 Animation - Script Codes JS Codes

function toggleClasses() { $('.front').toggleClass('animate'); $('.back').toggleClass('animate');
}
setTimeout(function() { toggleClasses(); setInterval(function() { toggleClasses(); }, 3400/2);
}, 3400/4);
Credit Card CSS3 Animation - Script Codes
Credit Card CSS3 Animation - Script Codes
Home Page Home
Developer Travis Arnold
Username souporserious
Uploaded September 12, 2022
Rating 4
Size 5,511 Kb
Views 20,240
Do you need developer help for Credit Card CSS3 Animation?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Travis Arnold (souporserious) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!