Use this article to learn how to work with camera in Animate CC.

Camera in Animate CC allows animators to simulate a real-life camera.  Previously, animators relied on third-party extensions of varying quality and compatibility, or modified their animations to mimic a camera’s movement. Animators can use the following features that are integral to any motion film.

  • Panning with the subject of the frame
  • Zooming in the object of interest for dramatic effect
  • Zooming out of a frame to remind the viewer of a larger picture
  • Modifying the focal point to shift the attention of the viewer from one subject to another
  • Rotating the camera
  • Using color tint or filters to apply color effects on a scene 

When you set a camera view for your composition, you look at the layers as though you were looking through that camera. You can also add tweens or keyframes on a camera layer.

Camera tool is available for all the built-in doc-types in Animate CC - HTML Canvas, WebGL, and Actionscript.

Enabling or disabling the camera

Use any of the following options to enable the camera tool:

  • Click the camera icon from the tools panel.
  • Click the Add/Remove camera button from the timeline.

When a camera is enabled, a stage boundary is displayed in the same color as the camera layer.

Camera
Camera workspace

A. Stage outline B. Camera icon C. Camera properties D. Camera color effects E. Camera tool F. Camera icon G. Camera layer 

The stage now behaves as a camera for the document. A new camera layer with the camera object is added to the Timeline panel. When you select the camera tool, the camera icon is enabled in the Property inspector.

When the camera is enabled:

  • The current document is placed in the camera mode.
  • The stage is turned into a camera.
  • Camera border is visible in the stage boundary.
  • Camera layer is selected.  

Zooming, rotating, or panning the camera

Zooming the camera

  1. Use the onscreen zoom controls to zoom the object or set the zoom values in the Camera Properties panel.

    zoom_rotate
    Zoom and rotate

  2. To zoom into the scene, modify the zoom values or select the slider bar at the bottom of the stage.

  3. To zoom in the content, move the slider toward the + side and to zoom out the content move the slider toward - side.

  4. To enable infinite level of zoom values on either side, release the slider to snap it back to the middle position. 

Rotating the camera

  1. Use the onscreen zoom controls to rotate the object or set the Rotate values in the camera properties panel.

  2. To specify the rotation effect on each layer, modify the rotate values or use the rotation slider controls to manipulate the rotation.

  3. To enable infinite levels of rotation on either side, release the slider to snap it back into the resting position. The number in the middle of the control indicates the degrees of rotation currently applied.

Panning the camera

  1. Click the camera bounding box and drag anywhere within the camera layer on the stage.

  2. To pan the selected object, scroll up or down or use the shift key to pan horizontally or vertically without any tilt.

  3. When the camera tool is active, any drag action is a pan operation within the camera boundary.

Using camera panning controls

You can use camera coordinates X and Y in Camera properties of camera Property inspector to pan the camera with accuracy. 
Camera coordinate controls to pan
Camera coordinate controls to pan

To pan objects in horizontal direction, move the mouse over x coordinate value and drag the slider to right or left. 

To pan objects in vertical direction, move the mouse over y coordinate value and drag the slider to right or left.

Reset options for camera effects

You can reset the changes that you make with camera for pan, zoom, rotation, and color effects whenever you want to go back to original settings. To retain your previous property values, click the reset icon next to each of the properties

reset-options

Applying tint on a camera layer

  1. Select Camera > Properties panel. To enable or disable the tint effect, select the Tint check box. 

    camera_properties
    Camera properties

  2. Modify the tint value (percentage) and the RGB tint color for the current frame.

    Note:

    This feature is supported for AS3 and WebGL document types. 

Adjusting color filters on a camera layer

  1. In the camera properties panel, select the Adjust Color check box to enable or disable the filter effect.

  2. Modify the Brightness, Contrast, Saturation, and Hue values for the current frame. The acceptable range for Brightness, Contrast, Saturation is -100 % to 100 %, and Hue -180° to 180°.

    Note:

    This feature is supported only for AS3 document type. 

Creating parallax effect with camera and layer depth

As a game designer or developer, you want to create an immersive experience for a game. By using different objects of a game in the foreground and background layers, you can control the speed and position of these objects. By keeping the camera focused at a constant focal point, you can move the objects at different speeds to create a three-dimensional effect. In Animate CC, while creating your 2D animations you can achieve this effect by using camera and the layer depth feature. You can create parallax effect for objects by changing depths of layers using the Layer Depth panel. To use layer depth, click Window > Layer Depth.

