Skip to content

Instantly share code, notes, and snippets.

@chrisgannon
Last active September 26, 2018 17:48
Show Gist options
  • Save chrisgannon/7d6e46b1b51dba305520dbd3a8ac1354 to your computer and use it in GitHub Desktop.
Save chrisgannon/7d6e46b1b51dba305520dbd3a8ac1354 to your computer and use it in GitHub Desktop.
function init() {
var myWheel = new Spin2WinWheel();
var myBtn = document.querySelector('.spinBtn');
//trigger with button
myWheel.init({data:wheelDataObject, spinTrigger: myBtn});
//triggered with a gesture
//myWheel.init({data:wheelDataObject});
}
var wheelDataObject = {
colorArray:[ "#364C62", "#F1C40F", "#E67E22", "#E74C3C", "#ECF0F1", "#95A5A6", "#16A085", "#27AE60", "#2980B9", "#8E44AD", "#2C3E50", "#F39C12", "#D35400", "#C0392B", "#BDC3C7","#1ABC9C", "#2ECC71", "#E87AC2", "#3498DB", "#9B59B6", "#7F8C8D"],
segmentValuesArray : [
{type: "string", value : "HOLIDAY^FOR TWO", win : false, resultText : "YOU WON A HOLIDAY!"},
{type: "image", value : "media/tip_star.svg", win : false, resultText : "A STAR"},
{type: "image", value : "media/tip_sqr.svg", win : false, resultText : "A SQUARE"},
{type: "image", value : "media/tip_oct.svg", win : false, resultText : "AN OCTAGON"},
{type: "image", value : "media/tip_triangle.svg", win : true, resultText : "A TRIANGLE"},
{type: "image", value : "media/tip_circle.svg", win : false, resultText : "A CIRCLE"},
{type: "image", value : "media/tip_hex.svg", win : false, resultText : "A HEXAGON"},
{type: "string", value : "LOSE ALL", win : false, resultText : "LOSE ALL"}
],
svgWidth: 1024,
svgHeight: 768,
wheelStrokeColor: "#D0BD0C",
wheelStrokeWidth: 18,
wheelSize: 700,
wheelTextOffsetY: 80,
wheelTextColor: "#EDEDED",
wheelTextSize: "2.3em",
wheelImageOffsetY: 40,
wheelImageSize: 50,
centerCircleSize: 360,
centerCircleStrokeColor: "#F1DC15",
centerCircleStrokeWidth: 12,
centerCircleFillColor: "#EDEDED",
segmentStrokeColor: "#E2E2E2",
segmentStrokeWidth: 4,
centerX: 512,
centerY: 384,
hasShadows: false,
numSpins: 2 ,
spinDestinationArray:[],
minSpinDuration:6,
gameOverText:"THANK YOU FOR PLAYING SPIN2WIN WHEEL. COME AND PLAY AGAIN SOON!",
invalidSpinText:"INVALID SPIN. PLEASE SPIN AGAIN.",
introText:"YOU HAVE TO<br>SPIN IT <span style='color:#F282A9;'>2</span> WIN IT!",
hasSound:true,
gameId:"9a0232ec06bc431114e2a7f3aea03bbe2164f1aa",
clickToSpin:true,
spinDirection:"ccw"
}
//And finally call it
init();
@chrisgannon
Copy link
Author

This would be the code in your index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment