Random wheelspin

How would I best go about creating a wheelspinner like this in Hype?
The items are fixed, they'll be what you see in the screenshot. Someone asked if I could help make their wheel look better, and they're using some stream-elements type service which is kinda terrible and isn't as customizable graphically as doing something myself for them - so it's not like the name wheel where the objects could change. I just want a wheelspin that can be easily activated, lands at a random spot.... and can be spun pretty much on demand (by the person hosting it)

In fact, I'm totally OK with making the wheel as an image, and designing it up the way I want it, just getting it to spin and land at a random spot is ....the tough challenge. I'd started the base for a wheel, see second photo

Thank you so much!

given an element with id wheel you can run lines ...

	hypeDocument.setElementProperty(wheel, 'rotateZ', 0);//reset

	const minDegr = 4000;
	const maxDegr = 5000;
	const dur = 5;
	function randomInRange(min, max) {  
    return Math.floor(Math.random() * (max - min) + min); 
	hypeDocument.setElementProperty(wheel, 'rotateZ', randomInRange(minDegr, maxDegr), dur, 'easeout')

Thank you, trying to set this up as an on-click and I can't seem to get anything to happen.

To make sure I'm not doing this wrong, where do I make sure "wheel" is set to ID wheel, and that the script is in the right place?

Thank you again so much.

in the elementinspector set the id of the wheel to wheel and run the script whereever you want ...

1 Like

I'm guessing here, like this, yes?

exact, should work then ... :slight_smile:

1 Like

Strangely not getting it working :frowning:

Screenshot 2023-03-22 at 1.41.12 PM

if you could provide the hypedoc ...

1 Like

Here's the hype document and the associated images... let me know what I'm doing wrong so I learn, please and thank you :slight_smile: I prefer learning but I'm dumbfounded.

Loading screen is irrelevant to the action
Wheel screen - it's "juicy-center" that has the click action attached to it for wheel.

juicywheel--.hype.zip (2,6 MB)

1 Like

thank you thank you thank you, what was I doing wrong?

Eventually I'll figure out how to add sound when it's spinning but that's whenever - I'm doing this for a really good friend who's been very kind to me while I'm going through a ridiculous medical battle.

there's been no sceneswitch from the intro to the wheelscene ... that's mainly all ...

1 Like


It's been a long week and it's only Wednesday. I feel like an idiot. I am so so sorry. I've been using Hype for years...just a total oversight on my part.