Sie sind nicht angemeldet.

1

Montag, 16. September 2019, 22:08

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

2

Montag, 16. September 2019, 22:57

Hi,

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

Tuur *thumbsup*

3

Dienstag, 17. September 2019, 10:57

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


Sure!

Quellcode

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

4

Dienstag, 17. September 2019, 11:17

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*

5

Dienstag, 17. September 2019, 12:30

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

6

Dienstag, 17. September 2019, 21:11

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.

Beiträge: 1 117

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : the cms4vr owner

  • Nachricht senden

7

Mittwoch, 18. September 2019, 09:21

Maybe use changeorigin


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


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

Quellcode

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


Piotr

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

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

8

Mittwoch, 18. September 2019, 09:30

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

9

Mittwoch, 18. September 2019, 14:07

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/