feat: 날씨각 캐릭터 보송·말랑(nalssigak-shorts Three.js)을 3D 릴스·소개 카드에, 카드에서 폰 프레임·스크린샷 제거(3D 스틸 무대·순위·기능 타일)
This commit is contained in:
1 parent
615dd27404
commit
f2eed74e9d
16 files changed
+265
-57
No files matched your search
@@ -28,6 +28,8 @@
|
||||
<script type="module">
|
||||
import * as THREE from 'three';
|
||||
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
||||
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
|
||||
import { makeBosong, makeMalang, JELLY, animate as animateChars } from './assets/characters.js';
|
||||
|
||||
// 결정적 난수: 프레임을 어느 순서로 그려도 같은 별·구름 자리
|
||||
function mulberry32(a) { return () => { a |= 0; a = (a + 0x6d2b79f5) | 0; let t = Math.imul(a ^ (a >>> 15), 1 | a); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; }; }
|
||||
@@ -74,7 +76,7 @@
|
||||
scene.add(new THREE.Points(starGeo, starMat));
|
||||
|
||||
// 상태: 타임라인이 이 값을 움직이고, 프레임마다 읽어서 그린다
|
||||
const S = { elev: 9, azim: 168, turb: 3, ray: 2.4, mie: 0.004, g: 0.8, exp: 0.38, camX: 0, camY: 1.4, camZ: 12, lookY: 4.5, lookX: 0, cloud: 1, stars: 0, island: 0, pass: 0, rise: 0, spin: 0, mood: 0, glow: 0.6, iconWalk: 0, iconCamp: 0, iconSunset: 0, rain: 0 };
|
||||
const S = { elev: 9, azim: 168, turb: 3, ray: 2.4, mie: 0.004, g: 0.8, exp: 0.38, camX: 0, camY: 1.4, camZ: 12, lookY: 4.5, lookX: 0, cloud: 1, stars: 0, island: 0, pass: 0, rise: 0, spin: 0, mood: 0, glow: 0.6, nightIcons: 0, chars: 1, charsEnd: 0, iconWalk: 0, iconCamp: 0, iconSunset: 0, rain: 0 };
|
||||
|
||||
const tex = new THREE.TextureLoader();
|
||||
const sprite = (name, s) => {
|
||||
@@ -88,7 +90,14 @@
|
||||
// 하늘에 뜬 날씨각 3D 아이콘 (첫 장면), 비 (흐림 장면), 섬 옆 활동 아이콘 (증명 장면)
|
||||
const skyIcons = [['sun', 3.0, 2.6, -9, 2.2], ['umbrella', -3.0, 1.2, -11, 1.8], ['bike', 2.6, -0.4, -5, 1.4], ['laundry', -1.4, -1.2, -15, 1.7]].map(([n, x, y, z, s], i) => { const o = sprite(n, s); o.position.set(x, y, z); o.userData = { x, y, z, phase: i * 1.3, amp: 0.18 + (i % 3) * 0.07 }; return o; });
|
||||
const rainIcon = sprite('rain', 3.2); rainIcon.position.set(-2.4, 6.5, -12);
|
||||
// 날씨각 캐릭터 보송(초록 털뭉치)·말랑(파란 젤리): 카메라 앞 한 벌, 섬 위 한 벌
|
||||
const envTex = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;
|
||||
const bosongA = makeBosong(), malangA = makeMalang(envTex);
|
||||
const bosongB = makeBosong(22), malangB = makeMalang(envTex);
|
||||
scene.add(bosongA.group, malangA.group);
|
||||
const walkIcon = sprite('walk', 2.2), campIcon = sprite('camping', 2.2), sunsetIcon = sprite('sunset', 2.6);
|
||||
// 밤하늘의 각 무리 (폰 화면 대신): 68가지 중 아홉
|
||||
const NIGHT = [['hangang', -4.2, 2.0, 2.2], ['drive', 3.8, 3.2, 2.0], ['walk', -1.2, 5.2, 1.8], ['camping', 4.6, 7.4, 1.9], ['stars', -4.8, 8.6, 2.0], ['running', 1.4, 0.6, 1.6], ['laundry', -3.4, -1.6, 1.5], ['bike', 5.2, -0.4, 1.6], ['picnic', 0.6, 9.8, 1.7]].map(([n, x, y, sc], i) => { const o = sprite(n, sc * 1.45); o.userData = { x, y, phase: i * 0.9, sc: sc * 1.45 }; return o; });
|
||||
|
||||
// 구름: 날씨각 Fluent 3D 구름
|
||||
const cloudTex = tex.load('assets/icons/cloud.png');
|
||||
@@ -127,6 +136,9 @@
|
||||
put('rock_largeA', 0.95, 1.05, 0.55, 1.1); put('rock_smallC', -0.75, 1.15, 0.8);
|
||||
put('grass_large', 0.55, -0.05, 0.8); put('plant_bushLarge', -0.4, -0.05, 0.7, 1.5);
|
||||
put('flower_redA', -1.15, 1.1); put('flower_yellowB', 0.55, 1.15, 1, 1); put('mushroom_redGroup', -0.05, -0.55, 0.8);
|
||||
// 섬 위에 서 있는 보송·말랑 (섬과 함께 돈다)
|
||||
bosongB.group.position.set(-0.85, 1.42, 1.25); bosongB.group.scale.setScalar(0.36); island.add(bosongB.group);
|
||||
malangB.group.position.set(0.9, 1.5, 1.35); malangB.group.scale.setScalar(0.34); island.add(malangB.group);
|
||||
island.position.set(0, -2.6, -118); island.scale.setScalar(2.0); island.rotation.x = 0.05;
|
||||
scene.add(island);
|
||||
})();
|
||||
@@ -141,6 +153,7 @@
|
||||
at(0, 2.4, { mood: 1, glow: 0.9 });
|
||||
at(3, 0.8, { mood: 2, glow: 0.1 });
|
||||
at(5.9, 0.9, { mood: 1, glow: 0.8 });
|
||||
at(5.6, 0.5, { chars: 0 }, 'power2.in');
|
||||
at(8.5, 5.5, { mood: 3, glow: 1.2 });
|
||||
at(14.3, 1.2, { mood: 4, glow: 0 });
|
||||
at(0, 3, { camZ: -20, camY: 2.2, lookY: 9, elev: 40, azim: 196, turb: 2.0, ray: 2.6, mie: 0.003, exp: 0.36 });
|
||||
@@ -161,6 +174,9 @@
|
||||
// 14.5~21 밤: 해가 지고 별이 켜지고 카메라가 위를 본다
|
||||
at(14.3, 1.2, { elev: -9, exp: 0.26, stars: 1, camY: 5, lookY: 13, camX: 0, lookX: 0, iconWalk: 0, iconCamp: 0, iconSunset: 0 });
|
||||
at(15.5, 5.5, { camY: 7, lookY: 16 }, 'none');
|
||||
at(15.0, 0.9, { nightIcons: 1 }, 'back.out(1.4)');
|
||||
at(17.7, 0.7, { charsEnd: 1 }, 'back.out(1.3)');
|
||||
at(17.3, 0.3, { nightIcons: 0 }, 'power2.in');
|
||||
tl.to({}, { duration: 0.1 }, 20.9);
|
||||
|
||||
const warm = new THREE.Color(0xffa060), noon = new THREE.Color(0xffffff), dusk = new THREE.Color(0xff6a6a);
|
||||
@@ -193,6 +209,17 @@
|
||||
walkIcon.position.set(ip.x - 4.2, ip.y + 5.2 + Math.sin(t * 1.2) * 0.12, ip.z + 2.2); walkIcon.material.opacity = S.iconWalk; walkIcon.scale.setScalar(2.2 * (0.4 + 0.6 * S.iconWalk));
|
||||
campIcon.position.set(ip.x + 4.0, ip.y + 4.8 + Math.sin(t * 1.1 + 1) * 0.12, ip.z + 2.6); campIcon.material.opacity = S.iconCamp; campIcon.scale.setScalar(2.2 * (0.4 + 0.6 * S.iconCamp));
|
||||
sunsetIcon.position.set(ip.x + 0.4, ip.y + 7.6 + Math.sin(t * 0.9 + 2) * 0.12, ip.z + 1.5); sunsetIcon.material.opacity = S.iconSunset; sunsetIcon.scale.setScalar(2.6 * (0.4 + 0.6 * S.iconSunset));
|
||||
NIGHT.forEach((o, i) => { const k = C.clamp(S.nightIcons - i * 0.06, 0, 1); o.material.opacity = k; o.scale.setScalar(o.userData.sc * (0.3 + 0.7 * k)); o.position.set(S.camX + o.userData.x, S.lookY + o.userData.y - 2 + Math.sin(t * 1.1 + o.userData.phase) * 0.15, S.camZ - 30); });
|
||||
// 카메라 앞 보송·말랑: 첫 장면엔 아래 양쪽, 섬 장면엔 화면 밖(아래), 밤엔 다시 올라온다
|
||||
{ const up = Math.max(S.chars, S.nightIcons, S.charsEnd), drop = (1 - up) * 7;
|
||||
bosongA.group.position.set(S.camX - 1.55, S.camY - 1.25 - drop + Math.sin(t * 1.3) * 0.08, S.camZ - 7.5); bosongA.group.scale.setScalar(0.66);
|
||||
malangA.group.position.set(S.camX + 1.6, S.camY - 1.2 - drop + Math.sin(t * 1.3 + 1.7) * 0.08, S.camZ - 7.5); malangA.group.scale.setScalar(0.64);
|
||||
bosongA.group.lookAt(camera.position); malangA.group.lookAt(camera.position);
|
||||
animateChars(bosongA, malangA, t, 0); animateChars(bosongB, malangB, t, 2.1);
|
||||
const warm = C.clamp(S.mood - 2, 0, 1) * (1 - C.clamp(S.mood - 3, 0, 1)), nightK = C.clamp(S.mood - 3, 0, 1);
|
||||
for (const b of [bosongA, bosongB]) { b.uniforms.uTint.value = warm; b.uniforms.uNight.value = nightK; }
|
||||
for (const m of [malangA, malangB]) { m.front.color.copy(JELLY.blue).lerp(JELLY.warm, warm * 0.75).lerp(JELLY.night, nightK * 0.5); m.back.color.copy(m.front.color); }
|
||||
}
|
||||
starMat.opacity = S.stars;
|
||||
island.visible = S.island > 0.01;
|
||||
island.rotation.y = -0.6 + S.spin * 0.9;
|
||||
|
||||
Reference in new issue
Block a user