I want to play a sound while the wheel is spinning. In accordance with the angle and coordinate the speed of rotation of the wheel.
I want to play the sound at the right time when Pin touches the linear touch of Arc.
Also, want an animation on the Pin when touched, like Shaking.
A sound is a reproduction, but the sound is continuously reproducing and is not looking for coordinates. According to the 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 the wheel of ITCenter 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)

source share