Effects

Introduction

Effects of camera.

  • Author: Richard Davey

Usage

Fade-in / fade-out

camera.fadeIn(duration);   // duration in ms
// camera.fadeIn(duration, red, green, blue, callback, context);
// red/green/blue: the value to fade the red/green/blue channel from. A value between 0 and 255.
camera.fadeOut(duration);   // duration in ms
// camera.fadeOut(duration, red, green, blue, callback, context);
  • callback , context : It will be invoked every frame for the duration of the effect.
    function(camera, progress) {}
    

Events

camera.on('camerafadeincomplete', camera, fade);
camera.on('camerafadeoutcomplete', camera, fade);

Flash

camera.flash(duration);   // duration in ms
// camera.flash(duration, red, green, blue, force, callback, context);
  • callback , context : It will be invoked every frame for the duration of the effect.
    function(camera, progress) {}
    

Events

camera.on('cameraflashstart', camera, flash, duration, red, green, blue);
camera.on('cameraflashcomplete', camera, flash);

Shake

camera.shake(duration);   // duration in ms
// camera.shake(duration, intensity, force, callback, context);  // callback: invoked when completed
  • callback , context : It will be invoked every frame for the duration of the effect.
    function(camera, progress) {}
    

Events

camera.on('camerashakestart', camera, shake, duration, intensity);
camera.on('camerashakecomplete', camera, shake);

Pan

camera.pan(x, y, duration);   // duration in ms
// camera.pan(x, y, duration, ease, force, callback, context);
  • callback , context : It will be invoked every frame for the duration of the effect.
    function(camera, progress, x, y) {}
    

Events

camera.on('camerapanstart', camera, pan, duration, x, y);
camera.on('camerapancomplete', camera, pan);

Zoom

camera.zoomTo(zoomValue, duration);   // duration in ms
// camera.zoomTo(zoomValue, duration, ease, force, callback, context);
  • callback , context : It will be invoked every frame for the duration of the effect.
    function(camera, progress, zoomValue) {}
    

Events

camera.on('camerazoomstart', camera, zoom, duration, zoomValue);
camera.on('camerazoomcomplete', camera, zoom);

Rotate to

camera.rotateTo(radians, shortestPath, duration);   // duration in ms
// camera.rotateTo(radians, shortestPath, duration, ease, force, callback, context);
  • callback , context : It will be invoked every frame for the duration of the effect.
    function(camera, progress, angle) {}
    

Events

camera.on('camerarotatestart', camera, rotateTo, duration, angle);
camera.on('camerarotatecomplete', camera, rorotateTotate);

Mask

  • Add mask
    camera.setMask(mask);
    
  • Clear mask
    camera.clearMask();
    

More detail about mask