Skip to content

Commit 2a08c80

Browse files
committed
fix(landing): get messages for text geometry
1 parent 05874eb commit 2a08c80

File tree

3 files changed

+24
-35
lines changed

3 files changed

+24
-35
lines changed

packages/better-write-app/src/use/defines.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@ import i18n from '@/lang'
44
export const useDefines = () => {
55
const { t } = i18n.global
66

7-
const landing = () => {
8-
const name = () => {
9-
// vue-i18n limitation zzzzzzzzzzzzzzz
10-
const arr = [
11-
t('landing.first.paragraphs[0]'),
12-
t('landing.first.paragraphs[1]'),
13-
t('landing.first.paragraphs[3]'),
14-
t('landing.first.paragraphs[4]'),
15-
t('landing.first.paragraphs[5]'),
16-
t('landing.first.paragraphs[6]'),
17-
t('landing.first.paragraphs[7]'),
18-
t('landing.first.paragraphs[8]'),
19-
t('landing.first.paragraphs[9]'),
20-
t('landing.first.paragraphs[10]'),
21-
t('landing.first.paragraphs[11]'),
22-
t('landing.first.paragraphs[12]'),
23-
t('landing.first.paragraphs[13]'),
24-
]
25-
26-
return arr[Math.floor(Math.random() * arr.length)]
27-
}
28-
29-
return { name }
30-
}
31-
327
const pdf = () => {
338
const fixFonts = () => {
349
return ['EB Garamond', 'Cormorant Garamond']
@@ -240,6 +215,5 @@ export const useDefines = () => {
240215
return {
241216
pdf,
242217
themes,
243-
landing,
244218
}
245219
}

packages/better-write-app/src/use/webgl.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js'
44
import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry.js'
55
import WebGL from 'three/examples/jsm/capabilities/WebGL.js'
66
import { onBeforeUnmount, onMounted, ref } from 'vue'
7-
import { useDefines } from './defines'
7+
import { useI18n } from 'vue-i18n'
88

99
export const useWebGL = () => {
1010
const isLoaded = ref(false)
@@ -19,6 +19,8 @@ export const useWebGL = () => {
1919
const _cloudParticles: any = []
2020
const meshArray: any = []
2121

22+
const { t, getLocaleMessage, locale } = useI18n()
23+
2224
const init = () => {
2325
onMounted(() => {
2426
if (!WebGL.isWebGLAvailable()) {
@@ -106,24 +108,28 @@ export const useWebGL = () => {
106108
}
107109

108110
const createNodes = () => {
109-
for (let i = -1000; i < 1000; i += 50) {
110-
const paragraph = new TextGeometry(useDefines().landing().name(), {
111+
const { landing }: any = getLocaleMessage(locale.value)
112+
113+
const paragraphs = landing.first.paragraphs
114+
115+
paragraphs.forEach((paragraph) => {
116+
const geometry = new TextGeometry(paragraph, {
111117
font: _font,
112118
size: Math.floor(Math.random() * 8) + 8,
113119
height: 1,
114120
})
115121

116-
const mesh = new THREE.Mesh(paragraph)
117-
mesh.position.x = Math.random() * 2000 - 1000 + i
118-
mesh.position.y = 650 - Math.random() * 170
119-
mesh.position.z = Math.random() * 2000 - 1000 + i
122+
const mesh = new THREE.Mesh(geometry)
123+
mesh.position.x = Math.random() * 2500 - 1000
124+
mesh.position.y = 650 - Math.random() * 10
125+
mesh.position.z = Math.random() * 2500 - 1000
120126
mesh.rotation.x = 1.16
121127
mesh.rotation.y = -0.12
122128
mesh.rotation.z = 0.57
123129

124130
meshArray.push(mesh)
125131
scene.add(mesh)
126-
}
132+
})
127133
}
128134

129135
const render = () => {
@@ -165,10 +171,10 @@ export const useWebGL = () => {
165171
cameraCreate()
166172
rendererCreate()
167173
loaderSmoke()
174+
createNodes()
168175
contextResize()
169176
createLight()
170177
contextResize()
171-
createNodes()
172178
render().then(() => {
173179
isLoaded.value = true
174180
})

packages/better-write-localisation/src/pt-BR/landing.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ Recebendo o amor doloroso,
4141
Aceitei a dormência.`,
4242
` Clima tenso. Correndo contra tudo, a virtude não teve dúvidas
4343
de quem realmente está do lado certo.`,
44+
` — Aparentemente, está vazio. Cadê... tudo?`,
45+
` A chave foi inserida.
46+
Nada acontece.
47+
Pullio percebe que a chave está do lado
48+
inverso. Acontece
49+
A porta abre.`,
50+
` — Enganação... quem esgana quem?`,
51+
` — Positividade sempre.`,
52+
` — Questionar nunca será problemático.`,
4453
],
4554
},
4655
}

0 commit comments

Comments
 (0)