This commit is contained in:
He4eT 2017-01-30 20:00:08 +05:00
commit 1ad599b265
8 changed files with 783 additions and 0 deletions

60
css/style.css Normal file
View file

@ -0,0 +1,60 @@
html, body {
margin: 0;
padding: 0;
min-height: 100vh;
}
body {
display:flex;
align-items:center;
justify-content:center;
background-color: #212121;
}
.wrap {
padding: 50px;
background-color: #fff;
background-color: #424242;
box-shadow: 0 0 50px 1px #ff3000;
}
.logo {
text-align: center;
margin-bottom: 100px;
}
.jSlots-wrapper {
overflow: hidden;
height: 100px;
display: inline-block; /* to size correctly, can use float too, or width*/
/*border: 2px solid #999;*/
transform: translateZ(0);
background-color: #212121;
padding: 0 5px;
}
.slots {
box-shadow: 0 0 10px 1px #000 inset;
font-size: 0;
}
ul {
padding: 0;
margin: 0;
list-style: none;
}
.slot {
float: left;
}
.slot li {
text-align: center;
padding: 0 30px;
margin: 0 10px;
line-height: 100px;
font-size: 2rem;
border-left: 2px solid #ccc;
border-right: 2px solid #ccc;
background-color: #424242;
}

176
img/logo.svg Normal file
View file

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="212.59842"
height="212.59842"
id="svg3465">
<defs
id="defs3467" />
<metadata
id="metadata3470">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-839.76245)"
id="layer1">
<g
transform="matrix(0.90669404,0,0,-0.90669404,74.796621,961.60888)"
id="g3079">
<path
d="m 0,0 -32.377,0 c -2.027,0 -3.695,-1.595 -3.787,-3.619 l -2.962,-65.39 c -0.057,-1.266 1.231,-2.154 2.394,-1.651 l 34.409,16.904 c 1.033,0.447 1.194,1.844 0.291,2.515 l -30.689,20.871"
id="path3081"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,89.530394,1004.6769)"
id="g3083">
<path
d="m 0,0 11.583,0 c 1.457,0 2.764,0.895 3.291,2.253 l 17.024,43.906 c 0.358,0.923 1.683,0.868 1.962,-0.082 l 21.307,-71.91"
id="path3085"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,88.397033,1039.8112)"
id="g3087">
<path
d="m 0,0 c 0.098,0.295 5.429,13.962 11.857,30.425 0.761,1.949 2.64,3.236 4.733,3.236 l 16.16,0"
id="path3089"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,155.94576,1034.1445)"
id="g3091">
<path
d="m 0,0 4.213,78.933 c 0.13,2.064 2.416,3.241 4.172,2.148 L 40.303,59.207 c 1.77,-1.102 1.704,-3.7 -0.12,-4.71 L 7.25,38.25"
id="path3093"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,23.592759,890.99298)"
id="g3095">
<path
d="m 0,0 30.689,-20.871 c 0.903,-0.671 0.742,-2.068 -0.291,-2.516 L -4.011,-40.29 c -1.163,-0.503 -2.451,0.385 -2.394,1.651 l 2.962,65.389 c 0.092,2.025 1.76,3.62 3.787,3.62 L 32.721,16.505"
id="path3097"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,117.48309,900.6693)"
id="g3099">
<path
d="m 0,0 -12.044,0 c -1.515,0 -2.874,0.895 -3.421,2.253 l -17.702,43.906 c -0.372,0.923 -1.749,0.868 -2.04,-0.082 l -22.154,-71.91"
id="path3101"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,118.66152,935.8037)"
id="g3103">
<path
d="m 0,0 c -0.102,0.295 -5.645,13.962 -12.328,30.425 -0.791,1.949 -2.746,3.236 -4.922,3.236 l -16.802,0"
id="path3105"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,134.41011,935.41382)"
id="g3107">
<path
d="m 0,0 4.213,78.933 c 0.13,2.064 2.416,3.241 4.172,2.148 L 40.303,59.207 c 1.77,-1.102 -0.664,-35.033 -2.488,-36.043 l -30.666,-18"
id="path3109"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,53.260964,876.02816)"
id="g3111">
<path
d="M 0,0 -30.018,-16.683"
id="path3113"
style="fill:none;stroke:#ff3000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,76.820359,960.6235)"
id="g3123">
<path
d="m 0,0 -32.377,0 c -2.027,0 -3.695,-1.595 -3.787,-3.619 l -2.962,-65.39 c -0.057,-1.266 1.231,-2.154 2.394,-1.651 l 34.409,16.904 c 1.033,0.447 1.194,1.844 0.291,2.515 l -30.689,20.871"
id="path3125"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,91.554133,1003.6914)"
id="g3127">
<path
d="m 0,0 11.583,0 c 1.457,0 2.764,0.895 3.291,2.253 l 17.024,43.906 c 0.358,0.923 1.683,0.868 1.962,-0.082 l 21.307,-71.91"
id="path3129"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,90.420771,1038.8259)"
id="g3131">
<path
d="m 0,0 c 0.098,0.295 5.429,13.962 11.857,30.425 0.761,1.949 2.64,3.236 4.733,3.236 l 16.16,0"
id="path3133"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,157.9695,1033.159)"
id="g3135">
<path
d="m 0,0 4.213,78.933 c 0.13,2.064 2.416,3.241 4.172,2.148 L 40.303,59.207 c 1.77,-1.102 1.704,-3.7 -0.12,-4.71 L 7.25,38.25"
id="path3137"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,23.316581,889.53801)"
id="g3139">
<path
d="m 0,0 30.689,-20.871 c 0.903,-0.671 0.742,-2.068 -0.291,-2.516 L -4.011,-40.29 c -1.163,-0.503 -2.451,0.385 -2.394,1.651 l 2.962,65.389 c 0.092,2.025 1.76,3.62 3.787,3.62 L 32.721,16.505"
id="path3141"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,117.20691,899.21433)"
id="g3143">
<path
d="m 0,0 -12.044,0 c -1.515,0 -2.874,0.895 -3.421,2.253 l -17.702,43.906 c -0.372,0.923 -1.749,0.868 -2.04,-0.082 l -22.154,-71.91"
id="path3145"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,118.38534,934.34873)"
id="g3147">
<path
d="m 0,0 c -0.102,0.295 -5.645,13.962 -12.328,30.425 -0.791,1.949 -2.746,3.236 -4.922,3.236 l -16.802,0"
id="path3149"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,134.13389,933.95885)"
id="g3151">
<path
d="m 0,0 4.213,78.933 c 0.13,2.064 2.416,3.241 4.172,2.148 L 40.303,59.207 c 1.77,-1.102 -0.664,-35.033 -2.488,-36.043 l -30.666,-18"
id="path3153"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(0.90669404,0,0,-0.90669404,52.984786,874.57329)"
id="g3155">
<path
d="M 0,0 -30.018,-16.683"
id="path3157"
style="fill:none;stroke:#ffa52e;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

