So, yeah, I guess how we could actually do that is quite simple for the random one anyway. So, I guess going back to the problem, the kind of problem is that you can drag and drop this and drop it on the 500 and you've got no velocity. So, maybe all we need to do is give a minimum velocity in here. And if we have anything less than the minimum, then we kind of generate a random value. So, what we can do is just create a velocity here. And then we're going to say, like, if gesture state, if the velocity is greater than, let's say, one, then we're happy with it. Otherwise, like, let's create a random or pull a random value from somewhere. And here I've just added a plus one just to give it, like, an initial kick of velocity, just that it kind of moves something similar. And then we can pass this directly into that config. So, if we now reset this, so what we should see is we spin it as normal and we're all good. But if we reset that down to zero, if I now drag and drop that and just let it go, we get that kind of velocity kind of given for us. And we've added a, you know, we've added a random function in here. So, if you did it again, and we shouldn't, you know, we shouldn't always get the same value. So, we should be able to get something that's different to that 50. So, yeah. So, that kind of, I guess, solves one thing. The other thing is, like, if we wanted to keep this nice and clean, we could have a kind of, like, min velocity. Into there. And, yeah, that just gives us a bit of kind of control over the, yeah, of the kind of, of the gesture, I guess. Alan, any other thoughts on the other bits? I mean, there's that, there's some, just some ideas. React Native has, like, a native confetti library that you could stick in. There's a screenshot at the start of the presentation with confetti in it. And haptics, haptic feedback. It would be kind of cool if, if you've ever seen, like, one of those Wheel of Fortune kind of things where there's actually, like, little bits in between each quadrant, or not quadrant, but section that holds it, and it kind of ticks between, as it slows down, it ticks between. And so, we could, we could do that. So, yeah, I mean, it'd be really interesting to see what kind of ideas any of you have, like, how we could improve this, or, or it would be so cool if you pulled it down and, like, rebuilt it and then extended it to something that you thought was cool. I think that would be really cool, yeah. Yeah, for sure. Yeah, like, this is very much, like, yeah, first, first implementation. So, there's kind of, yeah, any other ideas to make, ideas to make it awesome would be sweet. I know, like, one of the other things we talked about doing is, I guess, using, like, a kind of image here and rotating it around is a bit of a cheating way of doing it. But, you know, what if we could flash individual items when we landed on it, and kind of, you know, actually build this up as its own component that we were rotating, rather than an image, and, you know, then we could kind of, like, flash the segment that we land on and have that, like, emit the confetti, or, yeah, something like that would be quite cool. Yeah, Paul's comment about taking to the DX is, yeah, definitely a good shout. Animated, like, we could use the animated value, rather than it just being a kind of a single, yeah, a single kind of value, we could use the XY, kind of, helper to actually, XY, kind of, helper to actually allow us to move things in the Y and X axes at the same time. And that way we could, yeah, we could use the X value, too, and have that rotation, that X value map with the, yeah, with the kind of movement along the Y axis, as well. But, yeah, I think there might be easier ways to solve the problem with, about, like, kind of moving your thumb around it. For example, like, we just kind of, like, detect when you move your thumb, like, further left than the kind of the middle point, and then start, like, taking, yeah, negating the value, which is, again, a bit of a cheat, but... Will you still cover how to decide which field we eventually spin to? So, that's a really good question. We haven't, kind of, gotten that far yet. It's definitely something, like, I think we could probably try and start, yeah, putting it together. I think the way that, I guess, we can, kind of, think about how to do that is that, at the moment, this value, yeah, we've mapped this, we've kept it quite easy for ourselves because these values are mapped from one pixel or one, yeah, one unit in the value, in the animated value equals one degrees of rotation. And if we, kind of, yeah, say that we've got, like, 10 segments here, each segment is going to be 36 degrees of value, or 36, kind of, pixels in the value. So, what we can do is this start function gives you a callback on finish. So, let's just check what this value is. So, what we should see now is if we let that spin out, we should then see, kind of, the finish value here. Cool. And what we want to do then is actually say, like, we want to know the outcome or the current value at the time of finish. And we then want to be able to, I guess, kind of, divide it by 10 to give us the, yeah, the, kind of, segment. Is that right? Divide it by 10? Yeah. Here we go.
Comments