/
githubmirror
/
pixijs
Обзор
Документация
Войти
/
githubmirror
/
pixijs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
tests/visual/scenes/text/text-pattern-gradient.scene.ts
46 строк
1 KB
Zyie
fix: texture space incorrectly set to global (#11246)
30 янв 2025, 21:57
Не верифицирован
30 янв 2025, 21:57
3d5d8fa
Код
Авторство
О чём код?
import { loadTextures } from '~/assets'; import { FillGradient, FillPattern, Text } from '~/scene'; import type { TestScene } from '../../types'; import type { Texture } from '~/rendering'; import type { Container } from '~/scene'; export const scene: TestScene = { it: 'should render FillPattern and FillGradient in text stroke', create: async (scene: Container) => { const gradient = new FillGradient({ end: { x: 1, y: 0 }, colorStops: [ { offset: 0, color: 0xff0000 }, { offset: 0.5, color: 0x00ff00 }, { offset: 1, color: 0x0000ff }, ], }); const textGradient = new Text({ text: 'PixiJS', style: { fontSize: 36, fill: 0xffffff, stroke: { fill: gradient, width: 10 }, }, }); const txt = await loadTextures.load<Texture>('https://pixijs.com/assets/bg_scene_rotate.jpg', {}, null); const pat = new FillPattern(txt, 'repeat'); const textPattern = new Text({ text: 'PixiJS', style: { fontSize: 36, fill: 0xffffff, stroke: { fill: pat, width: 10 }, }, }); textPattern.y = (textGradient.height); scene.addChild(textGradient, textPattern); }, };