• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

284
Views
Convertir imagen en partículas con tres JS en el siguiente JS

ahora estoy aprendiendo sobre Three JS y ahora estoy en el bloqueador de que mi expectativa debería ser así:

ingrese la descripción de la imagen aquí

pero ahora mi código no muestra ninguna vista, donde mi código era así:

 import { useEffect } from "react/cjs/react.development"; import * as THREE from "three"; import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"; export default () => { useEffect(() => { const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 1000 ); const canvas = document.querySelector("canvas.background"); let renderer = new THREE.WebGLRenderer({ canvas, antialias: true }); new OrbitControls(camera, renderer.domElement); const img = new Image(); let texture = new THREE.Texture(img); img.onload = () => { texture.needsUpdate = true; const material = new THREE.PointsMaterial({ size: 20, map: texture, blending: THREE.AdditiveBlending, transparent: true, depthTest: false, }); const particle = new THREE.Sprite(material); particle.scale.x = particle.scale.y = 1; scene.add(particle); }; img.src = "/flower.png"; scene.add(camera); camera.position.z = 3; const animate = () => { const elapsedTime = new THREE.Clock().getElapsedTime(); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth, window.innerHeight); renderer.render(scene, camera); requestAnimationFrame(animate); }; animate(); }, []); return <canvas className="background" />; };

Probé diferentes respuestas del foro, pero parece que no funciona para mí.

¿podrían ayudar? Yo lo apreciaré

over 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No puedes usar THREE.PointsMaterial con THREE.Sprite . THREE.PointsMaterial está destinado a THREE.Points . Utilice TRES.SpriteMaterial en su lugar.

over 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.

Andres GPT

Show me some job opportunities
There's an error!