205
js/jquery.easing.1.3.js Normal file
View file

@ -0,0 +1,205 @@
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

261
js/jquery.jSlots.js Normal file
View file

@ -0,0 +1,261 @@
/*
* jQuery jSlots Plugin
* http://matthewlein.com/jslot/
* Copyright (c) 2011 Matthew Lein
* Version: 1.0.2 (7/26/2012)
* Dual licensed under the MIT and GPL licenses
* Requires: jQuery v1.4.1 or later
*/
(function($){
$.jSlots = function(el, options){
var base = this;
base.$el = $(el);
base.el = el;
base.$el.data("jSlots", base);
base.init = function() {
base.options = $.extend({},$.jSlots.defaultOptions, options);
base.setup();
base.bindEvents();
};
// --------------------------------------------------------------------- //
// DEFAULT OPTIONS
// --------------------------------------------------------------------- //
$.jSlots.defaultOptions = {
number : 3, // Number: number of slots
winnerNumber : 1, // Number or Array: list item number(s) upon which to trigger a win, 1-based index, NOT ZERO-BASED
spinner : '', // CSS Selector: element to bind the start event to
spinEvent : 'click', // String: event to start slots on this event
onStart : $.noop, // Function: runs on spin start,
onEnd : $.noop, // Function: run on spin end. It is passed (finalNumbers:Array). finalNumbers gives the index of the li each slot stopped on in order.
onWin : $.noop, // Function: run on winning number. It is passed (winCount:Number, winners:Array)
easing : 'swing', // String: easing type for final spin
time : 7000, // Number: total time of spin animation
loops : 6 // Number: times it will spin during the animation
};
// --------------------------------------------------------------------- //
// HELPERS
// --------------------------------------------------------------------- //
base.randomRange = function(low, high) {
return Math.floor( Math.random() * (1 + high - low) ) + low;
};
// --------------------------------------------------------------------- //
// VARS
// --------------------------------------------------------------------- //
base.isSpinning = false;
base.spinSpeed = 0;
base.winCount = 0;
base.doneCount = 0;
base.$liHeight = 0;
base.$liWidth = 0;
base.winners = [];
base.allSlots = [];
// --------------------------------------------------------------------- //
// FUNCTIONS
// --------------------------------------------------------------------- //
base.setup = function() {
// set sizes
var $list = base.$el;
var $li = $list.find('li').first();
base.$liHeight = $li.outerHeight();
base.$liWidth = $li.outerWidth();
base.liCount = base.$el.children().length;
base.listHeight = base.$liHeight * base.liCount;
base.increment = (base.options.time / base.options.loops) / base.options.loops;
$list.css('position', 'relative');
$li.clone().appendTo($list);
base.$wrapper = $list.wrap('<div class="jSlots-wrapper"></div>').parent();
// remove original, so it can be recreated as a Slot
base.$el.remove();
// clone lists
for (var i = base.options.number - 1; i >= 0; i--){
base.allSlots.push( new base.Slot() );
}
};
base.bindEvents = function() {
$(base.options.spinner).bind(base.options.spinEvent, function(event) {
if (!base.isSpinning) {
base.playSlots();
}
});
};
// Slot contstructor
base.Slot = function() {
this.spinSpeed = 0;
this.el = base.$el.clone().appendTo(base.$wrapper)[0];
this.$el = $(this.el);
this.loopCount = 0;
this.number = 0;
};
base.Slot.prototype = {
// do one rotation
spinEm : function() {
var that = this;
that.$el
.css( 'top', -base.listHeight )
.animate( { 'top' : '0px' }, that.spinSpeed, 'linear', function() {
that.lowerSpeed();
});
},
lowerSpeed : function() {
this.spinSpeed += base.increment;
this.loopCount++;
if ( this.loopCount < base.options.loops ) {
this.spinEm();
} else {
this.finish();
}
},
// final rotation
finish : function() {
var that = this;
var endNum = base.randomRange( 1, base.liCount );
var finalPos = - ( (base.$liHeight * endNum) - base.$liHeight );
var finalSpeed = ( (this.spinSpeed * 0.5) * (base.liCount) ) / endNum;
that.$el
.css( 'top', -base.listHeight )
.animate( {'top': finalPos}, finalSpeed, base.options.easing, function() {
base.checkWinner(endNum, that);
});
}
};
base.checkWinner = function(endNum, slot) {
base.doneCount++;
// set the slot number to whatever it ended on
slot.number = endNum;
// if its in the winners array
if (
( $.isArray( base.options.winnerNumber ) && base.options.winnerNumber.indexOf(endNum) > -1 ) ||
endNum === base.options.winnerNumber
) {
// its a winner!
base.winCount++;
base.winners.push(slot.$el);
}
if (base.doneCount === base.options.number) {
var finalNumbers = [];
$.each(base.allSlots, function(index, val) {
finalNumbers[index] = val.number;
});
if ( $.isFunction( base.options.onEnd ) ) {
base.options.onEnd(finalNumbers);
}
if ( base.winCount && $.isFunction(base.options.onWin) ) {
base.options.onWin(base.winCount, base.winners, finalNumbers);
}
base.isSpinning = false;
}
};
base.playSlots = function() {
base.isSpinning = true;
base.winCount = 0;
base.doneCount = 0;
base.winners = [];
if ( $.isFunction(base.options.onStart) ) {
base.options.onStart();
}
$.each(base.allSlots, function(index, val) {
this.spinSpeed = 0;
this.loopCount = 0;
this.spinEm();
});
};
base.onWin = function() {
if ( $.isFunction(base.options.onWin) ) {
base.options.onWin();
}
};
// Run initializer
base.init();
};
// --------------------------------------------------------------------- //
// JQUERY FN
// --------------------------------------------------------------------- //
$.fn.jSlots = function(options){
if (this.length) {
return this.each(function(){
(new $.jSlots(this, options));
});
}
};
})(jQuery);

