JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<main id=app>
<h1>Pokemon Card, Holo Effect</h1>
<p>I've had to disable animation effect, as it seems there's a bug in Chromium with animations and mix-blend-mode rendering conflicts</p>
<div class="card">
</div>
<span class="operator">+</span>
<div class="card">
<span>+ color-dodge</span>
</div>
<span class="operator">+</span>
<div class="card">
<span>+ color-dodge</span>
</div>
<span class="operator">=</span>
<div class="card"></div>
<style class="hover"></style>
</main>
.card {
width: 320px;
height: 452px;
background-color: #211799;
background-image: url(https://images.pokemontcg.io/xy2/12_hires.png);
background-size: 100%;
background-repeat: no-repeat;
background-position: center;
border-radius: 8px;
box-shadow: -3px -3px 3px 0 rgba(#26e6f7, 0.6), 3px 3px 3px 0 rgba(#f759e4, 0.6), 0 0 6px 2px rgba(#ffe759, 0.6),
0 35px 25px -15px rgba(0, 0, 0, 0.5);
position: relative;
overflow: hidden;
display: inline-block;
vertical-align: middle;
margin: 20px 10px;
}
.card > span {
position: relative;
top: 45%;
}
.card:before,
.card:after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-image: linear-gradient(
115deg,
transparent 0%,
rgb(0, 231, 255) 30%,
rgb(255, 0, 231) 70%,
transparent 100%
);
background-position: 0% 0%;
background-repeat: no-repeat;
background-size: 300% 300%;
mix-blend-mode: color-dodge;
opacity: 0.2;
z-index: 1;
// animation: holoGradient 15s ease infinite;
}
.card:after {
background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/13471/sparkles.gif");
background-position: center;
background-size: 180%;
mix-blend-mode: color-dodge;
opacity: 1;
z-index: 2;
// animation: holoSparkle 20s ease infinite;
}
.card.active:before {
opacity: 1;
animation: none;
transition: none;
background-image: linear-gradient(
115deg,
transparent 0%,
transparent 25%,
rgba(0, 231, 255,0.7) 45%,
rgba(255, 0, 231,0.7) 55%,
transparent 70%,
transparent 100%
);
}
.card:nth-of-type(1),
.card:nth-of-type(2),
.card:nth-of-type(3) {
width: 160px;
height: 226px;
box-shadow: 0 0 1px 1px rgba(white,0.4), 0 25px 15px -10px rgba(0, 0, 0, 0.5);
}
.card:nth-of-type(1),
.card:nth-of-type(2),
.card:nth-of-type(3) {
&:before, &:after {
animation: none;
opacity: 1;
}
}
.card:nth-of-type(1) {
&:before, &:after { display: none; }
}
.card:nth-of-type(2) {
background: none;
&:before { display: none; }
}
.card:nth-of-type(3) {
background: none;
&:before { background-position: center; }
&:after { display: none; }
}
.operator {
display: inline-block;
vertical-align: middle;
font-size: 45px;
}
@keyframes holoSparkle {
0% {
opacity: 0;
}
12% {
opacity: 1;
}
70% {
opacity: 0.5;
}
95% {
opacity: 0.2;
}
}
@keyframes holoGradient {
3% {
opacity: 0;
}
5% {
background-position: 0% 0%;
}
7% {
opacity: 0.5;
}
9% {
background-position: 100% 100%;
}
11% {
opacity: 0;
}
50% {
opacity: 0;
background-position: 100% 100%;
}
55% {
opacity: 0.3;
}
70% {
opacity: 0;
background-position: 0% 0%;
}
}
body {
color: white;
background: #333844;
font-family: "Heebo", sans-serif;
display: flex;
justify-content: center;
vertical-align: middle;
height: 100%;
text-align: center;
}
html {
height: 100%;
}
h1 {
display: block;
margin-top: 30px;
margin-bottom: 5px;
}
p {
margin-top: 5px;
font-weight: 200;
}
/*
using
- an animated gif of sparkles.
- an animated gradient as a holo effect.
- color-dodge blend mode
this could be enhanced with some 3d effects
which change the background positions
*/
var $cards = $(".card");
var $style = $(".hover");
$cards.on("mousemove", function(e) {
var $card = $(this);
var l = e.offsetX;
var t = e.offsetY;
var h = $card.height();
var w = $card.width();
var lp = Math.abs(Math.floor(100 / w * l)-100);
var tp = Math.abs(Math.floor(100 / h * t)-100);
var bg = `background-position: ${lp}% ${tp}%;`
var style = `.card.active:before { ${bg} }`
$cards.removeClass("active");
$card.addClass("active");
$style.html(style);
}).on("mouseout", function() {
$cards.removeClass("active");
});
Also see: Tab Triggers