-
Notifications
You must be signed in to change notification settings - Fork 116
ParabolicMotion Animation
#Text animate
-
Create a TextDrawer
Setting and String, the Paint that textSize and textColor has been set in the constructor. -
To generate a DisplayObject, and Add it to the FPSTextureView or FPSSurfaceView or Container.
If the Tween animation after with tween(), describe the parabolic() If you do the animation of the parabolic movement.
This time a ParabolicMotion animation that describes the parabolic().
// ParabolicMotionText
Paint paint = new Paint();
paint.setColor(ContextCompat.getColor(context, R.color.colorPrimary));
paint.setTextSize(Util.convertDpToPixel(20, context));
TextDrawer textDrawer = new TextDrawer("Text", paint);
DisplayObject textDisplay = new DisplayObject();
textDisplay.with(textDrawer)
.parabolic()
.transform(800, 800)
.initialVelocityY(-40)
.end();
mFPSTextureView.addChild(textDisplay);
#Bitmap animate
-
Create a BitmapDrawer.
Set the Bitmap to the constructor. -
To generate a DisplayObject, and Add it to the FPSTextureView or FPSSurfaceView or Container.
If the Tween animation after with tween(), describe the parabolic() If you do the animation of the parabolic movement. This time a ParabolicMotion animation that describes the parabolic().
final DisplayObject bitmapDisplay = new DisplayObject();
bitmapDisplay.with(new BitmapDrawer(mBitmap).dpSize(context))
.parabolic()
.transform(0, mFPSTextureView.getHeight())
.reboundBottom(false)
.accelerationX(8)
.initialVelocityY(-30)
.bottomHitCallback(new AnimCallBack() {
@Override
public void call() {
// It remove Once you hit the canvas at the bottom .
mFPSTextureView.removeChild(bitmapDisplay);
}
})
.end();
mFPSTextureView.addChild(bitmapDisplay);
#Property
function | detail |
---|---|
transform(float x, float y) | Shortcut method to quickly set the transform properties on the display object. |
frequency(int) | Set the number to be updated in every times of tick. |
initialVelocityY(float velocityY) | Set initial velocity of parabolic movement (y position) in pixels |
accelerationY(float accelerationY) | Set the number to accelerate (y position) in pixels. Default value is 2 |
accelerationX(float accelerationX) | Set the number to accelerate (x position) in pixels. Default value is 8 |
coefficientRestitutionY(float coefficientRestitutionY) | Set coefficient Of Restitution Y, as a percentage of 1 |
coefficientRestitutionX(float coefficientRestitutionX) | Set coefficient Of Restitution X, as a percentage of 1 |
reboundBottom(boolean reboundBottom) | Set the flag indicating whether not rebound bottom. |
reboundLeft(boolean reboundLeft) | Set the flag indicating whether not rebound left. |
reboundRight(boolean reboundRight) | Set the flag indicating whether not rebound right. |
bottomBase(float bottomBase) | Set the number to rebound bottom (y position) in pixels. |
rightSide(float rightSide) | Set the number to rebound right (x position) in pixels. |
leftSide(float leftSide) | Set the number to rebound left (x position) in pixels. |
bottomHitCallback(AnimCallBack animCallBack) | Set callback when responding to a bottom base. |
leftHitCallback(AnimCallBack animCallBack) | Set callback when responding to a left side. |
rightHitCallback(AnimCallBack animCallBack) | Set callback when responding to a wall of right. |