10
js/jquery.jSlots.min.js vendored Normal file
View file

@ -0,0 +1,10 @@
/*
* jQuery jSlots Plugin
* http://matthewlein.com/jslot/
* Copyright (c) 2011 Matthew Lein
* Version: 1.0.2 (7/26/2012)
* Dual licensed under the MIT and GPL licenses
* Requires: jQuery v1.4.1 or later
*/
(function(a){a.jSlots=function(c,b){var d=this;d.$el=a(c);d.el=c;d.$el.data("jSlots",d);d.init=function(){d.options=a.extend({},a.jSlots.defaultOptions,b);d.setup();d.bindEvents();};a.jSlots.defaultOptions={number:3,winnerNumber:1,spinner:"",spinEvent:"click",onStart:a.noop,onEnd:a.noop,onWin:a.noop,easing:"swing",time:7000,loops:6};d.randomRange=function(e,f){return Math.floor(Math.random()*(1+f-e))+e;};d.isSpinning=false;d.spinSpeed=0;d.winCount=0;d.doneCount=0;d.$liHeight=0;d.$liWidth=0;d.winners=[];d.allSlots=[];d.setup=function(){var e=d.$el;var g=e.find("li").first();d.$liHeight=g.outerHeight();d.$liWidth=g.outerWidth();d.liCount=d.$el.children().length;d.listHeight=d.$liHeight*d.liCount;d.increment=(d.options.time/d.options.loops)/d.options.loops;e.css("position","relative");g.clone().appendTo(e);d.$wrapper=e.wrap('<div class="jSlots-wrapper"></div>').parent();d.$el.remove();for(var f=d.options.number-1;f>=0;f--){d.allSlots.push(new d.Slot());}};d.bindEvents=function(){a(d.options.spinner).bind(d.options.spinEvent,function(e){if(!d.isSpinning){d.playSlots();}});};d.Slot=function(){this.spinSpeed=0;this.el=d.$el.clone().appendTo(d.$wrapper)[0];this.$el=a(this.el);this.loopCount=0;this.number=0;};d.Slot.prototype={spinEm:function(){var e=this;e.$el.css("top",-d.listHeight).animate({top:"0px"},e.spinSpeed,"linear",function(){e.lowerSpeed();});},lowerSpeed:function(){this.spinSpeed+=d.increment;this.loopCount++;if(this.loopCount<d.options.loops){this.spinEm();}else{this.finish();}},finish:function(){var e=this;var g=d.randomRange(1,d.liCount);var f=-((d.$liHeight*g)-d.$liHeight);var h=((this.spinSpeed*0.5)*(d.liCount))/g;e.$el.css("top",-d.listHeight).animate({top:f},h,d.options.easing,function(){d.checkWinner(g,e);});}};d.checkWinner=function(f,g){d.doneCount++;g.number=f;if((a.isArray(d.options.winnerNumber)&&d.options.winnerNumber.indexOf(f)>-1)||f===d.options.winnerNumber){d.winCount++;d.winners.push(g.$el);}if(d.doneCount===d.options.number){var e=[];a.each(d.allSlots,function(h,i){e[h]=i.number;});if(a.isFunction(d.options.onEnd)){d.options.onEnd(e);}if(d.winCount&&a.isFunction(d.options.onWin)){d.options.onWin(d.winCount,d.winners,e);}d.isSpinning=false;}};d.playSlots=function(){d.isSpinning=true;d.winCount=0;d.doneCount=0;d.winners=[];if(a.isFunction(d.options.onStart)){d.options.onStart();}a.each(d.allSlots,function(e,f){this.spinSpeed=0;this.loopCount=0;this.spinEm();});};d.onWin=function(){if(a.isFunction(d.options.onWin)){d.options.onWin();}};d.init();};a.fn.jSlots=function(b){if(this.length){return this.each(function(){(new a.jSlots(this,b));});}};})(jQuery);

