0
Answered

Dynamic resizing

JNJ 4 years ago updated by Gil Sideman 3 years ago 17

I have embedded a scene into a web page using the AC_VHost_Embed function. To make the page responsive, I need to be able to dynamically change the size of the scene . I have tried replacing the hardcoded height and width data with variables but, that produces an error and the scene never loads.

How can I dynamically change the size of a scene?

Answer

Answer

Hi -

We've added a new function to the client api - "resize" - the Client API Reference has been updated (on the support page) to include this function. This function allows you to dynamically resize the Scene when the page dimensions change, to support responsive design. Resizing is done dynamically and does not reload the character. We recommend that original aspect ratio be maintained when the Scene is resized. This is not required, but if you want to maintain the same relative position of the character within the Scene frame, you should retain the same aspect ratio. Otherwise, character will be re-positioned as best possible.

This had taken a bit longer than anticipated, thanks for your patience.

Let me know if any comments.

Best,

Gil

Under review

Let me refer that to our engineering and get back to you.

If you don't hear back in 2-3 days feel free to remind me.

Have you heard back about this?

Thanks.

Answer

Hi -

We've added a new function to the client api - "resize" - the Client API Reference has been updated (on the support page) to include this function. This function allows you to dynamically resize the Scene when the page dimensions change, to support responsive design. Resizing is done dynamically and does not reload the character. We recommend that original aspect ratio be maintained when the Scene is resized. This is not required, but if you want to maintain the same relative position of the character within the Scene frame, you should retain the same aspect ratio. Otherwise, character will be re-positioned as best possible.

This had taken a bit longer than anticipated, thanks for your patience.

Let me know if any comments.

Best,

Gil

Awesome. I'll test this today.

An update, I CAN resize the avatar with variables. The issue occurred when I tried to separate the embed code onto different lines.

I still have the problem where the avatar does not resize even when it is in a responsive div. Any thoughts?

We have been working on a solution for both problems you pointed out.

1. Separating the embed code into two lines

2. Resizing the avatar dynamically to accommodate responsive page design.


We have identified both issues and have implemented a solution for both. The update is now being tested and should be deployed to our live servers later this week.


For issue #2 we have implemented a new API function 'resize' which will allow the character to be dynamically resized without being reloaded.

Stay tuned.

Gil

Is there a timeline for these updates?

Awesome! I look forward to the roll out.

Hello,

Have these changes been rolled out? If not, when should ew expect this? Will the API documentation be updated? If so, when?

Hi JNJ - please confirm this now works for you.

any comments?

Gil


I had to come up with a quick workaround . I will test tonight and let you know.

When I resize the window, the avatar does change size. However, there seems to be a minimum size. I will continue to play around with it.

ok - let me know your thoughts.

Hi Gil. Can you give me an example of how the resize function should be used. I am testing it and I get the error saying resize si not defined.

So - it turns out that our intended name for the function 'resize' conflicts with existing function names in use.


We renamed the function 'dynamicResize'.

This is not yet updated in the posted documentation.

pls try it.