We provide programming data of 20 most popular languages, hope to help you!
// winwheel.js is the best js library to build a spin the wheel or wheel of fortune
<!-- source=> http://dougtesting.net/home -->
//download the library and you are ready to go
<html>
<head>
<title>Wheel of fortune Wheel</title>
<script src='Winwheel.js'></script>
</head>
<body>
<canvas id='canvas' width='880' height='300'>
Canvas not supported, use another browser.
</canvas>
<script>
let theWheel = new Winwheel({
'outerRadius' : 212, // Set outer radius so wheel fits inside the background.
'innerRadius' : 75, // Make wheel hollow so segments dont go all way to center.
'textFontSize' : 24, // Set default font size for the segments.
'textOrientation' : 'vertical', // Make text vertial so goes down from the outside of wheel.
'textAlignment' : 'outer', // Align text to outside of wheel.
'numSegments' : 24, // Specify number of segments.
'segments' : // Define segments including colour and text.
[ // font size and text colour overridden on backrupt segments.
{'fillStyle' : '#ee1c24', 'text' : '300'},
{'fillStyle' : '#3cb878', 'text' : '450'},
{'fillStyle' : '#f6989d', 'text' : '600'},
{'fillStyle' : '#00aef0', 'text' : '750'},
{'fillStyle' : '#f26522', 'text' : '500'},
{'fillStyle' : '#000000', 'text' : 'BANKRUPT', 'textFontSize' : 16, 'textFillStyle' : '#ffffff'},
{'fillStyle' : '#e70697', 'text' : '3000'},
{'fillStyle' : '#fff200', 'text' : '600'},
{'fillStyle' : '#f6989d', 'text' : '700'},
{'fillStyle' : '#ee1c24', 'text' : '350'},
{'fillStyle' : '#3cb878', 'text' : '500'},
{'fillStyle' : '#f26522', 'text' : '800'},
{'fillStyle' : '#a186be', 'text' : '300'},
{'fillStyle' : '#fff200', 'text' : '400'},
{'fillStyle' : '#00aef0', 'text' : '650'},
{'fillStyle' : '#ee1c24', 'text' : '1000'},
{'fillStyle' : '#f6989d', 'text' : '500'},
{'fillStyle' : '#f26522', 'text' : '400'},
{'fillStyle' : '#3cb878', 'text' : '900'},
{'fillStyle' : '#000000', 'text' : 'BANKRUPT', 'textFontSize' : 16, 'textFillStyle' : '#ffffff'},
{'fillStyle' : '#a186be', 'text' : '600'},
{'fillStyle' : '#fff200', 'text' : '700'},
{'fillStyle' : '#00aef0', 'text' : '800'},
{'fillStyle' : '#ffffff', 'text' : 'LOOSE TURN', 'textFontSize' : 12}
],
'animation' : // Specify the animation to use.
{
'type' : 'spinToStop',
'duration' : 10,
'spins' : 3,
'callbackFinished' : alertPrize, // Function to call whent the spinning has stopped.
'callbackSound' : playSound, // Called when the tick sound is to be played.
'soundTrigger' : 'pin' // Specify pins are to trigger the sound.
},
'pins' : // Turn pins on.
{
'number' : 24,
'fillStyle' : 'silver',
'outerRadius': 4,
}
});
// Loads the tick audio sound in to an audio object.
let audio = new Audio('tick.mp3');
// This function is called when the sound is to be played.
function playSound()
{
// Stop and rewind the sound if it already happens to be playing.
audio.pause();
audio.currentTime = 0;
// Play the sound.
audio.play();
}
// Called when the animation has finished.
function alertPrize(indicatedSegment)
{
// Display different message if win/lose/backrupt.
if (indicatedSegment.text == 'LOOSE TURN') {
alert('Sorry but you loose a turn.');
} else if (indicatedSegment.text == 'BANKRUPT') {
alert('Oh no, you have gone BANKRUPT!');
} else {
alert("You have won " + indicatedSegment.text);
}
}
</script>
</body>
</html>
aaaaaaaaa
aaafsdfsfdsfsfsdfdsfs
div {
height: 100px;
width: 100px;
border-radius: 50%;
background: gray;
margin: 0 auto;
text-align: center;
}
div:hover {
-webkit-animation: spin 0.8s infinite linear;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
Hover to see effect: <div>Spin</div>
$('div').click(function(){
$(this).toggleClass("thisIsAdded");
});
div {
height: 100px;
width: 100px;
border-radius: 50%;
background: gray;
margin: 0 auto;
text-align: center;
}
.thisIsAdded {
-webkit-animation: spin 0.8s infinite linear;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Click to see:<div>spin</div>
<style type="text/css">
.content
{
float:left;cursor:pointer;
}
.content::after
{
content:'>';float:right;margin:0 0 0 10px;
-moz-transition:0.5s all;-webkit-transition:0.5s all;
}
.content:hover::after
{
-moz-transform:rotate(90deg);-webkit-transform:rotate(90deg);
}
</style>
<body>
<div class="content">Sample</div>
</body>
.circle {
border-radius: 50%;
position: absolute;
top: 10%;
left: 10%;
width: 120px;
height: 120px;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
background: repeating-linear-gradient(
45deg,
#606dbc,
#606dbc 10px,
#465298 10px,
#465298 20px
);
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
// winwheel.js is the best js library to build a spin the wheel or wheel of fortune
<!-- source=> http://dougtesting.net/home -->
//download the library and you are ready to go
<html>
<head>
<title>Wheel of fortune Wheel</title>
<script src='Winwheel.js'></script>
</head>
<body>
<canvas id='canvas' width='880' height='300'>
Canvas not supported, use another browser.
</canvas>
<script>
let theWheel = new Winwheel({
'outerRadius' : 212, // Set outer radius so wheel fits inside the background.
'innerRadius' : 75, // Make wheel hollow so segments dont go all way to center.
'textFontSize' : 24, // Set default font size for the segments.
'textOrientation' : 'vertical', // Make text vertial so goes down from the outside of wheel.
'textAlignment' : 'outer', // Align text to outside of wheel.
'numSegments' : 24, // Specify number of segments.
'segments' : // Define segments including colour and text.
[ // font size and text colour overridden on backrupt segments.
{'fillStyle' : '#ee1c24', 'text' : '300'},
{'fillStyle' : '#3cb878', 'text' : '450'},
{'fillStyle' : '#f6989d', 'text' : '600'},
{'fillStyle' : '#00aef0', 'text' : '750'},
{'fillStyle' : '#f26522', 'text' : '500'},
{'fillStyle' : '#000000', 'text' : 'BANKRUPT', 'textFontSize' : 16, 'textFillStyle' : '#ffffff'},
{'fillStyle' : '#e70697', 'text' : '3000'},
{'fillStyle' : '#fff200', 'text' : '600'},
{'fillStyle' : '#f6989d', 'text' : '700'},
{'fillStyle' : '#ee1c24', 'text' : '350'},
{'fillStyle' : '#3cb878', 'text' : '500'},
{'fillStyle' : '#f26522', 'text' : '800'},
{'fillStyle' : '#a186be', 'text' : '300'},
{'fillStyle' : '#fff200', 'text' : '400'},
{'fillStyle' : '#00aef0', 'text' : '650'},
{'fillStyle' : '#ee1c24', 'text' : '1000'},
{'fillStyle' : '#f6989d', 'text' : '500'},
{'fillStyle' : '#f26522', 'text' : '400'},
{'fillStyle' : '#3cb878', 'text' : '900'},
{'fillStyle' : '#000000', 'text' : 'BANKRUPT', 'textFontSize' : 16, 'textFillStyle' : '#ffffff'},
{'fillStyle' : '#a186be', 'text' : '600'},
{'fillStyle' : '#fff200', 'text' : '700'},
{'fillStyle' : '#00aef0', 'text' : '800'},
{'fillStyle' : '#ffffff', 'text' : 'LOOSE TURN', 'textFontSize' : 12}
],
'animation' : // Specify the animation to use.
{
'type' : 'spinToStop',
'duration' : 10,
'spins' : 3,
'callbackFinished' : alertPrize, // Function to call whent the spinning has stopped.
'callbackSound' : playSound, // Called when the tick sound is to be played.
'soundTrigger' : 'pin' // Specify pins are to trigger the sound.
},
'pins' : // Turn pins on.
{
'number' : 24,
'fillStyle' : 'silver',
'outerRadius': 4,
}
});
// Loads the tick audio sound in to an audio object.
let audio = new Audio('tick.mp3');
// This function is called when the sound is to be played.
function playSound()
{
// Stop and rewind the sound if it already happens to be playing.
audio.pause();
audio.currentTime = 0;
// Play the sound.
audio.play();
}
// Called when the animation has finished.
function alertPrize(indicatedSegment)
{
// Display different message if win/lose/backrupt.
if (indicatedSegment.text == 'LOOSE TURN') {
alert('Sorry but you loose a turn.');
} else if (indicatedSegment.text == 'BANKRUPT') {
alert('Oh no, you have gone BANKRUPT!');
} else {
alert("You have won " + indicatedSegment.text);
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #3498db;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
}
/* Safari */
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<h2>How To Create A Loader</h2>
<div class="loader"></div>
</body>
</html>
// the game itself
var game;
// the spinning wheel
var wheel;
// can the wheel spin?
var canSpin;
// slices (prizes) placed in the wheel
var slices = 8;
// prize names, starting from 12 o'clock going clockwise
var slicePrizes = ["A KEY!!!", "50 STARS", "500 STARS", "BAD LUCK!!!", "200 STARS", "100 STARS", "150 STARS", "BAD LUCK!!!"];
// the prize you are about to win
var prize;
// text field where to show the prize
var prizeText;
window.onload = function() {
// creation of a 458x488 game
game = new Phaser.Game(458, 488, Phaser.AUTO, "");
// adding "PlayGame" state
game.state.add("PlayGame",playGame);
// launching "PlayGame" state
game.state.start("PlayGame");
}
// PLAYGAME STATE
var playGame = function(game){};
playGame.prototype = {
// function to be executed once the state preloads
preload: function(){
// preloading graphic assets
game.load.image("wheel", "wheel.png");
game.load.image("pin", "pin.png");
},
// funtion to be executed when the state is created
create: function(){
// giving some color to background
game.stage.backgroundColor = "#880044";
// adding the wheel in the middle of the canvas
wheel = game.add.sprite(game.width / 2, game.width / 2, "wheel");
// setting wheel registration point in its center
wheel.anchor.set(0.5);
// adding the pin in the middle of the canvas
var pin = game.add.sprite(game.width / 2, game.width / 2, "pin");
// setting pin registration point in its center
pin.anchor.set(0.5);
// adding the text field
prizeText = game.add.text(game.world.centerX, 480, "");
// setting text field registration point in its center
prizeText.anchor.set(0.5);
// aligning the text to center
prizeText.align = "center";
// the game has just started = we can spin the wheel
canSpin = true;
// waiting for your input, then calling "spin" function
game.input.onDown.add(this.spin, this);
},
// function to spin the wheel
spin(){
// can we spin the wheel?
if(canSpin){
// resetting text field
prizeText.text = "";
// the wheel will spin round from 2 to 4 times. This is just coreography
var rounds = game.rnd.between(2, 4);
// then will rotate by a random number from 0 to 360 degrees. This is the actual spin
var degrees = game.rnd.between(0, 360);
// before the wheel ends spinning, we already know the prize according to "degrees" rotation and the number of slices
prize = slices - 1 - Math.floor(degrees / (360 / slices));
// now the wheel cannot spin because it's already spinning
canSpin = false;
// animation tweeen for the spin: duration 3s, will rotate by (360 * rounds + degrees) degrees
// the quadratic easing will simulate friction
var spinTween = game.add.tween(wheel).to({
angle: 360 * rounds + degrees
}, 3000, Phaser.Easing.Quadratic.Out, true);
// once the tween is completed, call winPrize function
spinTween.onComplete.add(this.winPrize, this);
}
},
// function to assign the prize
winPrize(){
// now we can spin the wheel again
canSpin = true;
// writing the prize you just won
prizeText.text = slicePrizes[prize];
}
}
color = d3.scale.category20();
color = ["#111111", "#222222", "#333333", "#444444", "#555555"];
arcs.append("path")
.attr("fill", function (d, i) { return color(i); })
// .attr("fill", function(d, i){ return data[i].color; })
// .attr("fill","url(#img1)")
// .attr("fill", function (d, i) { return "url(#img" + i + ")"; })
.attr("d", function (d) { return arc(d); })`
.text( function(d, i) {
.html( function(d, i) {
"question" : 'Some question with a <a href="https://google.com">link</a>'
.text(data[picked].question);
.html(data[picked].question);