4
js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

36
simple.html Normal file
View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Slot Machine</title>
<link rel="stylesheet" href="css/style.css" type='text/css'>
</head>
<body id="playNormal">
<div class="wrap">
<div class="logo">
<img src="img/logo.svg" alt="">
</div>
<div class="slots">
<ul class="slot">
<li>adsf</li>
<li>sfgd</li>
<li>3fgd</li>
</ul>
</div>
</div>
<script src="js/jquery.min.js"></script>
<!-- <script src="js/jquery.easing.1.3.js" type="text/javascript" charset="utf-8"></script> -->
<script src="js/jquery.jSlots.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$('.slot').jSlots({
number: 4,
spinner : '#playNormal',
// winnerNumber : 7
});
</script>
</body>
</html>

31
slots.html Executable file
View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Slot Machine</title>
<link rel="stylesheet" href="css/style.css" type='text/css'>
</head>
<body id="playNormal">
<div class="wrap">
<ul class="slot">
<li>adsf</li>
<li>sfgd</li>
<li>3fgd</li>
</ul>
</div>
<script src="js/jquery.min.js"></script>
<!-- <script src="js/jquery.easing.1.3.js" type="text/javascript" charset="utf-8"></script> -->
<script src="js/jquery.jSlots.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$('.slot').jSlots({
number: 4,
spinner : '#playNormal',
// winnerNumber : 7
});
</script>
</body>
</html>