# Is it possible to cap useFrame at 60fps?r

i wonder if there is any way to be able to cap amount of times code is executed in `useFrame.`

for example if device renders scene in 120fps, it means that `useFrame` will execute 120 times in a second, i have custom particle snow and i use `useFrame` this way:

``````useFrame(() => {
for (let i = 0; i < count*3; i+=3) {
//x
particle.current.attributes.position.array[i] -= velocity[i];
//y
particle.current.attributes.position.array[i+1] -= velocity[i+1];
//z
particle.current.attributes.position.array[i+2] -= velocity[i+2];

// y<0
if (particle.current.attributes.position.array[i+1] <= -3.3) {
//x
particle.current.attributes.position.array[i] = Math.random()*20-10;
//y
particle.current.attributes.position.array[i+1] = Math.random()*13.2 -3.2;;
//z
particle.current.attributes.position.array[i+2] = Math.random()*20-10;
}

}
particle.current.attributes.position.needsUpdate = true;

})
``````

obviously executing it at different fps gives different performance , so for 40 fps snow is quite slow and smooth , but for 120fps its too fast(just chaotic movement), i would like to cap useFrame() the way, that

doesn’t matter what the fps of scene is, it is executed only 40 times per second.

instead of capping you should be using delta which makes things framerate independent:

``````useFrame((state, delta) => {
ref.current.position.x += 0.1 // ❌
ref.current.position.x += delta // ✅
``````

in your case, if `velocity[i]` is a factor, just multiply it with delta.

upcoming fiber v9 which is out as alpha right now can cap framerates easily, it introduces frameloop stages similar to unity. but again, that is not the solution to your problem. capping is usually used for multi user server backend physics and things like that, and even then, usually the physics engine takes care of it.

btw, for purely react related stuff threejs discourse is probably not the right place. github discussions or pmndrs discord is very active.

Thanks for helping , i will join the discord then ))