HTML5 canvas camera - control with code

Explorer ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

I'm using the adobe help guide for the camera methods etc... 

https://helpx.adobe.com/animate/user-guide.html/animate/using/working-with-camera-in-animate.ug.html

I'm trying to control the camera via code.

I now want to zoom in on certain words on the stage ie: to give emphasis and make things more dynamic.

I enclose the end snippet of code I am using. It doesn't zoom in.

 

function addPopup() {
	
	//this.s1_b4.visible=false; -- WARNING - don't put stuff before declaring variables.
	
	var Tania = new lib.popup_Tania();
    Tania.x = 350;
    Tania.y = 450;
	exportRoot.addChild(Tania);
	
	cameraZoom();
}

function cameraZoom() {
	
		var cameraObj = AdobeAn.VirtualCamera.getCamera(exportRoot);
	
		this.cameraObj.setPosition(100,100,100);
	    this.cameraObj.setZoom(200);
		//this.cameraObj.zoomBy(100);
}

 

Views

37

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

 

I have also found this code ie: I want to zoom in on the w2 object. Then zoom out after 5 seconds.

 

var cameraObj = AdobeAn.VirtualCamera.getCamera(exportRoot).pinCameraToObject(_this.w2, 0, 0);

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

OK - I'm getting really close.

 

var zoomPercent = 200;
var cameraObj = AdobeAn.VirtualCamera.getCamera(exportRoot).zoomBy(zoomPercent);

 

This zooms in, however with no control, I want to zoom in on a specific text object called w2 and I'm not sure how to do that. It's also doesn't zoom in with a tween, but straight in.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines