org.rajawali3d.animation.RotateOnAxisAnimation.play()

Here are the examples of the java api org.rajawali3d.animation.RotateOnAxisAnimation.play() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

15 Source : ShadowMappingRenderer.java
with Apache License 2.0
from kanawish

@Override
protected void initScene() {
    try {
        getCurrentScene().setBackgroundColor(Color.BLUE);
        DirectionalLight key = new DirectionalLight(0, -2, 0);
        key.setPosition(0, 2, 0.1);
        // key.setLookAt(0,-2,0);
        key.enableLookAt();
        key.setPower(4);
        getCurrentScene().addLight(key);
        Material material = new Material();
        material.setDiffuseMethod(new DiffuseMethod.Lambert());
        material.enableLighting(true);
        Cube cube = new Cube(1);
        cube.setMaterial(material);
        getCurrentScene().addChild(cube);
        RotateOnAxisAnimation anim = new RotateOnAxisAnimation(new Vector3(1, 1, 1), 360);
        anim.setTransformable3D(cube);
        anim.setDurationMilliseconds(20000);
        anim.setRepeatMode(Animation.RepeatMode.INFINITE);
        getCurrentScene().registerAnimation(anim);
        anim.play();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

5 Source : SimpleVrRenderer.java
with Apache License 2.0
from kanawish

@Override
protected void initScene() {
    try {
        getCurrentScene().setBackgroundColor(Color.BLUE);
        getCurrentCamera().setFarPlane(1000);
        // Skybox images by Emil Persson, aka Humus. http://www.humus.name [email protected]
        try {
            getCurrentScene().setSkybox(R.drawable.posx, R.drawable.negx, R.drawable.posy, R.drawable.negy, R.drawable.posz, R.drawable.negz);
        } catch (ATexture.TextureException e) {
            e.printStackTrace();
        }
        // Lights,
        DirectionalLight key = new DirectionalLight(0, 0.1, 0.2);
        key.setPosition(0.0, 10.0, 2.5);
        key.enableLookAt();
        key.setPower(2);
        getCurrentScene().addLight(key);
        // Models
        Material material = new Material();
        material.setDiffuseMethod(new DiffuseMethod.Lambert());
        material.enableLighting(true);
        Cube cube = new Cube(1);
        cube.setPosition(0, -1, -3);
        cube.setMaterial(material);
        getCurrentScene().addChild(cube);
        // NOTE: Camera is controlled via VR headset orientation.
        // Action!
        RotateOnAxisAnimation anim = new RotateOnAxisAnimation(new Vector3(1, 1, 1), 360);
        anim.setTransformable3D(cube);
        anim.setDurationMilliseconds(20000);
        anim.setRepeatMode(Animation.RepeatMode.INFINITE);
        getCurrentScene().registerAnimation(anim);
        anim.play();
    } catch (Exception e) {
        e.printStackTrace();
    }
}