GithubHelp home page GithubHelp logo

aframe-rounded's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aframe-rounded's Issues

Can't apply a depth

Nice component - the curved corners do indeed look smooth, however I need my 'a-rounded' to have some depth as well. Is this possible? Adding depth="x" to the element doesn't work

Cannot align text inside the box

Hi,

I am trying to add a text to the entity with "rounded" component. Here is what I am trying -

<a-entity rounded="width: 3; height: 1; color: #ff00ed; opacity: 0.4" text="align: left; baseline: top; anchor: left; wrapCount: 35; value: Animating color Animating color Animating color Animating color Animating color; width: 2.5" position="2 1 -3">

However, the text always appears either outside the mesh or always at the bottom.

I am not sure what could be the issue here as I have tried different combinations of align. baseline and other parameters.

Added an image texture for images with rounded corners.

I updated this to add an image texture to allow for rounded corners on images. You have to make changes to the UVs to centre it.

    updateImage: function(){

      this.image = document.getElementById(this.data.imageId) as HTMLImageElement
      if(this.image.complete)
        this.updateTexture()
      else 
        this.image.onload = this.updateTexture.bind(this)  

    },
    updateTexture: function(){
      this.texture = new THREE.Texture(this.image)
      this.rounded.material = new THREE.MeshBasicMaterial( { map: this.texture, side: THREE.DoubleSide } ) 
      const vec3 = new THREE.Vector3()
      const attPos = this.rounded.geometry.attributes.position;
      const attUv = this.rounded.geometry.attributes.uv;
        for (let i = 0; i < attPos.count; i++){
          vec3.fromBufferAttribute(attPos, i);
          attUv.setXY(i,
          (vec3.x - (-this.data.width/2)) / this.data.width,
          (vec3.y - (-this.data.height/2)) / this.data.height
        );
      }
       attUv.needsUpdate = true
       this.texture.needsUpdate = true 
    },

Awesome! But off center

This is great, but the center of the plane seems to be in the corner, not the center.
So if I want to keep positioning consistent with other entities, I have to shift position by ½ of the width/height.
Any way to get the center in the center automatically?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.