Code

Discussion on Spin2Win Wheel - Spin It 2 Win It!

Discussion on Spin2Win Wheel - Spin It 2 Win It!

Cart 2,150 sales

chrisgannon supports this item

Supported

This author's response time can be up to 5 business days.

699 comments found.

I’m very sorry for the annoyance, but I have one more question. How can I update json file after every spin? In fact I only need to update sectors’ probabilities after every spin. Thanks in advance!

A few ways.

1. Use a script (like PHP) connected to a database to supply the JSON. Then update the database after each spin and reload the wheel (refresh the window) which calls the script.

2. Load the JSON, store that data as a local session object. Add or remove elements from the data object after each spin and reload the wheel wit the new data (but future loads will come from the locally stored data object).

Hi. Could you help me please to solve a problem with number of spins? When I click the spin button for the first time, everything works great, the wheel beautifully spins for 3-4 times. When I click the spin button for the second, third, etc. time, the wheel doesn’t spin at all. It has 1 second animation of sector changing, but it’s not spinning. How can I make it beautifully spin every time the button is clicked? Thanks!

I’very sorry. I think I had to clean my cache. Everyrhing works! I have one more question with probability. Is it possible to use float number as probibility. For example, I want to set probability of mobile phone winning to 0.01.

Can you DM me the URL please through my profile? (Don’t post it on the forum please)

You can’t use float numbers but you can get the same result by setting the highest probability to a number greater than 100 (say, 10000) and then setting the least probable value (your phone) to 1.

Hi. Today I’ve bought your plugin. It is very beautiful but I have one question. The thing which is done first is sending xhr request to get JSON settings for wheel. But the response of that request is visible to anybody in console, so anyone can see the probability and so on. Is there any way to hide the received JSON file? Thanks!

There’s a PHP file supplied – maybe use that instead and ensure it only passes back data when it receives a flag or a query. You could also encode the result somehow and decide it clientside. Just offering some ideas!

I should point out that once the data is with the client it’s out of your hands so there’s not a lot you can do. Encryption is probably your best bet.

https://stackoverflow.com/questions/36202082/how-to-hide-data-received-via-http-requests

Hello Sir, I am contacting you concerning the Spin2Win application, I would like to know if you can adapt the application to our needs and it costs how much this modification.

1- we need the application to display photos and text downloaded via a database. 2- also allows us to enter a number of stock per gift (If the gift = 0, the gift will be displayed on the application but you must not win this gift). 3- If the gift is won, the stock must be de-increment for example (5 Pc to be won if 1 Pc is won, you must stay on the stcok 4 Pc) If a gift = 0 it must be displayed on the application but it must not be earned.

I remain at your disposal for any further information.

cordially

Replied via the DM you sent.

Hi,

we have setup the spin2win and one feature I liked when I bought it is the anti-cheat. Because we are going to set maybe some good product we face that seems a bit insecure on the myResult to send to a web service the results.

Someone could set a breakpoint there and the change the segment winned.

How can we prevent any javascript manipulation keep strong the system ?

Thanks a lot.

Btw the anti-cheat is part of the throw gesture where it measures the velocity of the throw and if it’s too slow it suggests the user has tried to place the wheel on the desired segment.

mmm looks good so then we have to create the function decide the segment winner.

How can we send that parameter ? How can I check tha anti-cheat suggestion ?

Thanks

It’s up to you how you send the parameter – it really depends on your stack.

Hi again Chris— Is there a way to add a specific color to a specific segment? Thanks.

Don’t know why my question is showing up with strike-thru text. I didn’t do that!

No don’t take anything else out. Just the probability. The Win/Lose property is referenced in the JS whether you use it or not and it will break the wheel if you remove it.

THANK YOU!! I think I’m all good now!

Pre-Purchase Query. 1. Do have ReactJS Support? 2. Run offline in case there is no Internet. 3. Create Report of each spin, including wining and losing.

1. No but this is pure JS so it can run in a React environment.

2. There’s an offline version but it doesn’t detect connection and switch to it.

3. You could easily build your own report based on the result event data for each spin.

I’m having trouble with putting this on a webpage because it conflicts with the existing css styles and when I try to change anything, it messes up worse.

I can’t get it to work. It’s “body” and “button” that messes everything up

I kept fiddling around with it and finally got it! It’s all working!

Excellent :D

Hi Chris, I’m a newbie here and I’m not sure if this is what I need.

So, I need to embed this wheel to a page in my wordpress site, not even as a pop-up e-commerce but just so people can play around. Does this item allow me to do that?

Also, how do I customise the values and the branding once I purchased ?

Hi Chris, I’ve done all the steps but it won’t show on the website. Is there a way I can DM or email you a screenshot ? On your profile it only shows a field without the ability to attach a file

Yep you can DM me on my profile page (on the right)

http://codecanyon.net/user/chrisgannon

