¡@

Home 

2014/10/16 ¤W¤È 08:10:27

android Programming Glossary: ballh

How can I use the animation framework inside the canvas?

http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas

screenW int screenH int X int Y int initialY int ballW int ballH int angle float dY float acc Bitmap ball bgr public BallBounce.. R.drawable.sky_bgr load a background ballW ball.getWidth ballH ball.getHeight acc 0.2f acceleration dY 0 vertical speed initialY.. dY Increase or decrease vertical position. if Y screenH ballH dY 1 dY Reverse speed when bottom hit. dY acc Increase or..

Android: How to rotate a moving animated sprite based on the coordinates of its destination

http://stackoverflow.com/questions/6003823/android-how-to-rotate-a-moving-animated-sprite-based-on-the-coordinates-of-its

Matrix matrix new Matrix matrix.postRotate angle ballW 2 ballH 2 rotate it matrix.postTranslate X Y move it into x y position.. the position of the canvas canvas.rotate angle X ballW 2 Y ballH 2 rotate the canvas' matrix canvas.drawBitmap ball X Y null..

How can I use the animation framework inside the canvas?

http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas

new BallBounce this class BallBounce extends View int screenW int screenH int X int Y int initialY int ballW int ballH int angle float dY float acc Bitmap ball bgr public BallBounce Context context super context ball BitmapFactory.decodeResource.. a ball image bgr BitmapFactory.decodeResource getResources R.drawable.sky_bgr load a background ballW ball.getWidth ballH ball.getHeight acc 0.2f acceleration dY 0 vertical speed initialY 100 Initial vertical position. angle 0 Start value for.. bgr 0 0 null Compute roughly ball speed and location. Y int dY Increase or decrease vertical position. if Y screenH ballH dY 1 dY Reverse speed when bottom hit. dY acc Increase or decrease speed. Increase rotating angle. if angle 360 angle..

Android: How to rotate a moving animated sprite based on the coordinates of its destination

http://stackoverflow.com/questions/6003823/android-how-to-rotate-a-moving-animated-sprite-based-on-the-coordinates-of-its

it is easy to rotate a sprite you can use canvas or matrix Matrix matrix new Matrix matrix.postRotate angle ballW 2 ballH 2 rotate it matrix.postTranslate X Y move it into x y position canvas.drawBitmap ball matrix null draw the ball with the.. ball with the applied matrix method two canvas.save save the position of the canvas canvas.rotate angle X ballW 2 Y ballH 2 rotate the canvas' matrix canvas.drawBitmap ball X Y null draw the ball on the rotated canvas canvas.restore rotate the..