Skip to content

Commit 5e7102e

Browse files
committed
feat: add Multi Loading example and enhance Review component with back buffer and antialias options
1 parent 38c7c99 commit 5e7102e

File tree

6 files changed

+123
-110
lines changed

6 files changed

+123
-110
lines changed

docs/.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ const themeConfig: DefaultTheme.Config = {
144144
{ text: 'Async', link: '/examples/assets/async' },
145145
{ text: 'Background Loading', link: '/examples/assets/background-loading' },
146146
{ text: 'Manifest Bundles', link: '/examples/assets/manifest_bundles' },
147+
{ text: 'Multi Loading', link: '/examples/assets/multi-loading' },
147148
],
148149
},
149150
// {

docs/.vitepress/theme/components/PixiJSContainer/components/Review.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const size = computed(() => {
3535
:background="background"
3636
:background-color="backgroundColor"
3737
:background-alpha="backgroundAlpha"
38+
use-back-buffer
39+
antialias
3840
>
3941
<slot />
4042
</Application>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script lang="ts" setup>
2+
import { useScreen } from 'vue3-pixi'
3+
4+
const screen = useScreen()
5+
</script>
6+
7+
<template>
8+
<assets
9+
v-slot="{ data }"
10+
:entry="[
11+
{ alias: 'flowerTop', src: 'https://pixijs.com/assets/flowerTop.png' },
12+
{ alias: 'eggHead', src: 'https://pixijs.com/assets/eggHead.png' },
13+
]"
14+
>
15+
<sprite
16+
:texture="data.flowerTop"
17+
:x="screen.width * 0.25"
18+
:y="screen.height / 2"
19+
:anchor="0.5"
20+
/>
21+
<sprite
22+
:texture="data.eggHead"
23+
:x="screen.width * 0.75"
24+
:y="screen.height / 2"
25+
:anchor="0.5"
26+
/>
27+
</assets>
28+
</template>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<demo mode="full" :background-alpha="0" src="./demo/multi-loading.vue" />

docs/examples/container/demo/blend-modes_comparison.ts

Lines changed: 0 additions & 109 deletions
This file was deleted.
Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,93 @@
1+
<script lang="ts" setup>
2+
import type { BLEND_MODES } from 'pixi.js'
3+
import { ref } from 'vue'
4+
import { onTick } from 'vue3-pixi'
5+
6+
const allBlendModes: BLEND_MODES[] = [
7+
'normal',
8+
'add',
9+
'screen',
10+
'darken',
11+
'lighten',
12+
'color-dodge',
13+
'color-burn',
14+
'linear-burn',
15+
'linear-dodge',
16+
'linear-light',
17+
'hard-light',
18+
'soft-light',
19+
'pin-light',
20+
'difference',
21+
'exclusion',
22+
'overlay',
23+
'saturation',
24+
'color',
25+
'luminosity',
26+
'add-npm',
27+
'subtract',
28+
'divide',
29+
'vivid-light',
30+
'hard-mix',
31+
'negation',
32+
]
33+
34+
const pandas = ref<Array<{ rotation: number }>>([])
35+
36+
// Initialize pandas rotation state
37+
for (let i = 0; i < allBlendModes.length; i++) {
38+
pandas.value.push({ rotation: 0 })
39+
}
40+
41+
onTick(() => {
42+
pandas.value.forEach((panda, i) => {
43+
panda.rotation += 0.01 * (i % 2 ? 1 : -1)
44+
})
45+
})
46+
</script>
47+
148
<template>
2-
-
49+
<assets
50+
v-slot="{ data }"
51+
:entry="[
52+
{ alias: 'panda', src: 'https://pixijs.com/assets/panda.png' },
53+
{ alias: 'rainbowGradient', src: 'https://pixijs.com/assets/rainbow-gradient.png' },
54+
]"
55+
>
56+
<container
57+
v-for="(blendMode, i) in allBlendModes"
58+
:key="i"
59+
:x="(i % 5) * 100"
60+
:y="Math.floor(i / 5) * 100"
61+
>
62+
<!-- 彩虹渐变(背景,正常显示,在底层,先渲染) -->
63+
<sprite
64+
:texture="data.rainbowGradient"
65+
:width="100"
66+
:height="100"
67+
/>
68+
<!-- 熊猫精灵(前景,应用混合模式,在上层,后渲染) -->
69+
<sprite
70+
:texture="data.panda"
71+
:width="100"
72+
:height="100"
73+
:anchor="0.5"
74+
:x="100 / 2"
75+
:y="100 / 2"
76+
:rotation="pandas[i].rotation"
77+
:blend-mode="blendMode"
78+
/>
79+
<!-- 文本标签 -->
80+
<text
81+
:x="100 / 2"
82+
:y="100 - 20"
83+
:anchor="{ x: 0.5, y: 0.5 }"
84+
:style="{
85+
fontSize: 16,
86+
fontFamily: 'short-stack',
87+
}"
88+
>
89+
{{ blendMode }}
90+
</text>
91+
</container>
92+
</assets>
393
</template>

0 commit comments

Comments
 (0)