Click here for more information on layer depth. 

  1. Create multiple objects on different layers in Animate.

  2. Add different layer depths to each layer.

  3. Add camera layer by clicking the camera tool.

    camera-layer
    Camera layer in layer depth

You can view the depth and perspective of objects with this effect.

  • The objects that are closer to the camera move faster than the objects that are far-away from the camera.
  • When camera layer is at 0 value, the objects closer to the camera possess lower positive number. And, the objects far-away from the camera possess high positive number. The layers that are behind the camera possess negative numbers. 

Video depicting parallax effect and camera z-depth

Video depicting parallax effect and camera z-depth
In this video, you can view the parallax effect followed by camera zoom.

Locking a layer with camera

As an animator or a game designer, you want to make some objects of the animation to stick to the view of the camera. For example, an action button, a heads up display in a game displaying the time meter, or a gun. In such cases, you have to keep the asset locked with the camera movement. The Attach To Camera feature in Animate enables you to achieve this effect.

Locking a layer with camera
Locking a layer with camera

When you attach a layer to the camera, objects in that layer are pinned to the camera and always move along with the camera. So, they appear to be unaffected by camera movements in the output.

You can attach a single layer to camera by clicking the dot in the attach camera icon's column. If the layer is attached to camera, a representative icon appears next to that layer name.  

The following illustrations depict the layer behavior before and after attaching it to the camera: 

Illustration depicting an animation when layer is not attached to camera:

Layer without camera lock
Layer without camera lock

Illustration depicting an animation when layer is attached to the camera: 

Layer with camera lock
Layer with camera lock

You can also attach or detach all the layers from the camera by clicking the attach camera icon in the timeline. 

Attach all layers to camera
Illustration showing all the layers when they are attached to camera

Using camera at runtime

You can introduce, access, or manage the camera at runtime using the camera APIs for AS3, WebGL, and HTML canvas document types. The list of camera runtime APIs for AS3, WebGL, and HTML canvas document types are as follows:

Type Class  Example Description
AS3 VirtualCamera

import fl.VirtualCamera;

var cameraObj = VirtualCamera.getCamera(root);

Get the camera object. To get or set camera properties at runtime.
HTML canvas VirtualCamera var cameraObj = AdobeAn.VirtualCamera.getCamera(exportRoot); Get the camera object. Ensure that you enable the camera while authoring the content.
WebGL VirtualCamera var cameraObj = flwebgl.VirtualCamera.getCamera(stage.getPlayer()); Get the camera object. Ensure that you enable the camera while authoring the content.

Note:

All the methods are applicable for AS3 document type. Some of the methods are not available for WebGL and HTML canvas types. The methods that are applicable/not applicable for WebGL and HTML canvas are indicated in the last two columns of the table.

Virtual camera methods

S.No

Method

Prototype

Example

Description

HTML canvas

WebGL

1

getPosition

getPosition():Object

trace(cameraObj.getPosition().x, cameraObj.getPosition().y,
cameraObj.getPosition().z);
Return object with x,y, and z properties that specify current location of camera.

Yes

Yes

2

setPosition

setPosition(posX:Number,posY:Number, posZ:Number=0):void

cameraObj.setPosition(100,100,100);

Move camera to absolute position given by input parameters. Default value = 0.

Yes

Yes

3

moveBy

moveBy(tx:Number,ty:Number,tz:Number=0): void

cameraObj.moveBy(100,100,100);

Move camera relative to current position by tx,ty,or tz.
Note: 'tz' is meaningful only if layer depth is enabled, default value = 0.

Yes

Yes

4

resetPosition

resetPosition():void

cameraObj.resetPosition();

Reset camera position to the original position i.e (0,0,0).

Yes

Yes

5

getZoom

getZoom():Number

trace(cameraObj.getZoom());

Return the current zoom value of camera. Default is 100%.

Yes

Yes

6

setZoom

setZoom(zoom:Number):void

cameraObj.setZoom(120);

Zoom camera to absolute value given by input parameter in percentage.

Yes

Yes

7

zoomBy

zoomBy(zoom:Number):void

cameraObj.zoomBy(100);

Zoom camera to relative to the current zoom value (unit is percentage).

Yes

Yes

8

resetZoom

resetZoom():void

cameraObj.resetZoom();

Reset camera zoom to it's default zoom value i.e 100%.

Yes

Yes

9

getRotation

