I want to play sound on rotating the wheel According to angle and coordinate the speed of wheel rotating
I want to Sound Play on right time when the Pin touch on - line touch of Arc.
Also, Want to Animation on Pin when touch like Shaking.
Sound is Play but the Sound Continuously play and seeking not Coordinates According to Canvas wheel
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
drawWheelBackground(canvas);
initComponents();
float tempAngle = 0;
float sweepAngle = 360 / mWheelItems.size();
if (this.mWheelItems != null) {
Log.e("mWheelItems.size()", String.valueOf(mWheelItems.size()));
for (int i = 0; i < mWheelItems.size(); i++) {
archPaint.setColor(mWheelItems.get(i).color);
archPaint1.setColor(Color.WHITE);
canvas.drawArc(range, tempAngle, sweepAngle, true, archPaint2);
canvas.drawArc(range, tempAngle, sweepAngle, true, archPaint);
drawImage(canvas, tempAngle, mWheelItems.get(i).bitmap, mWheelItems.get(i).mvalue, sweepAngle);
}
if (!(this.resourcePlayer == null)) {
if (this.resourcePlayer.isPlaying()) {
resourcePlayer.setVolume(100, 100);
this.resourcePlayer.seekTo(0);
} else {
this.resourcePlayer.start();
}
}
}
}
Rotation according to wheelItemCenter and 360 degrees
final float wheelItemCenter = 180 - getAngleOfIndexTarget(target) + (360 / mWheelItems.size()) / 2;
animate().setInterpolator(new DecelerateInterpolator())
.setDuration(DEFAULT_ROTATION_TIME)
.rotation((360*5) + wheelItemCenter)
Spin the wheel works by offering entrants the opportunity to win prizes, determined by spinning a virtual wheel that will land on a random segment. Each segment offers a different prize, or offer. This means that there is always a chance to win something, regardless of where the segment lands.
To make a prize wheel, start by cutting a circle out of plywood or buying a plywood round that's about 1 inch thick. Next, sand the wheel to get rid of any rough edges. Then, divide the wheel into equal segments and mark each segment with a certain prize or number. Finally, decorate the wheel however you'd like!
Here we will write the HTML code required to build our wheel. Make a new section with the assistance of <div> tag inside your body labels ( <body> </body> ). Add the attributes id="mainbox" and class="mainbox" inside that segment.
So if I'm understanding correctly, you want to adjust the sound based on the wheel's speed and play it whenever it hits one of your pins.
Playing it whenever it hits one of the pins should be a math-question, if it plays continuously that would mean that your wheel is spinning fast and that the sound you're playing is longer than the duration between hitting two pins, I assume.
You can play around with the speed
and pitch
of your sound. If you're using a MediaPlayer
you can change the PlaybackParams
according to this - check out setPitch and setSpeed.
The faster your wheel is, the higher is the speed / pitch of your sound. The slower it gets, the more you also slow down the sound.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With