|
| 1 | +<script setup lang="ts"> |
| 2 | +import { Environment, Levioso, OrbitControls, Ring, Sphere, Stars } from '@tresjs/cientos' |
| 3 | +import { TresCanvas } from '@tresjs/core' |
| 4 | +import { TresLeches, useControls } from '@tresjs/leches' |
| 5 | +import { DoubleSide, MathUtils, NoToneMapping } from 'three' |
| 6 | +import { BlendFunction } from 'postprocessing' |
| 7 | +import { EffectComposerPmndrs, ScanlinePmndrs } from '@tresjs/post-processing' |
| 8 | +
|
| 9 | +import '@tresjs/leches/styles' |
| 10 | +
|
| 11 | +const gl = { |
| 12 | + clearColor: '#000000', |
| 13 | + toneMapping: NoToneMapping, |
| 14 | + multisampling: 8, |
| 15 | +} |
| 16 | +
|
| 17 | +const { blendFunction, opacity, density, scrollSpeed } = useControls({ |
| 18 | + density: { value: 1.15, step: 0.001, max: 2 }, |
| 19 | + opacity: { value: 0.65, step: 0.1, min: 0, max: 1 }, |
| 20 | + scrollSpeed: { value: 0.05, step: 0.01, min: 0, max: 2 }, |
| 21 | + blendFunction: { |
| 22 | + options: Object.keys(BlendFunction).map(key => ({ |
| 23 | + text: key, |
| 24 | + value: BlendFunction[key], |
| 25 | + })), |
| 26 | + value: BlendFunction.HARD_MIX, |
| 27 | + }, |
| 28 | +}) |
| 29 | +</script> |
| 30 | + |
| 31 | +<template> |
| 32 | + <TresLeches style="left: initial;right:10px; top:10px;" /> |
| 33 | + |
| 34 | + <TresCanvas |
| 35 | + v-bind="gl" |
| 36 | + > |
| 37 | + <TresPerspectiveCamera |
| 38 | + :position="[6.5, 3, 6.5]" |
| 39 | + :look-at="[0, 0, 0]" |
| 40 | + /> |
| 41 | + <OrbitControls auto-rotate :auto-rotate-speed=".5" /> |
| 42 | + |
| 43 | + <Suspense> |
| 44 | + <Environment :blur="1" preset="snow" /> |
| 45 | + </Suspense> |
| 46 | + |
| 47 | + <TresAmbientLight /> |
| 48 | + |
| 49 | + <TresGroup :rotation-y="MathUtils.degToRad(5)" :rotation-x="MathUtils.degToRad(100)"> |
| 50 | + <Sphere :args="[2, 32, 16]"> |
| 51 | + <TresMeshPhysicalMaterial color="#FC7BAC" :side="DoubleSide" :transmission=".5" /> |
| 52 | + </Sphere> |
| 53 | + |
| 54 | + <Levioso :speed="2.5" :rotationFactor="1" :floatFactor=".5"> |
| 55 | + <Ring :args="[4.25, 2.5, 32]" :scale-y="-1" :position-z="-.25"> |
| 56 | + <TresMeshPhysicalMaterial color="#ffffff" :side="DoubleSide" :transmission=".25" /> |
| 57 | + </Ring> |
| 58 | + </Levioso> |
| 59 | + </TresGroup> |
| 60 | + |
| 61 | + <Stars /> |
| 62 | + |
| 63 | + <Suspense> |
| 64 | + <EffectComposerPmndrs> |
| 65 | + <ScanlinePmndrs :density="density.value" :opacity="opacity.value" :scrollSpeed="scrollSpeed.value" :blendFunction="Number(blendFunction.value)" /> |
| 66 | + </EffectComposerPmndrs> |
| 67 | + </Suspense> |
| 68 | + </TresCanvas> |
| 69 | +</template> |
0 commit comments