Non-linear camera movement
How to move the camera using a custom-defined function for the speed
When calling wade.moveCamera, you can use a constant for the speed, but you can also use a function. This function is passed the distance to the target, and returns a number, that is the speed to use for the camera movement.
    App = function()
{
    var zoomIn = true;
    this.load = function()
    {
        wade.loadImage('/snippets/samples/back.jpg');
        wade.loadImage('/snippets/samples/cc_logo.png');
    };
    this.init = function()
    {
        // create 2 objects and add them to the scene
        var background = new SceneObject(new Sprite('/snippets/samples/back.jpg'));
        wade.addSceneObject(background);
        var logo = new SceneObject(new Sprite('/snippets/samples/cc_logo.png'));
        wade.addSceneObject(logo);
        // tell wade to move the camera again when it's finished moving
        this.onCameraMoveComplete = this.moveCamera;
        // start moving the camera
        this.moveCamera();
    };
    this.moveCamera = function()
    {
        // choose a target
        var target = zoomIn? {x: (Math.random() - 0.5) * 200, y: (Math.random() - 0.5) * 150, z: Math.random() * 5} : {x:0, y: 0, z: 1};
        // move camera towards target, using a function to calculate its speed based on the distance to our target
        wade.moveCamera(target, function(distance)
        {
            return Math.max(distance, 5);
        });
    };
};
        
            Your code was executed successfully!
        
    
