Aframe Gizmo for Translation - three.js

I want to put a translation Gizmo on an object in aframe. I know that this can be done by calling the editor, but I would like to do this with a function rather than exposing the whole editor. I only want a gizmo on an object so its x, y, z axis can be dragged by editing.
Here is an example in three.js
http://threejs.org/examples/?q=tran#misc_controls_transform
Thanks for any advice,
Rob

Here's the code for it: https://github.com/aframevr/aframe-inspector/tree/master/src/lib/vendor/threejs
You'd need to wrap the TransformControls in an A-Frame component and skim through the EditorControls component to grab what you need and wrap that as well.

Related

three.js edit-able text form control

Is there such a thing as an edit control (meaning a rectangle of text containing a caret and modify-able by user input) for THREE.js? If so, could somebody give me an example of its use? . and, if not, must this functionality be simulated through DOM/JavaScript?
There is no such control class in three.js. You probably want to work with plain HTML textarea elements. If you want to apply a 2D or 3D transformation to a DOM element, consider to include one of the CSS renderers of three.js into your project:
https://threejs.org/docs/index.html#examples/en/renderers/CSS2DRenderer
https://threejs.org/docs/index.html#examples/en/renderers/CSS3DRenderer

OrbitController change orbit JS (Three JS)

Hi I am using OrbitController for my simple WebGL program.
I do notice that OrbitControls only orbits on point 0,0,0.
Is there a way to change its orbit to be around an object? (perhaps onclick)
Any help would be appreciated.
If you browse the source code, you will find a variable called target. And it is commented as follows:
// "target" sets the location of focus, where the control orbits around
// and where it pans with respect to.
Seems to me that this is exactly is what you need.

Unity Mecanim Scripting Dynamic Animation

I have a scene with one fully-rigged model of human body
and I would like to users could make their own animations by transforming the model.
I am talking about an app with time-line and possibility of rotating certain muscles.
Could you please recommend me some way how to do that?
I can imagine storing some information about model state in certain times.. but I do not know how to save it as an animation.
You can't edit animations at runtime. You can create an animation from scratch and use AnimationClip.SetCurve to build up your animation, but you can't access the curves directly at runtime.
However in an editor script you can use the AnimationUtilitys to modify an Animationclip, but of course only in the editor since this is an editor class.
Answer picked from this thread.
I think best possible solution for you is to create many different animations for every body part by your own and let user to choose different combinations of animations (if you are using Animator or Animations). Or you can split model by body parts and let user change transform parameters with iTweens (move from A to B and change angle from C to D). Then u can easily save object's "from" transform and object's "to" transform and use it as animation.

How do I attach a text to the vertices of a cube in three.js? Also, Can I add a Text at any point inside the Cube?

I am trying to create a cube using three.js for a project. I need to add text to vertices and at different points inside the cube. Any idea how this can be done?
For some basic code examples of using Sprite objects in Three.js, check out:
http://stemkoski.github.com/Three.js/Sprites.html
And for an easy way to create images that contain text to use as your sprite textures, check out the sample code at:
http://stemkoski.github.com/Three.js/Texture-From-Canvas.html
I think a combination of these two ideas will achieve what you are looking to do.
If you want to have label-style texts, so that the text begins at a specific point, but is always oriented with the camera and easily readable no matter the camera position, you can use sprites. (example of canvas-created text label sprites: http://i.imgur.com/e9I68xD.jpg - here they are rendered on a separate pass to that they are never obscured by the scene but you can do it on the same pass)
If that's what you are looking for, I'd suggest first checking the Sprites examples, and learn to attach some static image as a sprite to correct position in the scene. After you get that working, you modify the code so that you generate the text to an image canvas using standard Javascript Canvas functions, and using that image as the sprite.

Best way to animate a circle moving around a screen in Qt?

If I wanted to, using Qt, simply have some circles move around in a white box, or a graphic, what would be the best method of this?
Would I need to draw white/the graphic behind where the circle moved from every time? Is there a simple way of accomplishing this in Qt?
Create QGraphicsView object to your widget and added a QGraphicsScene to view.
Add a QGraphicsEllipseItem to scene
Use QPropertyAnimation to change the "pos" property of the ellipse item.
If you need more advanced features, you can build your own animation class on QPropertyAnimation.
enjoy it:)
Update: You can read Qt's Next Generation UI for more information.
Subclass a QWidget. Start a timerEvent() to animate the positions of the circles, then call update() at the end to schedule a repaint of the widget. Override the widget's paintEvent() - in there you draw your background and circles, using a QPainter object. The Qt Assistant has examples of how to use QPainter.
Qt also has a new animation framework that may facilitate something like this, but I have not looked into it.

Resources