<code></code>
<svg id="glasses" width="400px" height="120px" viewBox="0 0 40 12">
<rect width="40" height="1" />
<rect width="40" height="1" y="11" />
<rect width="1" height="12" />
<rect width="1" height="12" x="19.5" />
<rect width="1" height="12" x="39"/>
<rect class="filter" width="18.5" height="10" fill="cyan" x="1" y="1" />
<rect class="filter" width="18.5" height="10" x="20.5" y="1" fill="red" />
</svg>
html, body { position: relative; height: 100%; }
body {
background: url(http://farm9.staticflickr.com/8337/8233274850_17c9e09c32_k.jpg);
background-size: cover;
overflow: hidden;
}
svg {
position: relative;
width: 400px;
height: 120px;
border-radius: .25rem;
cursor: none;
margin: 200px 50px;
}
.filter {
mix-blend-mode: multiply;
}
rect:not(.filter){ fill: whitesmoke; }
$glasses = $("#glasses");
$(document).mousemove(function(e) {
var x = e.pageX - 235;
var y = e.pageY - 310;
var transform = 'left:' + x + 'px;'
+ 'top:' + y + 'px;';
$glasses.attr("style", transform);
});
As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.
Also see: Tab Triggers