The design picture is like this. Click on one of the elements, and then it will move in an arc along the white chain
, like a turntable. If this is the case, how can it be implemented more simply and quickly? Please give me some ideas.
-------Supplement-------
For the mobile terminal, in fact, this piece is considered a whole. It is not difficult to change the lines and icons only, but what is needed is the icon. Will follow the move
The icon does not move and the ring rotates. Is this possible?
As a whole, make a super large block with a small viewport. When clicked, the super block can be rotated. This super block is a whole made of a ring and a small icon (or the ring and the small icon are made into two wholes. The width and height of the two blocks and the design diameter of the ring should be the same, so that the size of the small icon is Only when the block rotates can it seamlessly connect with the ring)
Several classes position elements and store class names in an array. When an element is clicked, the class of each element is switched in turn. If you want animation effects, you can add
transition
to each class.This is a general idea, you can try it.
I can only discuss it. . . Because I’m not sure,
If you use that chain to move---if you use css or js animation, think of it, it is a big element rotation. . . You have to try it to know the performance. Then consider using canvas to draw, which will be troublesome. I want to keep the big ring stationary and calculate the position and angle of each square in the ring. . I don’t know if there is any framework for this, and I’m not familiar with my own canvas. In short, it’s very troublesome.
Then each icon. . You can use css or js for this. . The key is that it involves events. . I haven't studied how the canvas element is related to events. . .Idea: arrange the items, calculate the offset value (absolute midpoint, bottom center), click on the item to get the index corresponding to the index, compare the index with the offset value, counterclockwise on the left, clockwise on the right, each time the animation is completed, repeat Sort the icons.
Note:
This should have the same structure as infinite loop scrolling. It requires front, middle and back to have three sets of original data, so that it can be completed both clockwise and counterclockwise.
For the sake of compatibility, it is recommended that the animation is only used as a transition, that is, when an item is clicked, the animation is completed to dynamically adjust the sorting of the items and redraw the list, that is, each animation is an array sorting operation;
Technical implementation plan:
Use css3 to implement, the difficulty lies in css3 rotation animation;
Drawing with canvas, key frame principle;
Made with svg, the principle is similar to canvas, except that the graphics are vector;
Use mp4 video, refer to https://www.apple.com/cn/mac-... ;
Use key frame animation, which is more complicated;
The specific implementation is still troublesome. You can search for related arc arrangement plug-ins, css3 animations, etc. Personally, I think canvas and svg are more reliable. Let's throw some ideas and look forward to the master.
Upload the code and change the picture and it’s done
It’s very simple, just for reference