0

I have Qt/QML app which shows items (pictures) on some ListView or StackView. I would like to have a transition from page to page like in Compiz Window Manager Compiz Window Manager I need some mathemathical equation, or some other explanation of how x,y,z of four corners of my object should change to have this 3D effect of cube rotation.

Cube rotation

Best, Marek

Scheff's Cat
  • 16,517
  • 5
  • 25
  • 45
user2018761
  • 184
  • 3
  • 14
  • That can be done "quite easily" with OpenGL. Qt has OpenGL support (AFAIK QML even more). Without OpenGL, you might compute the image distortions "by hand" - may be, similar like in this answer [SO: Rotate an image in C++ without using OpenCV functions](https://stackoverflow.com/a/56985104/7478597) although it might be better to expand this to 3d coordinates (4x4 matrices instead of 3x3 matrices). – Scheff's Cat Sep 11 '19 at 07:37
  • This https://stackoverflow.com/questions/33644373/how-to-animate-and-propertly-intepolate-a-qml-rotation-transform-in-3d might get a long way. You can also use `Maxtrix4x4` as the single transformation. Unfortunately my matrix-skills lack a bit, so here is an attempt with just `Translate` and `Rotation`: https://gist.github.com/amfasis/62181f1efcd0b3a2168b5903913a484c – Amfasis Sep 11 '19 at 08:11
  • @Amfasis thanks for this code. So basically what you are saying it would be better to use Matrix4x4 from Transform instead of individual Rotation/Translate, in conjunction with NumberAnimation to have this effect. I think I have seen somewhere what individual fields of that Matrix means but I'm unable to find it now. – user2018761 Sep 11 '19 at 09:29
  • Yes, because the error with what I now wrote is that the z is missing, `Translate` on his own doesn't do z. So using `Matrix4x4` you can get it, but then I cannot get the rotation ánd the translation correct. Maybe try this: https://www3.nd.edu/~pbui/teaching/cse.40166.fa10/slides/Lecture_4_Transformations_and_Matrices.pdf ? – Amfasis Sep 12 '19 at 18:00

0 Answers0