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

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.

Related

UWP - Custom non-rectangular hit area on button. Either image or shape

I would like to define a non-rectangular clickable "hit area" for a button. I am happy to define this custom shape using a UWP XAML path, or by using a PNG with transparent areas.
The following question explains how to use an XAML path for a button's appearance, but the result still seems to use a rectangular bounding box hit area. XAML UWP Button with a polygonal shape
There are also posts explaining how to override the Image class, intercepting the 'click' event, and determining the opacity of the pixels under the mouse cursor. This would solve my problem, but this solution only applies to WPF.
Does anyone know of a solution for UWP?
It looks like I can just use the raw < path > element, and use its pointer events directly.

How to desaturate canvas group in Unity

How to get access to custom canvas group shader? I need to desaturate all child of game object situated on canvas. Something like canvas group component that provide possibility to change alpha of all child objets.
Unity might be using a more elegant solution by hiding their implementation of setting the alpha via the CanvasGroup component in their C++ part of the engine.
For now it looks like there is no other way than to set the material property on all UI elements (UnityEngine.UI.Graphic) with a custom material.
Remember, you can download the official shader source files. ;) There's a default UI shader, which you need to modify to add additional color functionality.

What is the better form to animate on Unity 3D?

I would like animate a object similar 3D sequence diagram using Unity 3D. I donĀ“t know what is better form to animate, if Animation or Animator...
So, I do a preview on Power Point https://youtu.be/tgfPIT47xGY
Animation vs Animator:
The Animation component is an old component used for animation in our legacy animation system. It remains in Unity for backwards compatibility but you should not use it for new projects. Use the up-to-date Animator component instead. SOURCE
Use the Animation Editor View for this.
To animate Game Objects in Unity, the object or objects need an Animator Component attached. This Animator Component must reference an Animator Controller, which in turn contains references to one or more Animation Clips.
When using the Animation View to begin animating a GameObject in Unity, these items will be automatically created, attached and set-up for you. SOURCE
Though slumtrimpet is obviously right, I can't see why you might need animations to create something like the video you shown. Why don't just use sequential instantiates with the help of coroutines or simple timers?

Scrolling a Texture2D that is in a RawImage?

Is this possible with Unity3D? ...
I have a Texture2D in a RawImage that is used to display on a UI Canvas and pixels are drawn into it with SetPixel() and then I want to scroll the Texture2D pixel by pixel. I don't want to use any material or fancy stuff as this code should be very efficient and lightweight. Can this be done somehow?
I ended up creating a wrapper class for Texture2D that adds API to better work with pixel manipulation tasks. It still all uses GetPixels/SetPixels since there isn't really much more API than that in Unity3D currently. But it's better than nothing. If anyone has a better method or suggestions it would be cool if you can share them.
Here's the class named Bitmap2D https://gist.github.com/hexagonstar/be39f847a4840c838500

Three.js-- having text overlays appear on screen

I'd like to create some mechanism that provides a text overlay on top of my 3D scene at certain times (such as when clicking a mouse button for instance.)
I'm going over the tutorials on github and notice things like the THREE.TextGeometry class. Using it I can put 3D text in the scene, but it may be a bit more than I need-- what I'm really after is a way to put some text on, say, a black background, overlay it on the scene, then move it out of the way when done. Does anyone know of good ways to do this in three.js? (If the THREE.TextGeometry class is a good way to do this that's fine, I'm just not sure how to do the overlay bit.)
Use HTML. It's super easy and powerful especially if you just need an overlay. With CSS, you can also achieve things like semi-transparent background. If you want to have it "blend" to scene, i.e. have perspective etc. you can use THREE.CSS3DRenderer which will transform divs based on camera you supply.

Resources