You are not logged in.

  • "360gradenfotografie" started this thread

Posts: 51

Location: Tilburg, The Netherlands

  • Send private message

1

Monday, September 16th 2019, 10:08pm

Tweening layer scale is shaky

Hi,

When I'm tweening a layer's scale (or with/height) and the layer is not aligned to one of the corners (align != lefftop, righttop, leftbottom, rightbottom), the animation is shaky. Like krpano has difficulty calculating the size and position of the layer for every frame.

Any idea how this can be fixed?

Niek

Tuur

Sage

Posts: 3,164

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

2

Monday, September 16th 2019, 10:57pm

Hi,

can you show some bare bone code or example?
I just tried a bit but seems quite smooth to me.

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

  • "360gradenfotografie" started this thread

Posts: 51

Location: Tilburg, The Netherlands

  • Send private message

3

Tuesday, September 17th 2019, 10:57am

can you show some bare bone code or example?
I just tried a bit but seems quite smooth to me.


Sure!

Source code

1
2
3
4
5
6
7
8
9
<layer name="test" align="center" height="100%" width="prop" url="bg.png" onclick="resize()" />

<action name="resize" scope="local">
 if(caller.height == 100%,
  tween(caller.height,90%,2,linear);
 ,
  tween(caller.height,100%,2,linear);
 );
</action>


This is how the tweening works out:

https://virtuele-tours.nl/tour/tween/

On my computer it's shaky/choppy. I'm using Chrome on a 15" MacBook Pro from 2018.

Tuur

Sage

Posts: 3,164

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

4

Tuesday, September 17th 2019, 11:17am

Hi,

i can confirm indeed.
You use 1.19pr16 but in 1.20 it seems also doing this.
When i swap width and height, so height prop and tweening width it seems to go smooth.
Also when i make the browser bigger or fullscreen it seems to go smoother.

strange..

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

5

Tuesday, September 17th 2019, 12:30pm

i think it has to do with a rounding issue when the layer is centered ....
depending on the size there is a 1px shift where the layer is positioned ...

you could try to have it right/left aligned for a test.
i think it doesnt happen there

  • "360gradenfotografie" started this thread

Posts: 51

Location: Tilburg, The Netherlands

  • Send private message

6

Tuesday, September 17th 2019, 9:11pm

i think it has to do with a rounding issue when the layer is centered ....
depending on the size there is a 1px shift where the layer is positioned ...

you could try to have it right/left aligned for a test.
i think it doesnt happen there
Maybe... But how to fix it? *smile*

Check https://virtuele-tours.nl/tour/tween/. It now cycles between align = center, left, topleft, top.

spacerywirtualne

Professional

Posts: 901

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

7

Wednesday, September 18th 2019, 9:21am

Maybe use changeorigin


https://krpano.com/docu/xml/#layer.changeorigin


bdw, Declare the value for cycle earlier in the layer code.

Source code

1
<layer name="test" ... cycle="0" .../>


Piotr

p.s. I tested your example on Krpano 1.20 -no shakes at all.
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube

cms4vr team *thumbsup*

8

Wednesday, September 18th 2019, 9:30am

Hi,

by default krpano is fitting the positions and sizes of layers to the pixel-grid to ensure a sharp/unblurred rendering.

E.g. when something would be at a position like 10.5, then it could get drawn blurred by the browser because it's not exact on a pixel position. And that can happen pretty often, e.g. when the screensize is odd and centering something.

But for moving/scaling layers this can be distracting of course.

To disable that pixel-grid-fitting add accuracy="1" to the layer:
https://krpano.com/docu/xml/#layer.accuracy

Best regards,
Klaus

  • "360gradenfotografie" started this thread

Posts: 51

Location: Tilburg, The Netherlands

  • Send private message

9

Wednesday, September 18th 2019, 2:07pm

Maybe use changeorigin
That would reduce the shakyness, but it also changes the direction of the animation.

bdw, Declare the value for cycle earlier in the layer code.
I did so on line 5 ;-)

To disable that pixel-grid-fitting add accuracy="1" to the layer:
https://krpano.com/docu/xml/#layer.accuracy
That seems to solve it! Thanks *thumbsup*

https://virtuele-tours.nl/tour/tween/