How to drag and rotate a image in android webview smoothly - javascript

I have two images in the canvas. I have to rotate the circles on it's center only by dragging/rotating the finger on respective sides of the canvas. I have tried to move the circles using the touchmove event. But it does not matches the speed of the finger rotation as I have to pass the angle (set to a specific values). How can I move the circles smoothly, by matching the speed of the finger?

Related

How to resize a rectangle which is rotated by a certain angle in HTML canvas?

I want to know how to resize a rectangle by dragging it's edges when the rectangle is rotated by a certain angle in HTML canvas.
https://shihn.ca/posts/2020/resizing-rotated-elements/ this link which is a potential solution for this problem but I am not able to understand the math behind it.

Jquery Draggable element is shifted out of snapping grid after rotating

I have draggable div rectangles and a grid of divs (of the same size) within a wrapper onto which the rectangles should snap and drop. Those rectangles are rotatable to the need of the user. When the user rotates the rectangles, at the same time the grid rotates in the same direction as well. The rotation is done with css transform. When I rotate the elements and the try to drag and drop a rectangle the snap is shifted by different amount of pixels, depending on the amount of rotation.
You can see the problem in action here - when you click on the measure tape icon and click on the satelite image, then you start rotating the rectangles along with the grid.
https://www.ticketa.cz/sketch/
I tried setting same transform origin on both draggable and snap elements. Also tried setting different options of the snap UI setting. Also tried setting draggable refresh positions to true. No help.

How to rotate and move a sprite towards the cursor?

Lets say that I have a player sprite, located at (player.x, player.y). On a mousemove event, I am capturing the cursor's position, which is (e.pageX, e.pageY). In the game, the player will be constantly moving, always towards the direction of the cursor. I am trying to find a way to to rotate the player sprite to always face the mouse cursor, and also move 10 pixels closer to the cursor every game tick. So far, this has me stumped. I have seen many examples of this online, and have tried all of them, but none seem to work. Any help that can be provided would be very much appreciated.
First of all, you must learn the basics of trigonometry. Without this knowledge, you will can't make something like you want.
Center of you image is the center of an circle. Knowing position of center and mouse position, you can calculate the angle. Calculated angle you can use to rotate image.

Large background image pan zoom and animate to coordinates

I'm looking for a solution to pan and zoom a large background image and when you click on a link in the menu it has to animate to x and y coordinates of that background image. I've tried the smooth zoom pan jquery plugin: http://codecanyon.net/item/smooth-zoom-pan-jquery-image-viewer/511142
Problem with this plugin is that the animation is terrible slow on iPad (Retina). It's already using transform 3d for hardware acceleration. The image is a SVG. I also sliced the SVG in smaller tiles (like Google Maps) and also tried this in PNG format but this didn't make any difference.
The background size on a normal screen is 5300px * 3000px.

get rotating points of canvas after rotating the canvas

I am rotating an image with shape(e.g. Rectangle, Circle etc).
On rotation value 0, i can draw all my shapes on mouse move smoothly.
but on rotation value(e.g 90,180,270 means greater than o) :- On apply rotation i am rotating image and shapes simultaneously. But when i am trying to draw any shape, drawing is happen directionlessly. If am moving annotation from left to right then shape is drawing from right to left, from top to bottom to "bottom to top"..
I am rotating both canvas image as well as for shapes.
I have tried a lots from my side. But i am finding way to do this.
Thanks In Advance

Categories

Resources