This interface experiments with user input by implementing a circular form, that rotates as the user advances through it's path.
Forked from Yogev Ahuvia's Pen A Circular Form.
A Pen by Seth Calkins on CodePen.
This interface experiments with user input by implementing a circular form, that rotates as the user advances through it's path.
Forked from Yogev Ahuvia's Pen A Circular Form.
A Pen by Seth Calkins on CodePen.
<div class="wrapper"> | |
<div class="wheel closed"> | |
<form onsubmit="return false;"> | |
<ul> | |
<li> | |
<label class="sent-label">Thank You!</label> | |
<input placeholder="Hi there! Press Tab..." tabindex="1"> | |
</li> | |
<li> | |
<input placeholder="This is," tabindex="2"> | |
</li> | |
<li> | |
<input placeholder="a circular form!" tabindex="3"> | |
</li> | |
<li> | |
<input placeholder="It lets you input data," tabindex="4"> | |
</li> | |
<li> | |
<input placeholder="or just read a list," tabindex="5"> | |
</li> | |
<li> | |
<input placeholder="through a path." tabindex="6"> | |
</li> | |
<li> | |
<input placeholder="When ready," tabindex="7"> | |
</li> | |
<li> | |
<input placeholder="press Enter to Send." tabindex="8"> | |
</li> | |
</ul> | |
<input type="submit"> | |
</form> | |
</div> | |
</div> |
function setWheelRotation(rotation) { | |
$('.wheel').css('transform', 'rotate('+rotation+'deg)'); | |
} | |
function onSubmit() { | |
$('.wheel').addClass('sent'); | |
setWheelRotation(697.5); | |
setTimeout(function() { | |
$('.wheel').removeClass('sent'); | |
$('input').val(''); | |
firstInputField().focus(); | |
}, 5000); | |
return false; | |
} | |
function firstInputField() { | |
return $('.wheel li:first-child > input'); | |
} | |
$('form').on('submit', function() { | |
onSubmit(); | |
}); | |
$('input').on('focus', function() { | |
var index = $(this).parent().index(); | |
var rotation = -22.5 - (45 * index); | |
setWheelRotation(rotation); | |
}); | |
var lastTabIndex = $('[tabindex]').length; | |
$('[tabindex]').on('keydown', function(event) { | |
if (event.keyCode == 9) { // Tab pressed | |
event.preventDefault(); | |
var currentElement = $(this).get(0); | |
var curIndex = currentElement.tabIndex; | |
if (event.shiftKey) { | |
if (curIndex == 1) { | |
return; | |
} else { | |
curIndex--; | |
} | |
} else { | |
if (curIndex == lastTabIndex) { | |
return; | |
} else { | |
curIndex++; | |
} | |
} | |
$('[tabindex='+curIndex+']').focus(); | |
} | |
}); | |
$(document).ready(function() { | |
$('.wheel').removeClass('closed'); | |
firstInputField().focus(); | |
}); |
@import "compass/css3"; | |
/* A Circular Form © Yogev Ahuvia */ | |
/* ============================== */ | |
/* This interface experiments */ | |
/* with user input by implementing */ | |
/* a circular form, that rotates */ | |
/* as the user advances through */ | |
/* it's path. */ | |
.wheel { | |
width: 500px; | |
height: 500px; | |
top: 30px; | |
left: 50%; | |
margin-left: -250px; | |
border-radius: 100%; | |
position: absolute; | |
transition-delay: 0s; | |
transition-property: transform; | |
transition-duration: 0.5s; | |
transition-timing-function: ease-in-out; | |
transform-origin: 50% 50%; | |
transform: rotate(-22.5deg); | |
button.submit { | |
font-family: 'Open Sans', sans-serif; | |
outline: none; | |
display: block; | |
color: #eee; | |
font-weight: 300; | |
position: absolute; | |
width: 100px; | |
height: 100px; | |
border-radius: 100%; | |
border: 0; | |
background: #222; | |
box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | |
z-index: 100; | |
left: 50%; | |
top: 50%; | |
margin-left: -50px; | |
margin-top: -50px; | |
transition: opacity 1s, box-shadow 0.3s; | |
pointer-events: none; | |
opacity: 0; | |
&:hover { | |
box-shadow: 0px 0px 10px rgba(255,255,255,0.5); | |
} | |
&:focus { | |
opacity: 1; | |
pointer-events: auto; | |
} | |
} | |
} | |
@mixin slice-background($lighten) { | |
@include filter-gradient(lighten(rgb(20,177,144),$lighten), #ffffff, horizontal); | |
@include background-image(linear-gradient(45deg, lighten(rgb(20,177,144),$lighten) 178px, rgba(255,255,255,0) 179px)); | |
} | |
ul { | |
margin: 0; | |
padding: 0; | |
> li { | |
width: 250px; | |
height: 250px; | |
margin: 0; | |
padding: 0; | |
list-style-type: none; | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; | |
border-top-left-radius: 250px; | |
border-top-right-radius: 0px; | |
transform-origin: 100% 100%; | |
pointer-events: none; | |
transition-delay: 0s; | |
transition-property: transform; | |
transition-duration: 3s; | |
transition-timing-function: ease-in-out; | |
&:nth-child(1) { | |
transform: rotate(0deg); | |
z-index: 8; | |
@include slice-background(0%); | |
} | |
&:nth-child(2) { | |
transform: rotate(45deg); | |
z-index: 7; | |
@include slice-background(1%); | |
} | |
&:nth-child(3) { | |
transform: rotate(90deg); | |
z-index: 6; | |
@include slice-background(2%); | |
} | |
&:nth-child(4) { | |
transform: rotate(135deg); | |
z-index: 5; | |
@include slice-background(3%); | |
} | |
&:nth-child(5) { | |
transform: rotate(180deg); | |
z-index: 4; | |
@include slice-background(4%); | |
} | |
&:nth-child(6) { | |
transform: rotate(225deg); | |
z-index: 3; | |
@include slice-background(5%); | |
} | |
&:nth-child(7) { | |
transform: rotate(270deg); | |
z-index: 2; | |
@include slice-background(6%); | |
} | |
&:nth-child(8) { | |
transform: rotate(315deg); | |
z-index: 1; | |
@include slice-background(7%); | |
} | |
> input, > .sent-label { | |
font-family: 'Open Sans'; | |
color: #eee; | |
text-shadow: 1px 1px 1px rgba(0,0,0,0.3); | |
outline: none; | |
pointer-events: auto; | |
display: block; | |
position: absolute; | |
top: 75%; | |
left: 0px; | |
width: 250px; | |
border: 0; | |
text-align: left; | |
padding-left: 20px; | |
background: none; | |
transform-origin: 50%; | |
transform: rotate(22.5deg); | |
} | |
> .sent-label { | |
display: none; | |
opacity: 0; | |
font-size: 1.2em; | |
} | |
} | |
} | |
.closed { | |
li:nth-child(1) { transform: rotateX(0deg); } | |
li:nth-child(2) { transform: rotateX(0deg); } | |
li:nth-child(3) { transform: rotateX(0deg); } | |
li:nth-child(4) { transform: rotateX(0deg); } | |
li:nth-child(5) { transform: rotateX(0deg); } | |
li:nth-child(6) { transform: rotateX(0deg); } | |
li:nth-child(7) { transform: rotateX(0deg); } | |
li:nth-child(8) { transform: rotateX(0deg); } | |
} | |
.sent { | |
&.wheel { | |
transition-delay: 0s, 3s; | |
transition-property: transform, left; | |
transition-duration: 1s, 0.5s; | |
transition-timing-function: ease-in-out, ease-in; | |
left: 150%; | |
} | |
.sent-label { | |
display: block; | |
transition: opacity 1s; | |
opacity: 1; | |
} | |
input { | |
pointer-events: none; | |
transition: opacity 1s; | |
opacity: 0; | |
&::-webkit-input-placeholder { /* WebKit browsers */ | |
opacity: 0; | |
} | |
&:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ | |
opacity: 0; | |
} | |
&::-moz-placeholder { /* Mozilla Firefox 19+ */ | |
opacity: 0; | |
} | |
&:-ms-input-placeholder { /* Internet Explorer 10+ */ | |
opacity: 0; | |
} | |
} | |
li:nth-child(1) { transform: rotateX(0deg); } | |
li:nth-child(2) { transform: rotateX(0deg); } | |
li:nth-child(3) { transform: rotateX(0deg); } | |
li:nth-child(4) { transform: rotateX(0deg); } | |
li:nth-child(5) { transform: rotateX(0deg); } | |
li:nth-child(6) { transform: rotateX(0deg); } | |
li:nth-child(7) { transform: rotateX(0deg); } | |
li:nth-child(8) { transform: rotateX(0deg); } | |
} | |
html, body { | |
width: 100%; | |
height: 100%; | |
} | |
body { | |
font-family: 'Open Sans', sans-serif; | |
font-size: 18px; | |
font-weight: 300; | |
background: #222; | |
position: relative; | |
} | |
[type="submit"] { | |
opacity: 0; | |
pointer-events: none; | |
} | |
input { | |
&::-webkit-input-placeholder { /* WebKit browsers */ | |
color: #eee; | |
opacity: 1; | |
} | |
&:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ | |
color: #eee; | |
opacity: 1; | |
} | |
&::-moz-placeholder { /* Mozilla Firefox 19+ */ | |
color: #eee; | |
opacity: 1; | |
} | |
&:-ms-input-placeholder { /* Internet Explorer 10+ */ | |
color: #eee; | |
opacity: 1; | |
} | |
} | |
input:not(:focus) { | |
&::-webkit-input-placeholder { /* WebKit browsers */ | |
opacity: 0.4; | |
} | |
&:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ | |
opacity: 0.4; | |
} | |
&::-moz-placeholder { /* Mozilla Firefox 19+ */ | |
opacity: 0.4; | |
} | |
&:-ms-input-placeholder { /* Internet Explorer 10+ */ | |
opacity: 0.4; | |
} | |
} |