.back
.screen
.dot
.joy-wrap
.cover
.base
.stem
.side
.thumb
.dip
a(href="http://nathan.tokyo" target="_blank").sig NATHAN.TOKYO
View Compiled
$hue: 220;
$warm: $hue - 60;
$cold: $hue + 60;
$main: hsl($hue,10%,35%);
$back: hsl($hue,10%,65%);
html{
font-size: 1px;
}
*{
user-drag: none !important;
}
body{
width: 100vw;
height: 100vh;
filter: blur(0.4px);
color: $main;
font-family: sans-serif;
&.grabbing, &.grabbing *{
cursor: none !important;
}
background: linear-gradient(135deg, hsl($warm, 85%, 93%), hsl($cold, 15%, 80%));
}
.back{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
width: 300rem;
height: 400rem;
background: linear-gradient(135deg, hsl($warm, 15%, 75%), hsl($cold, 8%, 60%));
z-index: -1;
border-radius: 40rem;
box-shadow: 0 0 150rem hsla($cold, 95%, 10%, 0.2),
25rem 25rem 50rem hsla($cold, 95%, 10%, 0.2),
inset -2rem -2rem 4rem hsl($cold, 10%, 55%),
inset 2rem 2rem 4rem hsl($warm, 30%, 85%);
}
@keyframes blink{
0%{
opacity: 1;
}
40%{
opacity: 1;
}
50%{
opacity: 10;
}
60%{
opacity: 1;
}
100%{
opacity: 1;
}
}
.screen{
position: absolute;
top: 50rem;
left: 50rem;
width: 200rem;
height: 180rem;
border-radius: 10rem;
background: hsl($warm, 50%, 30%);
box-shadow: inset 0vh 0vh 25rem hsla($cold, 95%, 10%, 0.2),
inset 5rem 5rem 10rem hsla($cold, 95%, 10%, 0.2),
-2rem -2rem 4rem hsl($cold, 10%, 55%),
2rem 2rem 4rem hsl($warm, 30%, 85%);
overflow: hidden;
.dot{
position: absolute;
top: calc(50% - 10rem);
left: calc(50% - 10rem);
width: 20rem;
height: 20rem;
border-radius: 0.2vh;
box-shadow: 0 0 5rem hsl($warm, 40%, 50%),
0 0 15rem hsl($warm, 60%, 70%);
background: hsl($warm, 60%, 80%);
filter: blur(0.6px);
opacity: 0.2;
}
}
.joy-wrap{
position: absolute;
top: 80%;
left: 50%;
}
.cover{
position: absolute;
top: calc(50% - 55rem);
left: calc(50% - 55rem);
width: 110rem;
height: 110rem;
border-radius: 100rem;
background: transparent;
transform-origin: 50% 50% 0rem;
box-shadow: inset -25rem -25rem 110rem hsla($cold, 95%, 10%, 0.4),
inset 25rem 25rem 110rem hsla($warm, 95%, 90%, 0.4),
inset 2rem 2rem 10rem hsla($cold, 90%, 5%, 1),
inset 2rem 2rem 5rem hsla($cold, 90%, 5%, 1),
-2rem -2rem 3rem hsl($cold, 10%, 55%),
2rem 2rem 3rem hsl($warm, 30%, 85%);
overflow: hidden;
}
.base{
position: absolute;
top: calc(50% - 500rem);
left: calc(50% - 500rem);
width: 1000rem;
height: 1000rem;
background-color: $main;
transform-origin: 50% 50% 0rem;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve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FAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
z-index: -1;
pointer-events: none !important;
}
.stem{
position: absolute;
top: calc(50% - 20rem);
left: calc(50% - 20rem);
width: 40rem;
height: 40rem;
border-radius: 50rem;
background-color: $main;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5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HrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
pointer-events: none !important;
transform-origin: 50% 50% 20rem;
box-shadow: inset -10rem -10rem 25rem hsla($cold, 95%, 10%, 0.3);
//2rem 2rem 10rem hsla($cold, 90%, 5%, 1),
//2rem 2rem 5rem hsla($cold, 90%, 5%, 1),
//inset -2rem -2rem 3rem hsl($cold, 10%, 55%),
//inset 2rem 2rem 3rem hsl($warm, 30%, 85%);
opacity: 0.6;
}
.side{
position: absolute;
top: calc(50% - 50rem);
left: calc(50% - 50rem);
width: 100rem;
height: 100rem;
border-radius: 100rem;
background: $main;
transform-origin: 50% 50% 70rem;
box-shadow: inset 0rem 0rem 10rem hsla($cold, 90%, 10%, 0.3);
cursor: grab;
}
.thumb{
position: absolute;
top: calc(50% - 50rem);
left: calc(50% - 50rem);
width: 100rem;
height: 100rem;
border-radius: 100rem;
background-color: $main;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEB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eMRUERVaPpEs+yqeoSmuOlokqw49pgomjLeh7icHNlG19yjs6XXOMedYm5xH2YxpV2tc0Ro2jJfxC50ApuxGob7lMsxfTbeUv07TyYxpeLucEH1gNd4IKH2LAg5TdVhlCafZvpskfncCfx8pOhJzd76bJWeYFnFciwcYfubRc12Ip/ppIhA1/mSZ/RxjFDrJC5xifFjJpY2Xl5zXdguFqYyTR1zSp1Y9p+tktDYYSNflcxI0iyO4TPBdlRcpeqjK/piF5bklq77VSEaA+z8qmJTFzIWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
pointer-events: none !important;
transform-origin: 50% 50% 80rem;
.dip{
position: absolute;
top: calc(50% - 25rem);
left: calc(50% - 25rem);
width: 50rem;
height: 50rem;
border-radius: 100rem;
}
}
.sig{
position: fixed;
bottom: 8px;
right: 8px;
text-decoration: none;
font-size: 12px;
font-weight: 100;
font-family: sans-serif;
color: rgba(0,0,0,0.4);
letter-spacing: 2px;
}
View Compiled
var thumb = false;
var win = {width: $(window).width(), height: $(window).height()};
var mouse = {x: 0, y: 0};
var joy = {x: 0, y: 0};
var dot = {x: 0, y: 0};
var dotVel = {x: 0.15, y: 0.2};
var opacityVar = 0;
var hue = 220;
var warm = hue - 60;
var cold = hue + 60;
$(window).on('resize', function(){
win = {width: $(window).width(), height: $(window).height()};
})
$(document).ready(function(){
$('.side').on('mousedown', function(){
$('body').addClass('grabbing')
thumb = true;
})
$(document).on('mouseup', function(){
$('body').removeClass('grabbing')
thumb = false;
})
$(document).on('mousemove', function(e){
mouse.x = e.clientX;
mouse.y = e.clientY;
})
requestAnimationFrame(animate);
drawJoystick();
})
function animate(){
updateJoystickPosition();
drawJoystick();
updateDotPosition();
drawDot();
requestAnimationFrame(animate);
}
function updateJoystickPosition(){
if (thumb){
joy.x = (mouse.x / win.width - 0.5)*4;
joy.y = (mouse.y / win.height - 0.75)*4;
if (joy.x > 1)
joy.x = 1;
if (joy.x < -1)
joy.x = -1;
if (joy.y > 1)
joy.y = 1;
if (joy.y < -1)
joy.y = -1;
} else {
joy.x *= 0.6;
joy.y *= 0.6;
}
}
function updateDotPosition(){
dotVel.x += joy.x/10;
dotVel.y += joy.y/10;
dotVel.x *= 0.95;
dotVel.y *= 0.95;
dot.x += dotVel.x/10;
dot.y += dotVel.y/10;
if (dot.x > 1.1)
dot.x = -1.09;
if (dot.x < -1.1)
dot.x = 1.09;
if (dot.y > 1.1)
dot.y = -1.09;
if (dot.y < -1.1)
dot.y = 1.09;
}
function drawJoystick(){
var xRotate = joy.x * -30;
var yRotate = joy.y * 30;
//calculate angle based on mouse position
var transform = 'rotateY('+xRotate+'deg) rotateX('+yRotate+'deg) perspective(5000rem) translateZ(0rem)';
var transformDip = 'translateX('+(xRotate*-0.2)+'%) translateY('+(yRotate*0.2)+'%)';
var transformBase = 'translateX('+(xRotate*-0.08)+'%) translateY('+(yRotate*0.08)+'%)';
$('.thumb').css('transform', transform);
$('.dip').css('transform', transformDip);
$('.side').css('transform', transform);
$('.base').css('transform', transformBase);
$('.stem').css('transform', transform);
//variable for measing amount facing light
var muke = (joy.x + joy.y - 2)*-0.25;
var bg = 'hsl('+( hue - muke*30 + 15 )+',15%,'+(30 + muke*20)+'%)';
var bgSide = 'linear-gradient(-45deg, hsl('+cold+',15%,'+(15 + muke*25)+'%),hsl('+warm+',20%,'+(70 + muke*20)+'%))';
$('.thumb').css('background-color', bg);
$('.side').css('background', bgSide);
//generate dynamic shadows
var light = 'inset '+(muke*4 + 2)+'rem '+(muke*4 + 2)+'rem '+(muke*10 + 5)+'rem hsla('+warm+',20%,65%,'+(0.5 + muke*0.5)+')';
var dark = 'inset '+(muke*6 - 4)+'rem '+(muke*6 - 4)+'rem '+(15 - muke*10)+'rem hsla('+cold+',30%,10%,'+(1 - (muke*0.5))+')';
var lightTight = 'inset '+(5)+'rem '+(5)+'rem '+(10)+'rem hsla('+warm+',10%,80%,'+(0.5 + muke*0.5)+')';
var darkTight = 'inset '+(0)+'rem '+(0)+'rem '+(10)+'rem hsla('+cold+',60%,5%,'+(1 - (muke*0.5))+')';
var fall = (10 + muke*15)+'rem '+(10 + muke*15)+'rem '+(15 + muke*35)+'rem hsla('+cold+',45%,5%,'+(0.4 - (muke*0.1))+')';
var bs = light + ',' + lightTight + ',' + dark + ', ' + darkTight + ',' + fall;
var lightDip = 'inset '+(-2 - muke*2)+'rem '+(-2 - muke*2)+'rem '+(8 + muke*4)+'rem hsla('+warm+',20%,65%,'+(0.3 + muke*0.5)+')';
var darkDip = 'inset '+(4 - muke*2)+'rem '+(4 - muke*2)+'rem '+(12 - muke*4)+'rem hsla('+cold+',30%,20%,'+(0.8 - muke*0.5)+')';
var lightDipOuter = (2 + muke*2)+'rem '+(2 + muke*2)+'rem '+(8 + muke*4)+'rem hsla('+warm+',20%,65%,'+(0.3 + muke*0.5)+')';
var darkDipOuter = (-4 + muke*2)+'rem '+(-4 + muke*2)+'rem '+(12 - muke*4)+'rem hsla('+cold+',30%,20%,'+(0.8 - muke*0.5)+')';
var bsDip = lightDipOuter + ',' + darkDipOuter + ',' + lightDip + ',' + darkDip;
$('.thumb').css('box-shadow', bs);
$('.dip').css('box-shadow', bsDip);
}
function drawDot(){
opacityVar = Math.max(Math.min( opacityVar + Math.random()*0.02 - 0.01, 0.2), 0);
var transformDot = 'translateX('+(dot.x*100)+'rem) translateY('+(dot.y*100)+'rem)';
$('.dot').css('transform', transformDot);
var opacityDot = 0.2 + (Math.sqrt( (Math.abs(dotVel.x) + Math.abs(dotVel.y)) * 2)) + opacityVar;
$('.dot').css('opacity', opacityDot);
}
This Pen doesn't use any external CSS resources.