Scaling a geometry in one direction with top as reference in threejs

user2101977

I am trying to scale a THREE.PlaneGeometry with slider events. In effect I am trying to implement a window blind. When I try to change the scale of the geometry with respect to handler, the blind scales uniformly on both sides. It should be fixed at the top and scale in one direction. I tried changing the coordinates of the origin of the Mesh and translating the Mesh by the difference. But it doesn't work. The scaling happens from the origin all the time and the Plane Geometry grows on either side.

Any idea of how I can make it scale on only one side?

WestLangley

You need to translate your geometry so the top edge passes through the origin.

var geometry = new THREE.PlaneGeometry( 10, 10 );
geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 10 / 2, 0 ) );

Now, when you scale your mesh, the top will remain fixed.

EDIT: There is now a built-in method you can use:

geometry.translate( 0, - 10 / 2, 0 );

three.js r.85

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

ThreeJS geometry data from Json not rendering

분류에서Dev

Printing two pdf on one sheet without scaling

분류에서Dev

android objectanimator scaleX only in one direction

분류에서Dev

One frame at top of window, one at bottom

분류에서Dev

Keyboard shortcut for input language change works in only one direction

분류에서Dev

CSS placing one image on top of another

분류에서Dev

Foundation - Top Bar and Icon Bar in one template

분류에서Dev

Unable to reference one class library from another

분류에서Dev

boost :: geometry?

분류에서Dev

OpenGL Geometry Extrusion with geometry Shader

분류에서Dev

ThreeJS FPS 하락

분류에서Dev

STL rendering with threejs

분류에서Dev

ThreeJS LOD clone ()

분류에서Dev

Can i Add Two Tab Bars in same View controller one tab bar at bottom and one tab bar at top

분류에서Dev

How to create a vertical flexbox with one fixed-height top div, and one remaining-height middle div that can overflow?

분류에서Dev

Scaling SVG Polyline Drawing

분류에서Dev

paintComponent(g) Not Scaling BufferedImage?

분류에서Dev

Videos scaling in Ubuntu 15.10

분류에서Dev

Factory has two methods, one is $http method with $promise - how to reference the other method from within the first one's success function?

분류에서Dev

Bullet firing in direction of rotation

분류에서Dev

Change of direction in relation to Arrow

분류에서Dev

jquery .animation() height direction

분류에서Dev

Is it possible to distinguish a `const` variable from a non-`const` one and from a `const&` reference?

분류에서Dev

threejs 제어 정보

분류에서Dev

모델로드-threejs

분류에서Dev

문자 방향 ThreeJS

분류에서Dev

Handbrake "Storage Geometry"및 "Display Geometry"차이

분류에서Dev

convert character linestring to geometry in sf

분류에서Dev

Compute the volume of a constructive solid geometry

Related 관련 기사

  1. 1

    ThreeJS geometry data from Json not rendering

  2. 2

    Printing two pdf on one sheet without scaling

  3. 3

    android objectanimator scaleX only in one direction

  4. 4

    One frame at top of window, one at bottom

  5. 5

    Keyboard shortcut for input language change works in only one direction

  6. 6

    CSS placing one image on top of another

  7. 7

    Foundation - Top Bar and Icon Bar in one template

  8. 8

    Unable to reference one class library from another

  9. 9

    boost :: geometry?

  10. 10

    OpenGL Geometry Extrusion with geometry Shader

  11. 11

    ThreeJS FPS 하락

  12. 12

    STL rendering with threejs

  13. 13

    ThreeJS LOD clone ()

  14. 14

    Can i Add Two Tab Bars in same View controller one tab bar at bottom and one tab bar at top

  15. 15

    How to create a vertical flexbox with one fixed-height top div, and one remaining-height middle div that can overflow?

  16. 16

    Scaling SVG Polyline Drawing

  17. 17

    paintComponent(g) Not Scaling BufferedImage?

  18. 18

    Videos scaling in Ubuntu 15.10

  19. 19

    Factory has two methods, one is $http method with $promise - how to reference the other method from within the first one's success function?

  20. 20

    Bullet firing in direction of rotation

  21. 21

    Change of direction in relation to Arrow

  22. 22

    jquery .animation() height direction

  23. 23

    Is it possible to distinguish a `const` variable from a non-`const` one and from a `const&` reference?

  24. 24

    threejs 제어 정보

  25. 25

    모델로드-threejs

  26. 26

    문자 방향 ThreeJS

  27. 27

    Handbrake "Storage Geometry"및 "Display Geometry"차이

  28. 28

    convert character linestring to geometry in sf

  29. 29

    Compute the volume of a constructive solid geometry

뜨겁다태그

보관