<script src="https://code.jquery.com/jquery-2.2.4.js"></script><link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" /><script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="spinner"></div>
<div class="arrows text-center">
<i class="fa fa-arrow-circle-o-left" id="turn-spinner-left"></i>
<i class="fa fa-arrow-circle-o-right" id="turn-spinner-right"></i>
</div>
.spinner {
width: 200px;
height: 200px;
background-color: #e3e3e3;
margin-left: auto;
margin-right: auto;
margin-top: 25px;
transition: 0.5s;
border: 5px dashed black;
border-radius: 100%
}
.arrows {
color: #484848;
font-size: 48pt;
}
.arrows i {
margin: 5px 15px 0px 15px;
cursor: pointer;
}
$("#turn-spinner-right").click(function(){
var sentido = 'right';
spin(sentido);
});
$("#turn-spinner-left").click(function(){
var sentido = 'left';
spin(sentido);
});
function spin(direction){
var transform = $(".spinner").css("transform");
console.log('MATRIX: '+transform);
var angle = convertMatrixToAngle(transform);
console.log(angle);
switch(direction){
case 'left':
if($(".spinner").css( "transform" ) == 'none'){
$(".spinner").css("transform","rotate(-45deg)");
} else {
var newAngle = angle-45;
console.log('novo angulo:'+newAngle);
$(".spinner").css("transform","rotate("+newAngle+"deg)");
}
break;
case 'right':
if($(".spinner").css( "transform" ) == 'none'){
$(".spinner").css("transform","rotate(45deg)");
} else {
var newAngle = angle+45;
console.log('novo angulo:'+newAngle);
$(".spinner").css("transform","rotate("+newAngle+"deg)");
}
break;
}
}
function convertMatrixToAngle(vl){
if(vl == 'none'){
var angle = 0;
} else {
var values = vl.split('(')[1].split(')')[0].split(',');
var a = values[0];
var b = values[1];
var c = values[2];
var d = values[3];
var scale = Math.sqrt(a*a + b*b);
var sin = b/scale;
var angle = Math.round(Math.atan2(b, a) * (180/Math.PI));
if(angle < 0){
angle = Math.abs(angle);
}
}
return angle;
}
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |