Skip to main content
Participating Frequently
March 1, 2018
Question

Animate CC 3D Camera focalLength?

  • March 1, 2018
  • 1 reply
  • 452 views

Hello,
Wondering if there are any folks out there that know how the 3D camera internals work in Animate CC. I'll try and explain what I'm trying to do and if anyone knows a way to get the info. This is probably a question for the developers who work at Adobe.

So, I'm getting into using the 3D camera and Advanced Layer Depth's but falling into an issue / limitation. If you were to create a new Canvas file, add in a camera, some objects, move the camera around, etc .... and then export -->

In the HTML file's JavaScript code you'll find this variable in a couple of places >

var focalLength = 528.25;

This appears in the handleTick() and getProjectionMatrix() functions in the generated HTML file that Animate CC exports. The code is specifically for handing the camera.

I'm assuming the number is generated internally somewhere based on the use of the Layer Depths and Camera and IS NOT the same on every new export if you change something.

This works all fine and dandy with the generated files that Animate CC creates.

HOWEVER, if you're using your own template file for the HTML file's generation, there isn't a way to generate this number dynamically using a token (ie. $WT, $TITLE, etc..the token variables you can use for templates). Right now, the only workaround if you want to use your own template FLA is to copy all the keyframes, put it all in a new Canvas doc, export, etc, just to get that number. Obviously, not efficient, especially if you need to change something.

Does anyone know if there is a $ token variable that we can use to generate that focalLength number in our own templates? I didn't see it in Adobe's documentation. Or if there's a way to get that value from within Animate CC so we can change the value/variable from within Animate CC's Actions Panel? I was thinking of making focalLength a global variable and just getting its value within Animate CC and referencing it that way (since I don't know of a token I could use for my template).

Please let me know if anyone has any insight.
Thanks so much.
Davi-T

This topic has been closed for replies.

1 reply

Legend
March 1, 2018

There is nothing called the "3D Camera" in Animate. You only get the focalLength variable when Advanced Layers is activated, regardless of whether you're even using a Camera layer.

As for your issue, all the code that contains that variable seems to be generated by the $START_ANIMATION token, so I'm not seeing what the problem is.

davi-tAuthor
Participating Frequently
March 1, 2018

Well, the '3D camera'....when you turn on Advanced Layers and get parallax, as opposed to not turning on Advanced Layers and getting no parallax. I know it's not technically called that.

I'm talking about being able to get the focalLength variable's value if you're NOT using the default HTML file that Animate CC automatically generates. I'm using my own FLA template via 'Save as template' and under Publish Settings > Advanced > Template for Publishing HTML. I'm not using any of the code for $START_ANIMATION token. The default template for Animate CC just isn't robust enough for me, so I've made my own template and want to incorporate the existing camera code from the default template into my own template -- but no way to get that value that gets generated from the default template. Does that make sense? Perhaps if there was a way like getFocalLength or something....

Legend
March 1, 2018

You're not making sense. If you want to use the existing camera code... then just put the $START_ANIMATION token in your template. That's what it's for.