Did you receive my message? I went to that link and for the life of me I can’t find anywhere to attach files or anywhere that says DM

Dear Sir,

Since the purchased date, we have not used any chance for the technical support. All our payments are blocked due to lockdown. Can you help us this time. We will surely update the support once the payment is cleared. Client is asking this change for payment clearance.

The new version is now available

Hi Sir,

I have purchased the Spin 2 wheel Application. In that spinDirection: clockwise is not working.

Please help me to resolve this issue

Sincere apologies – I temporarily removed it as it had a bug (fixed now and in the queue to be uploaded to Envato again). Please DM your email address and I will send you the updated version with this fixed.

I should remind you that your support has expired…

Btw I removed your comment with your email address. You probably don’t want that in a public forum.

Hello

We did this setting like this:

{probability, “type”: “image”, “value”: ”/spin2wheel/no-win.svg”, “win”: true, “resultText”: “Bedre held næste gang”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-1-golden.svg”, “win”: false, “resultText”: “Tillykke, du har vundet e-bog <br/> ”Let din dag – med mad og bevægelse””, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/no-win.svg”, “win”: false, “resultText”: “Bedre held næste gang”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-2-golden.svg”, “win”: true, “resultText”: ” Tillykke, du har vundet A3 plakat til download med Citat fra F. Nietzsche,<br/> ”Det er når man går de store tanker fødes”.”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/no-win.svg”, “win”: false, “resultText”: “Bedre held næste gang”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-3-golden.svg”, “win”: false, “resultText”: “Tillykke, du har vundet plakat fra Dialægt <br/>”Den ivrige skridttæller”!”, “userData”: {prize“}}, {probability, “type”: “image”, “value”: ”/spin2wheel/prize-trophy.svg”, “win”: false, “resultText”: “Tillykke, du har vundet et <br/>3 mdr. gratis abonnement til pling.dk!<br/> Du vil modtage din unikke kode på mail i uge 38.”, “userData”: {prize“}} ],

But we ended out with: Total Prizes: 559 Total Prize1: 20 Total Prize2: 20 Total Prize3: 13 Total Trophy: 20

So it seems like the calcualtion do not work. We also set 0 when a we have max(prize), but that do not work either.

What do we do wrong?

Your support has expired. Please renew for further support. Thanks!

It is renewed :-)

Hi, i just bought your app, which is spin2win. Its cool. Here is the question, how could i possibly trigger the wheel out of the init function?

Because as soon as user click the “click to spin”, firstly i do need to check whether user has balance or not, if user has, then i want to trigger the wheel?

Thanks in advance.

okay thanks. one more thing, how can i destroy the class and re-init? i did built tab menu system. once user click the tab, i want to re-init the spin2wheel with new segments. so firstly, i do need to destroy or re-init. Thanks in advance.

I originally designed an elaborate initialisation function but quickly realised a better and quicker way to do it is just to reload the page (window.reload). It’s practically instant and barely perceptible.

I’ve had a chance to look at your question regarding displaying the wheel and only triggering a spin once a statement is true and there isn’t a simple way to do it.

However it’s possible with some extra development but because it hasn’t been requested before by other buyers, I would not put this new functionality in the core script as an option for future customers (i.e. you would have to pay for it).

We’ve had the Spin2Win wheel up on our web site for a couple of months now, and it’s working very well. For our site, the use case basically looks like this: the customer visits the detail page for a particular item for sale, spins the wheel on that page, and receives the discount that comes up on the wheel. The spinResult() function tied to the onResult event redirects to a processing page that puts the discounted item into the shopping cart.

Unfortunately, we’ve noticed a couple of users trying to cheat by spinning the wheel, and as it slows down toward the random discount, they will mash their back button if they don’t like the discount they’re getting, and simply repeat the process until they get a result they like. I was able to prevent the cheating by pre-generating the random wheel result as soon as the customer visits the page and storing it in the database, so that a particular customer will never get a different result on a particular item.

However, the site owner wants to detect (and log) the cheating attempt itself. I think the best (only?) way to do that would be to hang some code off the button that initiates the spin—if we wait until onResult is triggered, that’s too late because by then they will have mashed their back button. What the site owner wants is a way to detect that a customer clicked that spin button more than once for a particular item.

I’m not seeing an obvious way to do this and could use some help … I am guessing you wouldn’t need to see my code since it’s so closely modeled on the sample code, but if you provided a modified version of your sample code showing how I might detect and count spin button clicks, that might give me everything I need to adapt your sample to my purpose.

I hope this makes sense and would be happy to provide more info. Thank you!

—Lou

Ok how’s this.

You create a second button (secondBtn) which becomes the main button on the page (the Click to Spin button).

The first, original button (firstBtn) is still on the page, hidden and you still pass this into init() as normal.

The secondBtn can now call firstBtn’s onclick event using:

secondBtn.onclick = function (e) {

    //do something here

    firstBtn.onclick();

}

Does that help?

Very much! Thanks to this tip I was able to make the whole process sequential and synchronous. Thank you!

Excellent! Any chance of a positive review? :)

Hi. I have set the number of spins to be 3. I have different values for different segments and I want the total values to add up to a certain value after 3 spins. For example, I want the total value to be $35. So it can be $5 + $10 + $20 = $35 or $15 + $15 + $5 = $35 or any other combinations. Is this possible?

Ah I see. No you can’t determine/change the wheel’s destination once the set of spins/go has started.

I see. If that’s the case, is there any way to ensure that the wheel lands on a certain segment at least once? For example, the wheel will land on ‘10’ at least once out of 3 spins.

Yes you can totally program where the wheel lands on all spins.

Check the docs for spinDestinationArray.

https://gist.github.com/chrisgannon/1afba5c07faeb9947a2e84d987200e3e#json-properties

Read it carefully as there are some simple rules that need to be adhered to (like removing the probability property – you don’t have probability when the destination is predetermined).

In the JSON you can define which segments the wheel will land on like this:

"spinDestinationArray":[2,12,5]

In this example there are 3 spins and the wheel will land on segment 2, then 12 then 5.

I just purchased and loaded it up, and it is huge – more than half the wheel is off the page? It looks like you may have fixed this, but apparently i did not download the corrected version? thanks

FYI I have just updated the wheel with this change. I originally made the change as a result of buyers requesting it but it seems that the original CSS is better!

Thanks for the updated css – got everything looking the way I want! The issue that I am now having: I have put a “url in the pop up” that will take the winners to a reward page – it is working, but on the last spin, if it is a winner, the link/pop up does not last long enough before it switches to the end on game message pop up? I like the end of game message, but is there a way to add more time before the switch? or can i set it to automatically lose on the last spin? Looking for suggestions? thanks

Hello, a few questions:

How can I set it so that there is only one segment, e.g., there is literally only one possible win. I am not talking about having multiple segments with only one being 100% probability of winning, I want simply a wheel with 1 segment (takes up the whole wheel). Is this possible?

Secondly, the wheel is too massive and has to be scrolled down to view the wheel. Is it possible to have the wheel to the left side and the text / spin the wheel button on the right side?

Hello again, this answers the size query, however is there a way I can set the wheel up on the left and the spin button on the right?

Also, whenever I try and remove the intro text, the winning message at the end also disappears. Could you let me know how I can keep the winning text without having the “you have to spin it 2 win it” text box? Thanks (I believe it’s labeled toast)

To change the layout you will need to play around with the CSS. Try using different flexbox properties.

Again with the toast popup, you will need to hide it at the start (I recommend using JS) and then show it when the winning text happens (onResult).

These are all changes to the core scripts which support doesn’t cover. You’ll need to play around to get the result you want.

Would you be able to help with this if I paid a bit extra? I sent an email.

Oh sorry the link just said support and it takes you to what looks like a private messaging form. And I didn’t know I posted the code… How is that even possible from my url when PHP source is not accessible that way. There is no way you can get the complete script by visiting a url that uses it… I solved this anyway!

No problem its for a free to use incentive giving our another reason to login each day and will only be used on the one site. I know how much work, time and love that has to be poored in to a script to a standard you can feel proud of and for people to the steal from you is not right, I am totally behind your terms and respect the licence. Great job its really something!

Is there any reason you use height: 100vw; and not 100vh? The page is much better suited to 75vh & 75 vw set on wheelSVG and the container above at 100vh 100vw.

When they are both at 100 at 800px width the wheel doesn’t fit the page…

Yes I noticed that this morning and changed it

Plugin is not working.

Installing Plugin from uploaded file: codecanyon-uFuBQYvz-spin2win-wheel-spin-it-2-win-it.zip Hola! Would you like to receive automatic updates and unlock premium support? Please activate your copy of WPBakery Page Builder.

Dismiss this notice. Unpacking the package…

Installing the plugin…

The package could not be installed. No valid plugins were found.

Plugin installation failed.

Return to Plugin Installer

Hi,

That’s because it’s not an installable WP plugin. It’s a set of HTML, JS and CSS files.

https://codecanyon.net/item/spin2win-wheel-spin-it-2-win-it/16337656/faqs/29174

Hi ! I read form the features that the wheel suports images or text label (or both!).

Is it a way to set on the same segment Image and Text ?

It would be grate to be available to set a text with an image.

Thanks,

I have an FAQ for that but Envato have broken my FAQ section. I have raised a ticket with them and I’ll be in touch ASAP.

Sorry for the delay – my FAQ ‘Show More’ button seem to be broken so I had to Google my own support! This FAQ might help https://codecanyon.net/item/spin2win-wheel-spin-it-2-win-it/16337656/faqs/32513

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey