Camera Shake effect in Android

1.7k Views Asked by At

Working on Android mobile Camera effects.

How to get Camera shake effect? Tried adding shake animation to the surfaceview, but its not shaking the camera view. Camera view remains stable(i.e., whatever i can view from camera on the screen should shake, instead view is shaking).

How to achieve this complete effect in android?

This is handled by iOS using the filter GPUImageTransformFilter. I want an alternative to achieve this.

1

There are 1 best solutions below

0
On

Why not simply extend a new class that gives that functionality?

class CustomView extends SurfaceView {
    //override or create methods that did what the TextureView did,
    //such as setTransform,etc.
}

Then it'd work perfectly with the package, and would have any additional functionality that you need it to.

You could also create an interface that has these methods:

interface Transformable{
    protected setTransform(Matrix mx);
}

Then extend the class and implement the interface..

class CustomView extends SurfaceView implements Transformable{
    @Override
    protected setTransform(Matrix mx){
        //do stuff here
        //this.getMatrix().set(mx);
}
}

You could then use the interface on any other View that doesn't have the functionality.