javascript - PaperJs Adjusting width and height after rotation -
I have an item that has been rotated and I want to change width and height base without rotation.
When I change the item width and height altogether and again the shape direction resides in north and south.
How does it ensure that the width is updated based on the new rotation
is there a setting that I need to change or knows any math formula , I can use the new shape to calculate the basis on the rotation.
Any help or reference is much appreciated Thanks.
path Bounds property is the limit of the object, even if it is rotating. It prepares directly what you have prepared.
// Create an empty project for the canvas and a scene: paper.setup (document.getElementById ('myCanvas')); // Make the scope of paper global, by injection it in the window: paper.install (window); // Create original reclenical version point = new point (20, 20); Var size = new size (60, 60); Var rect = new path.Rectangle (point, size); Rect.fillColor = New Paper Color (1, 0, 0) rect.rotation = 15; // Create border rectangle bar bound path = path = new route References (rect.bounds); BoundsPath.strokecolor = new color (0, 0, 0); // Create a nice little animation: Function Onframe (Events) {// rotate the path by 2 degrees rect.rotate (2); // Limits rectangular borders path. Remove (); Border = new path References (Ricketts. Bounds); BoundsPath.strokecolor = new color (0, 0, 0); } View.draw (); View.onFrame = onFrame;
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" src = "https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.9.22/paper-full.min.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Canvas ID = "Mykives" resizing & gt; & Lt; / Canvas & gt; & Lt; / Body & gt; & Lt; / Html & gt;
Comments
Post a Comment