Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var random_judge = false
- var dfractal_judge = false
- $(window).scroll(function() {
- var scTop = $(window).scrollTop()
- if (scTop <= start_point || scTop >= end_point) {
- if (!random_judge) {
- random_judge = true
- dfractal_judge = false
- transform_random()
- }
- } else if (scTop > start_point && scTop <= end_point) {
- if (!dfractal_judge) {
- random_judge = false
- dfractal_judge = true
- transform_dfractal()
- }
- }
- })
- function transform_random() {
- // wrapper.position.y = 0
- const SIZE = 500
- for (var i = 0; i < par_n; i++) {
- for (var j = 0; j < d_fractalArray[0].length; j++) {
- if (rndArray[i][j]) {
- pTween[j] = new TWEEN.Tween(geometry[i].vertices[j])
- .to({ x: rndArray[i][j].x, y: rndArray[i][j].y, z: rndArray[i][j].z }, 1000)
- .easing(TWEEN.Easing.Quintic.In)
- .start()
- }
- }
- }
- }
- function transform_dfractal() {
- wrapper.position.x = 120
- var hogen = 0
- for (var i = 0; i < par_n; i++) {
- for (var j = 0; j < d_fractalArray[0].length; j++) {
- if (d_fractalArray[i][j]) {
- pTween[j] = new TWEEN.Tween(geometry[i].vertices[j])
- .to({ x: d_fractalArray[i][j].x * 1.1 + 100, y: d_fractalArray[i][j].y * 1.1, z: d_fractalArray[i][j].z * 1.1 }, 2500)
- .easing(TWEEN.Easing.Quartic.Out)
- .start()
- } else {
- num = j - 794
- pTween[j] = new TWEEN.Tween(geometry[i].vertices[j])
- .to({ x: d_fractalArray[i][num].x * 1.1 + 100, y: d_fractalArray[i][num].y * 1.1, z: d_fractalArray[i][num].z * 1.1 }, 2500)
- .easing(TWEEN.Easing.Quartic.Out)
- .start()
- }
- };
- }
- }
Add Comment
Please, Sign In to add comment