当前位置: 首页 > 文档资料 > A-Frame 中文文档 >

<a-curvedimage>

优质
小牛编辑
119浏览
2023-12-01

The curved image primitive creates images that bend around the user. Curved images arranged around the camera can be pleasing for legibility since each pixel sits at the same distance from the user. They can be a better choice than angled flat planes for complex layouts because they ensure a smooth surface rather than a series of awkward seams between planes.

Under the hood, a curved image is a double-sided open-ended cylinder with textures mapped to the inside of the cylinder.

Example

<a-scene>  <a-assets>    <img src="image.png">  </a-assets>  <!-- Using the asset management system. -->  <a-curvedimage src="#my-image" height="3.0" radius="5.7" theta-length="72"                 rotation="0 100 0" scale="0.8 0.8 0.8"></a-curvedimage>  <!-- Defining the URL inline. Not recommended but more comfortable for web developers. -->  <a-curvedimage src="another-image.png"></a-curvedimage></a-scene>

Attributes

AttributeComponent MappingDefault Value
colormaterial.color#FFF
heightgeometry.height1
metalnessmaterial.metalness0
opacitymaterial.opacity1
open-endedgeometry.openEndedtrue
radiusgeometry.radius2
repeatmaterial.repeatNone
roughnessmaterial.roughness0.5
segments-heightgeometry.segmentsHeight18
segments-radialgeometry.segmentsRadial48
shadermaterial.shaderflat
sidematerial.sidedouble
srcmaterial.srcNone
theta-lengthgeometry.thetaLength270
theta-startgeometry.thetaStart0
transparentmaterial.transparenttrue

Fine-Tuning

Ensuring that the image is not distorted by stretching requires us to carefully set the height, radius, and theta-length attributes relative to the image aspect ratio. Once those values are fine-tuned to avoid distortion, we can use scale to safely adjust the distance of the curved image relative to the user.