Flash :: Transformation Using MovieClip.transform.matrix ?
Jul 2, 2009I have problem when dealing with transform in Flash cs4 ....When I rotate my movieclip and trace the output, my movieclip's width also changed....
View 4 RepliesI have problem when dealing with transform in Flash cs4 ....When I rotate my movieclip and trace the output, my movieclip's width also changed....
View 4 RepliesI have a UI component that I wish to relocate and scale, but in a rather complex way. I've figured out the necessary transformations using the transform matrix, to which I applied several translate and scale operations. I can set the new transform matrix for this UI component to be the above calculated matrix, and the results are accurate; but I need to animate the transition. I can't use the Scale/Move effects alone because they aren't as powerful when it comes to calculating the necessary transformation as the matrices are.So how can I animate the transition of an object given a source and a target transform matrix?Figured it outUsing a tweener and its onUpdate event to reassign the matrix with each intermediate value:
var animMatrix : Matrix = gi.transform.matrix;
TweenMax.to(animMatrix, 1, {
a : m.a,
[code]......
I have transformation matrix properties (a,b,c,d). How to calculate scaleX, scaleY, scewX, scewY and rotation angle from those values?
When only one type of transformation is applied, I can figure out that:
scaleX = a
scaleY = d
scewX = c
scewY = b
rotation = arccos(a) or -arcsin(c)
But when multiple transformations are applied at once I don't know how to calculate those values.
I need to do this outside of flash so I can't use any flash helper methods.
I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result.
I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner.
Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?
You can view the file as is at: [URL]
And i've zipped the FLA and relevant classes at [URL]
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
[Code]....
someone could tell me how I can zoom a Canvas, with transform.matrix, so that the content of the component fits into the parent container (application), either inward or outward
this function is called Zoomfit(), I have this code:
[Code]...
I have an odd problem in CS4/AS3 with one of my flash files where text is incorrectly rendered if the movieclip containing the text has a 3d matrix transform and quality is set to medium or low. It is easy to reproduce:
[Code]...
How can I, if it's even possible, use this transformation table provided in my question's accepted answer here in Actionscript 3 in Flash? I understand it might have something to do with Matrix, but I really have no clue if that transformation provided in the answer is possible to implement there. Is it? If so how?
View 1 RepliesI am doing a matrix transformation on a Display Object. I got this function from another site, but basically it scales a display object around any point.
ActionScript Code:
public static function scaleAroundExternalPoint(m:Matrix, x:Number, y:Number, multiplier:Number):void{
m.translate(-x, -y);
m.scale(multiplier, multiplier);
m.translate(x, y);
}
But my problem is that I have to do multiple scales in a sequence and after scaling, the points defined in the XML no longer correspond. Let me first say that all the points being scaled around are located in an XML file. They are all relative to the display object's registration point (0,0) when it is normal, i.e. a scale of 1. Also, I have created a class that retains the target object's original Matrix so that the percentage you pass in is relative to the original scale instead of the scale after each call. But basically, with the scaleAroundExternalPoint function by itself, if I have an object that I scaled to twice it's size, the multiplier would be 2. but say I want it back to it's original size. The multiplier would NOT be 1 since that would just leave it at a scale of 2x. It would have to be .5. The important parts of the class are below.
ActionScript Code:
public function ZoomUIComponent(isKeyboardControlled:Boolean = false, disabledAlpha:Number = .25,
max:Number = 2, min:Number = .5, precision:uint = 2,
seconds:Number = 1, step:Number = .1):void{
this.disabledAlpha = disabledAlpha;
this.inControl = InteractiveObject(getChildByName("zoomIn"));
_isKeyboardControlled = isKeyboardControlled;
[Code] .....
It's retaining the original matrix and then calculating based on that EACH TIME. So how would I find the new X and Y values of the original points so that I can scale around them?
I need to scale numbers. I'm using perlin noise to create a random 2d scrolling map. I'm using Blue channel data with values between 0 and 255 (I believe).Each pixel represent a value of height of a tile. For that reason I have to transform this value into a valid value.For example, If my 2d scrolling map has 20 tiles of maximum height and the pixel in the first position is 100.I have to transform 100 into the scale 1 to 20.
View 2 Repliesi've filled a circle shape with the bitmap data of a bitmap asset.i need to rotate the circle from the center, so i added the bitmap to the center of the circle and used a matrix transformation to shift the bitmapdata upward and leftward so it appears centered.
now i'm trying to read the bitmap data with getPixel() but the return value is off since it is returning the untransformed position of the bitmap data instead of the visible transformed bitmapdata.
Bitmap(Sprite(evt.currentTarget).getChildAt(0)).bitmapData.getPixel(evt.localX, evt.localY)
how can i get an accurate reading of the pixel data from a bitmap with a matrix transformation? updated with code. assume the redCircleData in my example is more colorful and something worth retrieving pixel data.
var redCircleData:Sprite = new Sprite();
redCircleData.graphics.beginFill(0xFF0000, 1.0);
redCircleData.graphics.drawCircle(0, 0, 100);[code]............
I ran into an issue with an app that I have been working on.The application lets a user draw a rectangle, which base class is UIComponent, on an SVG Canvas. The user can rotate, skew, scale,flip horizontal and flip vertical the rectangle. Then they can drop an image into the rectangle.We just cloned the rectangles matrix and applied it to the image and the image would transform the same as the rectangle. Well now we have changed the way the app works.
Now we don't want the image rotated or flipped on the initial drop, and this is where I'm having trouble.I was wondering if there is a way to always find the true top left of any rectangle no matter what kind of matrix is placed on it. I can find the center of the rectangle but when a user flips the rectangle the center point is outside the rectangle.Instead of finding the center I would like to find the topLeft.I have tried several things. Like transform.pixelBounds, but this gives me big numbers like 2200 instead of 400. I have also looked at senocular.com but not sure that I understand it.I just need a dynamic way to always find the top left.
i want to assign a transform matrix to an object, but i want to assign the values myself (as in, no 'rotate, scale etc'), but for example, set a matrix like
[Code]...
which if applied, would have no effect, but would be valid (actually not exactly that matrix, but you get the idea). i want to set the values of the matrix and the object should be affected by those values that i set by myself, no scale rotate or any predefined operations. how can i set my own matrix?
I have a class which extends the Sprite object in as3. I need to be able to override the transform.matrix setter in this class but haven't been successful in doing so.
I've tried many things, along with creating my own separate class which extends the Transform class and then overrides its set matrix function, and set my transform = new CustomTransform(). Sadly this didn't work.
In code this is what i tried:
public class MyClass extends Sprite
{
public function MyClass()
{
[Code]....
Im using Daniel Gasienica's Zooming in Flash where he uses the transform matrix to calculate the mouse position so the zooming reference point is the same. Its pretty handy, but i need the zoom to more smooth. I've tried almost everything (mainly the TweenLite engine), but with no luck.
[Code]...
I am having quite a bit of trouble with one of my classes not working with the custom PixelPerfect-Class. Looking into it I found the error occurring in this line:
Code: Select allbM:Matrix = objB.transform.matrix.clone();
It's throwing a 1009. Playing arounf with trace I have come to the point, that the hero in my little game has no transform.matrix (it's null). This is not related to the CollisionClass, i traced it independently of that.
Long time since i've been on here. I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result. I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner. Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?
[Code]....
I found the function:
rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number)
to rotate an object around an external point. The top of the object will always point at the center point which is exactly what I want.
It works fine but its possible to rotate it in an oval instead of in a perfect circle...I think it should be something with the angleDegrees Parameter but im not sure what to do with it. I also tried to set up an own matrix but I failed. Any right direction to orbit an object in an oval, and where the top of the object always point at the rotation center?
my problem is that if i scale, rotate or translate a display object using its transform.matrix i am not getting the value in the display object but the transform is happening like displayObject.scaleX or displayObject.scaleY etc. i get this new transform value using the dislayobject? as i am using a matrix transform manager which actually changing the transform matrix of the display object.
View 8 RepliesI'm having trouble with Matrix Transforms in Flex.
I have a Flex Canvas with nothing but an Image in it, like so.
<mx:Canvas>
<mx:Image id="img" source="/some/Url" />
</mx:Canvas>
[Code].....
I was wondering if there any way to change movieclip shape, when it on stage by as2.
View 1 Repliesi am looking for script for movie Clip distortion and 3D transformation in action script 2.0
View 1 RepliesWhen I right-click a symbol the options "set transformation point" and "reset transformation point" come up. They don't seem to do anything for me. I thought it would center them or something. This is not the case. I have the white transformation point in one corner in one keyframe and a different corner in another keyframe I click "reset transformation point" on both frames and they don't move.
View 3 Repliesi am developing a kind of (near-)isometric engine (in Actionscript 2.0), kinda simple, which is using MovieClips as wall or floor textures.This is the Wall texture i have:This is what i would like to have:The height is always 1.5 times the width. Its a simple skew transformation.Currently i have two possibilities:I am creating the finished wall in photoshop, save the file as PNG (because of transparent areas). Because i cant import PNGs at run time, i need to create all possible textured walls. A lot of work if i have a lot of textures (Say, i have about 200? )I am importing the original Texture into Flash, and perform a free transform directly in the MovieClip. I still have a lot of work because i have to do this to each textured wall!I would like to do this transformation in Actionscript, so i could import any texture JPG at the runtime (LoadMovie) and just need to have the File names stored somewhere or retrieve them and so on.
I didnt find any possibility to perform a skew transform to a MovieClip in Actionscript..The transformation is just like this: Rotate by 45 deg. (CW) and reduce the height of the finished transformation to 1/2.i am able to apply the _rotation and _height transformations, but the second transformation is always applied to the root object, which often might be very helpful, but right now its not.
i am developing a kind of (near-)isometric engine (in Actionscript 2.0), kinda simple, which is using MovieClips as wall or floor textures. This is the Wall texture i have: This is what i would like to have: The height is always 1.5 times the width. Its a simple skew transformation.Currently i have two possibilities:
I am creating the finished wall in photoshop, save the file as PNG (because of transparent areas). Because i cant import PNGs at run time, i need to create all possible textured walls. A lot of work if i have a lot of textures (Say, i have about 200? )I am importing the original Texture into Flash, and perform a free transform directly in the MovieClip. I still have a lot of work because i have to do this to each textured wall!I would like to do this transformation in Actionscript, so i could import any texture JPG at the runtime (LoadMovie) and just need to have the File names stored somewhere or retrieve them and so on.
[Code]...
I have a very complex vector symbol on the Stage - background_mc. I have set background_mc.cacheAsBitmap = true.This turns background to bitmap and makes Stage repaint fast.Every frame the background light changes.I use the following code to alter the light.
(new Color(background_mc)).setTransform(light);
And here is the problem.The code works very slow.I guess because the light is applied to the contents of the background_mc.And then a new cached bitmap is resterized once again.The same code over BitmapData of the same size works much faster!Is there a way to tell Flash to apply color-transformation to the cached bitmap, instead of underlying vector symbols?
Note, that background_mc is scaled when Stage is resized.This is not so fast, but it's good, because the picture quality preserved.If I convert background_mc to BitmapData, bitmap would be scaled.
Has anyone here ever developed a function (or general library of relevant functions) that will allow one to find the inverse of a matrix? I've searched the forum archives, as well as the internet more generally, but haven't found anything. If anyone has some leads, I hope you'll pass them along.
If I don't hear anything within the next few days, I might try to develop something on my own, but I'd hate to do so if someone has already done the dirty work.
A solution to this problem would be very useful for 3-D work or anyone doing mathematical programming more generally.
I'm having trouble with loading in an external image that I can transform with the Senocular Transform Tool class. I have managed to load in the picture but the transform class doesn't seem want to grab it. Eventually I want to us the FileRef to upload the image but I just need to figure out how it works first. Here my code to load in the external image
[Code]...
The transform class can grab the other movieclips but it doesn't want to grab the new image loaded in from the code above.
I'm trying to use the MatrixTransform class to RotateAroundInternalPoint but it requires that the object I'm trying to rotate has matrix points defined. My question is, is there a way to add Matrix points to a non Shape object so I can rotate it, or is there another class that is used to rotate movie clips around internal points?
View 6 RepliesI am trying to make a matrix code effect inside a movieclip called "Code", I am using the code made by Ilyas but have so far been unsucsessful, I can get it to work in the main root of a seperate .swf but not in the root of my main movie or a movieclip inside the root. I dont know how to alter it top make it work for a movieclipIf you dont know the code I am talking about see below :
[AS]
/***Author: Ilyas USAL (pom)
Title: The Matrix has you...
[code].....
I have a movie clip with 4 frames. I programatically create 3instances of it, and send each one to a different frame. If I laterapply a color transform to one of the clips, it plays through allthe frames and goes back to it's correct frame. Why does it dothat, and can I stop it from doing that?
View 4 Replies