getRotation():Number

trace(cameraObj.getRotation());

Return current angle of camera.  

Yes

Yes

10

setRotation

setRotation(angle:Number):void

cameraObj.setRotation(45);

Rotate camera by absolute angle given as input parameters.

Yes

Yes

11

rotateBy

rotateBy(angle:Number):void

cameraObj.rotateBy(60);

Rotate camera relative to current angle given by input parameters.

Yes

Yes

12

resetRotation

resetRotation():void

cameraObj.resetRotation();

Reset camera angle to zero.

Yes

Yes

13

setTint

setTint(tintColor:uint,tintPercent: Number):void

cameraObj.setTint(0x56FFFF, 68);

Set camera tint using tint color(RGB) & tint percent (percentage of tint).

No

Yes

14

setTintRGB

setTintRGB(red:uint,green:uint,blue: uint,tintPercent:Number):void

cameraObj.setTintRGB(0xff, 0, 0, 50);

Set camera tint using decomposed color values R, G, B & tintPercent (percentage of tint).

No

Yes

15

getTint()

getTint():Object

var tint=cameraObj.getTint();
trace("color:",tint.color,
"percentage:",tint.percent);

Return object with two properties: ‘percent’ & ‘color’.

No

Yes

16

getTintRGB

getTintRGB():Object

var tint = cameraObj.getTintRGB();
trace("tint color red:", tint.red,"green:",
tint.green," blue:",tint.blue,"tint percent: ",tint.percent);

Return object with four properties: ‘percent’ , ‘red’, ‘green’, and ‘blue’.

No

Yes

17

resetTint

resetTint()

cameraObj.resetTint();

Remove camera tint.

No

Yes

18

setColorFilter

setColorFilter(brightness:Number, contrast:Number,saturation:Number,hue: Number):void

cameraObj.setColorFilter(100,-50,
50,-100);

Set camera color filter using decomposed values of (Brightness,Contrast,saturation,hue).

No

No

19

resetColorFilter

resetColorFilter()

cameraObj.resetColorFilter();

Remove color filter.

No

No

20

reset

reset()

cameraObj.reset();

Reset all camera properties to default.

Yes

Yes

21

setZDepth

setZDepth(zDepth:Number):void

cameraObj.setZDepth(200);

Set camera's Z Depth value.

Yes

No

22

getZDepth

getZDepth():Number

trace(cameraObj.getZDepth());

Return current Z Depth value of camera.

Yes

No

23

pinCameraToObject

pinCameraToObject(object:DisplayObject, offsetX:Number=0,offsetY:Number=0, offsetZ=0)

cameraObj.pinCameraToObject
(getChildByName("InstanceName"), 200,50);

Camera keeps following the object provided as input parameter at runtime. If offsetX, offsetY & offsetZ are provided, camera follows (x+offsetX,y+offsetY, z+offsetZ).

Yes

Yes

24

setPinOffset

setPinOffset(offsetX:Number, offsetY:Number,offsetZ:Number)

cameraObj.setPinOffset(-60,0);

Change offsetX & offsetY for camera's pinning with object. Camera follows object regarding (x+offsetX, y+offsetY, zDepth+z) point at runtime.

Yes

Yes

25

unpinCamera

unpinCamera()

cameraObj.unpinCamera();

Remove camera's pinning with any object.

Yes

Yes

26

setCameraMask

setCameraMask(maskObj:DisplayObject)

cameraObj.setCameraMask(maskObj);

Set maskObj as a mask over camera.

No

No

27

removeCameraMask

removeCameraMask()

cameraObj.removeCameraMask();

Remove mask from camera.

No

No

Access camera as a movie clip object

Type Method Prototype Example
AS3 getCameraAsMovieClip

getCameraAsMovieClip(container:DisplayObject):MovieClip

var cameraObj=fl.VirtualCamera.getCameraAsMovieClip(root);
HTML canvas getCameraAsMovieClip
getCameraAsMovieClip(container:DisplayObject):MovieClip var cameraObj=AdobeAn.VirtualCamera.getCamera(exportRoot);
WebGL getCameraAsMovieClip
getCameraAsMovieClip(container:DisplayObject):MovieClip var cameraObj=flwebgl.VirtualCamera.getCameraAsMovieClip(this);

Cropping the object on stage

To crop the content flowing outside the stage, click Clip the Content Outside Stage button. With the camera and stage view, you can view the content within the camera bounds.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy