Skip to content

Commit

Permalink
feat(Lensflare): update seed with random value
Browse files Browse the repository at this point in the history
  • Loading branch information
andretchen0 committed Sep 2, 2023
1 parent dfa5d8a commit fba64dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion playground/src/pages/LensflareDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const randomColor = () => colors[Math.trunc(Math.random() * colors.length)];
const color = randomColor();
const lightRef = shallowRef();
const seedRef = shallowRef(0);
const flarePropsRef = shallowRef([{ color, size: 1 }]);
flarePropsRef.value = new Array(11).fill(0).map((_, i) => ({ size: Math.min(256 / (1 + i * i)), color }));
Expand All @@ -32,6 +33,7 @@ onLoop(() => {
if (Math.random() > 0.99) {
lightRef.value.color = new Color(randomColor());
flarePropsRef.value = getFlareProps()
seedRef.value = Math.floor(Math.random() * 10000)
}
});
Expand Down Expand Up @@ -70,7 +72,7 @@ const rockMaterial = new MeshPhongMaterial({ color: 0x123141, specular: 0xffffff
<OrbitControls />
<Levioso :speed="2" :range="[-13, 13]" :rotation-factor="10">
<TresPointLight ref="lightRef" :color="color" :intensity="1000" :position="[10, 0, 0]">
<Lensflare :seed="10" :flare="flarePropsRef" />
<Lensflare :seed="seedRef" :flare="flarePropsRef" />
</TresPointLight>
</Levioso>
<TresPointLight :color="new Color(1, 1, 1)" :intensity="2000" :position="[10, 5, 0]">
Expand Down

0 comments on commit fba64dc

Please sign in to comment.