#Upgrading an old Three.js code to the latest version

1 messages · Page 1 of 1 (latest)

graceful fox
#

@old plume I created a post there, to keep things organized :)

#

So i have another problem

#

geometry.attributes.position.array doesn't seem to have a .push() method

#

also, can I push a Vector3 to the array? Or does it need to be a plain array?

old plume
#

it is a typed array, thats why

#

you need to know how much data will be there, and create an array of the right size

graceful fox
#

oh okay

graceful fox
old plume
#

what is unexpected about it

graceful fox
# old plume what is unexpected about it

when I scroll for the first time, the stars do not need to look animated, they just seem to change their position by a huge amount that you can't even see them going inwards

old plume
graceful fox
#

btw i updated the code to set the arg of .setZ(top * -0.01) [it was -0.0001 before, which ins't my code]

graceful fox
#

shouldn't that not cause it?

old plume
#

1 log the actual top value
2 set xyz not just z

graceful fox
#

what is the "actual" top value? On the top of the page, the value seems to be 8

old plume
#

if you log it, you will know what the scroll starts from

graceful fox
old plume
#

well that's setZ(-0.08) not (0)

graceful fox
# old plume well that's setZ(-0.08) not (0)

Just to be sure, is the value of top always gonna be 8 on the top on all machines and viewport sizes? This is the line that gets the top value:

const top = document.body.getBoundingClientRect().top;
old plume
#

nobody knows that but you 🤷🏻

graceful fox
old plume
#

I think you had your 3 pings already 😄