Created
March 31, 2022 20:58
-
-
Save RH2/5e1f8ab3f5f97a02bfba755b76b121aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useFrame((state,delta)=>{ | |
let pi = Math.PI | |
const keyframes1_position = [[new THREE.Vector3(0,0,0),0],[new THREE.Vector3(0,0,0),0.5],[new THREE.Vector3(0,0,0),1.0]] | |
const keyframes1_rotation = [[new THREE.Vector3(),0],[new THREE.Vector3(),0.5],[new THREE.Vector3(),1.0]] | |
const keyframes2_position = [[new THREE.Vector3(0,0,0),0],[new THREE.Vector3(0,0,0),0.5],[new THREE.Vector3(0,0,0),1.0]] | |
const keyframes2_rotation = [[new THREE.Vector3(),0],[new THREE.Vector3(),0.5],[new THREE.Vector3(),1.0]] | |
const offset = (1 - scroll.offset) | |
const offset2 = scroll.offset -2 | |
const offset3 = Math.PI/2 - scroll.offset * 2 | |
let location = new THREE.Vector3(0,0,0) | |
let location2 = new THREE.Vector3(0,0,0) | |
let flocation = location.lerp(location2,offset) | |
let rotationA = new THREE.Vector3(-Math.PI/2,0,0) | |
let rotationB = new THREE.Vector3(Math.PI/2,0,0) | |
let rotationC = rotationA.lerp(rotationB,offset) | |
//rotfinal = [rotationC.x,rotationC.y,rotationC.z] | |
filegeometry.rotation.x = rotationC.x | |
filegeometry.rotation.y = rotationC.y | |
filegeometry.rotation.z = rotationC.z | |
console.log(filegeometry.parent.name) | |
//filegeometry.position.set(0,-8,offset2*4) | |
/* | |
group1.position.x = finallocation.x | |
group1.position.y = finallocation.y | |
group1.position.z = finallocation.z | |
*/ | |
group1.rotation.x = rotationC.x | |
group1.rotation.y = rotationC.y | |
group1.rotation.z = rotationC.z | |
group1.position.x = .1 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment