ActionScript 3 :: Transformation Of BitmapData To Triangle Points
Nov 11, 2010
I have a big code, but essentially, this part comes to transformation of a BitmapData to triangle points, using affine transformation. Also - I know that BitmapData is rectangular - the last, fourth point of the transformation is just the first one reflected over the axis defined by the other two points.
A small thing so you can see which point is which one:
1........2
. / / / /|
./ / / /
. / / / |
./ / /
. / / |
./ /
. / |
./
3 - - - -4 - 4th point reflected
This whole process would come to scaling, rotating and skewing the BitmapData based on the angles between the points... But somehow my code still does not work. Looking at a similar thing in PaperVision 3D - still didn't work?
View 1 Replies
Similar Posts:
Mar 27, 2009
How to calculate the area of a triangle giving 3 (X, Y) points?
View 2 Replies
Jan 29, 2007
I've started getting to grips with using the BitmapData class and a Transformation Matrix in the hope that I can start making some interesting image effects. However, at the moment Im having trouble figuring out how to shift the newly created bitmap so that any scale transformations are applied from the center rather than the top left corner. See here for example: [URL] The flower on the left is the original, the flower on the right is the new image created using "bitmapData.draw()". It has been scaled up to twice the size, but I want this to happen from the center of the image.
[Code]...
View 5 Replies
Feb 9, 2012
I am facing a real nightmare. I have many Assets which use strange origin points. I need to essentially draw these assets to a BitmapData, but the origin point causes all kinds of problems. StackOVerflow does not let me attach an image so I will try to describe. Imagine you have the shape of a digit "8". You have 3 of these shapes.... Each shape has a different origin:
1) The middle of the "8" shape
2) The centre of the top "o" part of the "8" shape
3) The centre of the bottom "o" part of the "8" shape
How, with a single drawing routine, can I correctly draw each of these instances to a BitmapData? Ideally I want to find the top left part of any Sprite bounding box, and bitmapdata.draw() from there. But after 2 days, all of my attempts either get clipped.... or using matrices, they do not work for every origin point and different drawings get clipped in different locations.
View 1 Replies
Feb 8, 2008
When 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 Replies
Oct 3, 2011
I have been tasked with trying to create a drawing tool that draws dotted lines as you drag the mouse across the stage. I can easily capture the points on MouseEvent.MOUSE_MOVE and store them in a vector and then draw the points as dots:
The problem is that I need to calculate evenly distributed points on an ever growing Vector of points so I can only draw the line between say every 5th point (say using modulus). I have been battling away with Bezier curve equations both Quadratic and Cubic but still can't quite figure out how to convert my Vector of points into an evenly distributed Vector of Points without sucking the life from the CPU.
View 1 Replies
Jan 31, 2007
I'm using Flash 8, with this code in the first frame:
import flash.display.BitmapData;
rissa._x=Stage.width/2;
rissa._y=Stage.height/2;[code].....
When I publish the file, I'm getting the following error message in the Output panel:
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");
Total ActionScript Errors: 1 Reported Errors: 1
View 8 Replies
Oct 14, 2009
I am trying to use the reflect class from "http://pixelfumes.blogspot.com/2007/03/reflection-class-v3-with-source .html" but I keep getting this error:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at Reflect()
at Site_fla::GalleryPage_29/loadThumbs()
at Site_fla::GalleryPage_29/sortXML()
[Code]...
btw, first I used assigned thumbContainer as the mc argument (outside the loadThumbs() function) and it worked but not exactly what I wanted... because I thought it is supposed to update when the movieclip is animated but it actually didn't... when I use a scroller, only the thumbs that are first loaded to the stage get the reflection..
View 10 Replies
Dec 29, 2011
I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.
View 3 Replies
Sep 1, 2011
how to use the bitmapData collision method. Now I'm trying to figure out if there is a way to see at what angle or coordinate of the bitmapData the collision happens? I need it in order to figure the accurate bounce angle after the collision occurs.
View 2 Replies
Jul 15, 2009
I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?
View 2 Replies
Dec 22, 2011
I've made a mobile version of my software, with low-res images and such, and I can now fully buffer all my content (including a 360 frame animation which is buffered to memory). Problem is, that everytime I update the view, more memory is used.When I write image = new BitmapData();, does it store the previously created BitmapData's in memory? Do I have to flush the memory somehow before I draw my second picture in BitmapData?Example:
ActionScript Code:
// In this example I draw using the same bitmapData several times, also
//overwriting the first image. Do I have to somehow delete the data first, to
[code].....
View 1 Replies
Feb 26, 2010
i am looking for script for movie Clip distortion and 3D transformation in action script 2.0
View 1 Replies
Feb 18, 2004
i want to drag my object, but the boundaries have to form a triangle and not the standard rectangle...
View 3 Replies
Feb 18, 2004
i want to drag my object, but the boundaries have to form a triangle and not the standard rectangle...
View 3 Replies
Jan 31, 2009
I'm playing around with Flash CS4 trial and tried to 'compose' a 3d Box by putting 6 MovieClips as the side elements of the box in one clip which represents the whole box. (only using the Flash Tools, no Actionscript). Within the BoxClip (after doubleclick on the BoxClip on stage), all sides look right, each side is positioned with the correct angles and coordinates. Outside the BoxClip, back on root stage, the box sides are not parallel anymore, the angles are not 90 degrees, there is no 'box' actually. So I guess, one of the problems is the 3D Center point of the objects which is absolute to one point in coordinate space. The other problem is the faulty '3D' display in Flash, that is, changing from inside to ouside a clip changes the view also. So far, the Flash GUI seems quite useless for doing some '3D'. How to improve the workflow?
View 3 Replies
Jul 10, 2009
How would I make this grow from right to left?[code]...
View 1 Replies
Aug 11, 2009
Is there any way to dynamically change the Transformation or registration point of a MC with AS3? I'm trying to dynamically create shadows behind clips that skew to follow the sun.
View 3 Replies
Nov 23, 2002
It's easy to draw a round cornered rectangle/square but how do you draw a triangle with rounded corners?
View 4 Replies
Mar 15, 2007
best method to calculate the angles of a triangle? Or have any good references? I have 3 points which can be moved when the user drags on it, so the angles will have to change accordingly.
View 8 Replies
May 11, 2011
In my quest to build a terrain with proper collision detection, I've reached another stalemate. What I need is to be able to find the normal(x,y,z) for a 3d Triangle. before I start to build everything from scratch, cross products and all that jazz. I want to check if someone's done this before or can give me their 2 cents of how to do this the best way.Given 3 verticles with (x,y,z): v1, v2, v3 How do I find the Normal(x,y,z)I'm using away broomstick, and as far as i can tell there's no support for normal calculation. You would think that .subGeometry.vertexNormalData returns the proper normal, but it doesn't.
View 14 Replies
May 16, 2005
I have this triangle drawn (see fla)(Got it from this forum). Now I want a height being drawn as well. I want a height from point A beeing drawn to BC The angle at BC must be 90 degrees of course and the height drawn must alter when I drag the points B and C. Is this possible to do in flash, I have seen it done in JAVA
View 3 Replies
Jan 9, 2012
I am having an issue with using BitmapData.draw(stage). I am getting the following error:
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Documents%20and%20Settings/bla...bla...bla.swf cannot access null. No policy files granted access. Here is a portion of my code:
var bd:BitmapData = new BitmapData(2800, 2100); bd.draw(stage);//this is where the error happens All of the files referenced (.xml/.jpg/.swf) are located in the same local folder as the main .swf. How do I get around this error? The main objective is to print the stage using PrintJob(). I am using Flash Professional CS5.5 and publishing to Flash 10.0/10.1. Let me know if I need to supply any more info.
View 4 Replies
Sep 6, 2011
Place a 100px by 100px box on the stage (not a movieclip, just a simple shape).
Now apply a vertical skew of 30 degrees. You should get this...
Click outside of the shape to release the transformation data. The degrees for skew resets to 0 (this is expected), see image below
But What skew would you apply to the shape to return it to its original shape. Initially I would've thought it was -30 in the vertical skew, but this seems to return a weird hybrid shape.. See below:
View 2 Replies
Jul 23, 2004
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.
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.
View 2 Replies
Sep 2, 2011
I'm developing a flash product designer... one of it's features is that customers can add their own text to product and they can move it, resize it, rotate it... but I have one problem - text is stored in dynamic TextField with embed fonts, it's created dynamically from Actionscript, but it's registration point is set to upper left corner, is there any way to transform it around center? I mean resizing and rotating around center.
View 4 Replies
Jan 30, 2009
I want to build a specifik thing in flash, and don't really know where to start.... Say I have:
3 images of 3 three different squares
3 images of 3 three different triangles
3 images of 3 three different circles
The first thing you see is Square 1, Triangle 1 and Circle 1. If you were to click on Choose Square, Square 2 will appare in Square 1s place. If you click on it one more time, Square 3 will appare, and then round again to Square 1. Same thing for all the shapes.When you're satisfied with your selection of shapes you click OK and then you get to see a movie, based on whatever choices you've made. Because there are 3 different shapes and 3 different objects within each category, there will be 9 different movies to watch (3x3=9).One example of how this could turn out is:
Square 1 + Triangle 1 + Circle 1 = Movie 1
Another one could be
Square 2 + Triangle 2 + Circle 2 = Movie 6
View 10 Replies
Jun 16, 2010
I am working on a draggable triangle in AS3 and the corners must be interactive. To each corner a bitmap will be attached (in my example for now it's just a name of a city). When dragging a specific corner, the bitmap/cityname (attached to it) should fade in from 0 to 100 alpha. If the bitmap/cityname won't reach 100 of alpha, when Mouse Up, then it should fade back out to 0 opacity. If it does reach 100 alpha when Mouse Up, then it should stay that way. However, if another corner is dragged, then the cityname which is currently at 100 opacity should fade out again. Well I've got the draggable triangle figured, I've got the corners citynames appearing and disappearing when they don't reach 100 alpha. What I can't get to figure out is the last bit - the cityname currently at 100 opacity fading back out to 0 when a different corner is dragged. Hope it's at least a little understandable. I'm not sure my code is perfect (this is my first time in AS3) so don't mind if something is not the way.[code]
View 3 Replies
Apr 9, 2011
why do when I draw a triangle for instance with the pen tool, and then I rotate it with the free transform tool, so while I rotate the triangle, it is scaled and dissorted its shape, and it lengthen a little. And I don't know how to prevent it.
View 4 Replies
Mar 31, 2010
How to draw a triangle in a math graph which displays X and Y axis.
View 2 Replies