|
| 1 | +<script setup lang="ts"> |
| 2 | +import { ContactShadows, Environment, OrbitControls } from '@tresjs/cientos' |
| 3 | +import { TresCanvas } from '@tresjs/core' |
| 4 | +import { TresLeches, useControls } from '@tresjs/leches' |
| 5 | +import { NoToneMapping } from 'three' |
| 6 | +import { BlendFunction } from 'postprocessing' |
| 7 | +import { BarrelBlurPmndrs, EffectComposerPmndrs } from '@tresjs/post-processing' |
| 8 | +
|
| 9 | +import '@tresjs/leches/styles' |
| 10 | +
|
| 11 | +const gl = { |
| 12 | + clearColor: '#ffffff', |
| 13 | + toneMapping: NoToneMapping, |
| 14 | + multisampling: 8, |
| 15 | + envMapIntensity: 10, |
| 16 | +} |
| 17 | +
|
| 18 | +const neonColors = [ |
| 19 | + '#FF00FF', // Magenta |
| 20 | + '#00FFFF', // Cyan |
| 21 | + '#00FF00', // Lime |
| 22 | + '#FFFF00', // Yellow |
| 23 | + '#FF0000', // Red |
| 24 | + '#FF1493', // Deep Pink |
| 25 | + '#7FFF00', // Chartreuse |
| 26 | + '#FF4500', // Orange Red |
| 27 | + '#8A2BE2', // Blue Violet |
| 28 | + '#00FF7F', // Spring Green |
| 29 | + '#FFD700', // Gold |
| 30 | + '#FF69B4', // Hot Pink |
| 31 | + '#ADFF2F', // Green Yellow |
| 32 | + '#FF6347', // Tomato |
| 33 | + '#40E0D0', // Turquoise |
| 34 | + '#EE82EE', // Violet |
| 35 | +] |
| 36 | +
|
| 37 | +const { blendFunction, amount, offsetX, offsetY } = useControls({ |
| 38 | + amount: { value: 0.2, step: 0.001, max: 1 }, |
| 39 | + offsetX: { value: 0.5, step: 0.01, min: 0, max: 1 }, |
| 40 | + offsetY: { value: 0.5, step: 0.01, min: 0, max: 1 }, |
| 41 | + blendFunction: { |
| 42 | + options: Object.keys(BlendFunction).map(key => ({ |
| 43 | + text: key, |
| 44 | + value: BlendFunction[key as keyof typeof BlendFunction], |
| 45 | + })), |
| 46 | + value: BlendFunction.OVERLAY, |
| 47 | + }, |
| 48 | +}) |
| 49 | +</script> |
| 50 | + |
| 51 | +<template> |
| 52 | + <TresLeches /> |
| 53 | + |
| 54 | + <TresCanvas |
| 55 | + v-bind="gl" |
| 56 | + > |
| 57 | + <TresPerspectiveCamera |
| 58 | + :position="[0, 6.5, 6.5]" |
| 59 | + :look-at="[0, 0, 0]" |
| 60 | + /> |
| 61 | + <OrbitControls auto-rotate /> |
| 62 | + |
| 63 | + <TresAmbientLight :intensity="1" /> |
| 64 | + |
| 65 | + <template v-for="(color, index) in neonColors" :key="index"> |
| 66 | + <TresMesh :position="[index % 4 * 2 - 3, 0, Math.floor(index / 4) * 2 - 3]"> |
| 67 | + <TresBoxGeometry :args="[2, 2, 2]" /> |
| 68 | + <TresMeshStandardMaterial :color="color" :roughness=".5" :metalness="1" /> |
| 69 | + </TresMesh> |
| 70 | + </template> |
| 71 | + |
| 72 | + <Suspense> |
| 73 | + <Environment :blur=".25" preset="snow" /> |
| 74 | + </Suspense> |
| 75 | + |
| 76 | + <TresDirectionalLight color="white" /> |
| 77 | + |
| 78 | + <ContactShadows |
| 79 | + :opacity=".65" |
| 80 | + :position-y="-1" |
| 81 | + :scale="35" |
| 82 | + :blur="1" |
| 83 | + /> |
| 84 | + |
| 85 | + <Suspense> |
| 86 | + <EffectComposerPmndrs> |
| 87 | + <BarrelBlurPmndrs :amount="amount.value" :offset="[offsetX.value, offsetY.value]" :blendFunction="Number(blendFunction.value)" /> |
| 88 | + </EffectComposerPmndrs> |
| 89 | + </Suspense> |
| 90 | + </TresCanvas> |
| 91 | +</template> |
0 commit comments