beginAnimation sometimes the animations are slow

Hello,

I use beginAnimation to animate my scene, so sometimes it works fine, sometimes it is so slow it needs to actualize the page.

is there a solution ?

Anes

1 Like

Hi again,

In your last playground I saw you made this :

it could be a lead worth pursuing :slight_smile:

1 Like

@sharp I change it to const speed = 2 or 1 but it doesn’t work it is too fast

I updated your playground : https://www.babylonjs-playground.com/#21HAJZ#3

  • There are 201 frames (MyCurve.getPoints().length line 34).
  • What you called speed is frameRate, the number of frames per second (line 27).

So if you want to make your animation completed in 1 second you should set frameRate to 201, (2 seconds : frameRate = 100, 1/2 second : frameRate = 402).

@sharp yes it works thank you,
always in the same playground, I don’t understand why camera1 position change when I click button two, I make camera2=camera1; and when I click button two I call UseCamera2 function to change camera2 position, why the camera1 also change its position ?

thank you a lot

Anes

You are welcome,

Javascript objects are passed by reference so when you write this

camera2 and camera1 are references to the same object

1 Like