How to prevent extra div wrappers around the canvas in React Three Fiber (R3F)? - Stack Overflow

I want to apply this style to a sibling div container mix-blend-color-burn.However, I've just not

I want to apply this style to a sibling div container mix-blend-color-burn. However, I've just noticed that the canvas is being wrapped within 2 div containers:

<div> <!-- Wrapper 1 -->
  <div> <!-- Wrapper 2 -->
    <canvas></canvas> <!-- R3F canvas -->
  </div>
</div>

Which cause the effect to not work at all.

main component:

<div className="w-full h-full">
      <CanvasWorld />
      <div
        className="mix-blend-color-burn  absolute z-10 inset-0  
        flex justify-center items-center
      pointer-events-none "
      >
        <h1 className="mix-blend-color-burn text-[#252525] font-bold">
          Avid Software Engineer with +3 years of experience
        </h1>
      </div>
    </div>

The canvasworld component:

<div className="h-screen w-full webgl-world relative bg-transparent">
  <Canvas className="block">
    {/* <color attach={"background"} args={["red"]} /> */}
    <CameraControls makeDefault />
    <mesh>
      <boxGeometry />
      <meshBasicMaterial />
    </mesh>
  </Canvas>
</div>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744247104a4564988.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信