rotate a line in actionscript/flex 4.0? - actionscript-3

I want to rotate a line around a point in flex 4.0, i tried rotationX and all but whole line rotates and center of point is lost. How to rotate only one end point of line keeping the other constant?
Can someone point to example or explain how to do it? I'm a newbie in flex, thanks.

In the Rotate effect you are using, make sure autoCenterTransform is set to true.
Look here for more information.

Related

Is there a way to make all texts elements horizontal via scss when positioned around a circle/circular shape?

I have attached the code. Would like to know if there was a way to level the text, that is make it flat/horizontal in spite of it being around the circle? Kind of like its done here - replacing the images with text will illustrate this.
I tweaked the code a bit as I needed the wifi signals to be pointing outwards and so the the text seems to also be shaped accordingly. I considered perhaps trying to find the angle at which all elements around the circle would be horizontal but am unsure how to go about doing this. Does anyone know how to make the texts flat regardless of how many elements are around the circle?
Yes basically reverse the container rotation on the text. Also turn -45deg because it was added in the first place.
Change this in your .text classes
&:nth-of-type(#{$i}) .text {
transform: rotate(-$rot * 1deg - 45deg);
}

SciChart - Accurate placement of rotated axis labels

Following up on my question from yesterday:
SciChart - showing labels for all ticks
Thanks to the answer I was able to get the label density where I needed it. But I still have problems with label placement. As you can see in the screenshot, rotating the labels caused them to stick upwards into the graph. I need them below the axis. I've tried everything I could find in the API that I thought might help me:
a TranslateTransform - I tried moving both X and Y both ways. No
result.
VerticalAnchorPoint and HorizontalAnchorPoint - setting
VerticalAnchorPoint to Center actually moved the labels, but only by
3mm and in the wrong direction.
Horizontal/Vertical
Alignment/ContentAlignment - didn't do anything.
I've even tried
bloating the labels by appending a lot of spaces to the strings. A desperate attempt, I know.
Furthermore, the horizontal position of the labels is not correct either. In the screenshot you can see the first bump on the graph goes down on what looks like CF.02. But in reality it's set to CF.01. It would seem the labels are moved to the left of their corresponding tick. I need them to be displayed below the center of their respective tick, like the original solution.
[edit: image removed to prevent potential client IP issues]
In the SciChart's WPF Xaml Styling a Chart example there is a demonstration of how to rotate labels by changing the AxisBase.TickLabelStyle.
This uses RenderTransform to rotate labels by 15 degrees. However, if you use 90 degrees, the labels overlap the surface.
Changing the RenderTransform to LayoutTransform forces labels to be drawn in the correct place (below the axis).
You can read more about the difference between RenderTransform and LayoutTransform here.

rotate ccobject with kmglrotatef

I am trying to rotate a CCObject using kmglrotatef in cocos 2d x.
I am using the following line of code in my own object class which is inherited from
CCObject.
kmGLRotatef(20.0f, _xPos, _yPos, 1);
Here (_xPos,_yPos) - centre of the CCObject. The problem is the entire screen is rotating. I want to rotate the object only. Please help me.
Thanks in advance

As3 sprite rotationX and rotationY

I have a bit problem with rotationX and rotationY.
It's cool if i just do a roationX and rotaionY below
_eventParent.rotationY =_differentX;
_eventParent.rotationX =_differentY;
However once i have assign a mouse move to the _eventParent. The roationX and roationY change perspectively while the mouse is moving. so instead the item remain the same size. it increase and decrease size prospectively. any idea why is it doing this? is there a possibility to stop this behavior?
Thanks
Please find the image below.
Perspective allows part of your shape to look closer to you than other parts. The problem is that perspective has a center, or "vanishing point" and by default, it is fixed. As you move your shape farther away from the vanishing point, the perspective changes, causing your shape to widen or narrow.
You can fix this by updating the vanishing point so that it is always at the same coordinates as your shape. Since the shape will always be at the vanishing point, the perspective shouldn't change.
To do this, create a perspectiveProjection for your shape:
_eventParent.transform.perspectiveProjection = new PerspectiveProjection();
PerspectiveProjection is located in the flash.geom package, so don't forget to import it.
Then whenever you update your shape's position, update it's vanishing point:
_eventParent.transform.perspectiveProjection.projectionCenter =
new Point(_eventParent.x, _eventParent.y);
You might need to offset the vanishing point by a set number of pixels to get the perspective looking the way you want it to.
Correct me if I misunderstood your question. Your question is that if you apply rotation to the movieClip object, then why does the size appear to be changing?
For simplification, Let's not apply rotation on both X and Y axis. Let's take a rectangular movie clip and onMouseMove we do ++myMovieClip.rotationX;
Now, this statement is going to apply rotation on the object about the X-axis and one would get a perspective of the movie clip flipping across X -axis and this flipping will show as change in size of the object.
The same applies to rotating across y-axis.

drawing a line: is there exists a limits of thickness in Graphics.lineStyle()?

I'm developing a simple a graphical editor for my flash-based app. In my editor there's a posibility of scaling, range of scaling is big (maximum scale is 16.0, minimum scale is 0.001 and default scale is 0.2). So it's quite possible that a user can draw a line with thickness 0.1 or 300.0, and it looks that line possible thickness (in Graphics.lineStyle()) has upper border. As I found out from livedocs maximum value is 255. So if thickness is greater then 255.0 there'is drawn a line of thickness 255.0. Whether mentioned upper border exists and how big is it. Here're my questions:
Right now I'm drawing lines with drawPath() or lineTo() methods. Natural walkarround if thickness is greater then 255.0 is to draw a rectange instead of segment and two circles on the ends of segment (instead of lineTo()). Or even to draw two thin segments and two half-circles and fill interior. Maybe there's more elegant/quick solution?
Another question is if the thickness of line is big but less then 255.0 (e.g. 100.0), what is faster drawing a line with lineTo() or drawing two thin segments and two half-circles and fill interior?
And finally, maybe someone knows a good article/book where I can read what's inside all methods of flash.display.Graphics class (or even not flash specific article/book on graphics)?
Any thoughts are appreciated. Thank you in advance!
I agree with f-a that putting the line in a container would probably be better and more efficient than drawing a rectangle and extra circles.
I don't think that the math would be too difficult to work out. For efficiency you should probably only do this if the line style is going to be over 255.
To setup the display object to hold your line I would start by halving the width of your line (the length can stay the same). Then create a new sprite and draw the line in the sprite at half size (e.g. if you wanted 300, just draw it at 150). It would be most simple to just start at (0,0) and draw the segment straight so that all of your transformations can be applied to the new sprite.
From here you can just double the scaleY of the sprite to get the desired line weight. It should keep the same length and the ends should also be rounded correctly.
Hope this helped out!
A cool resource for working with the graphics class is Flash and Math. This site has several cool effects and working examples and source code.
http://www.flashandmath.com/