ActionScript 3.0 :: Math For Rotated Dragging?
Aug 17, 2010
this math isn't working well. I'm using it for a rotated drag and drop (of a tone arm on a vinyl, a kind of abstract turntable simulation). Right now it just moves a bit in the middle of the vinyl (values between 21 and 36, is this degree or what unit is this?), but it should move between the two edges. The problem is that I don't know enough about trigonometry functions. Therefore I can't optimize the math for envisaged behaviour. Does anybody have an idea/tip how I can get a bit more control on the math and its effect? (maybe with more trace functions)
[Code]...
View 1 Replies
Similar Posts:
Apr 3, 2010
Ok, let's see if I can explain what I'm trying to do...I have an image I am using for a texture that is 600x800nd a tile clip I would like to randomly apply part of the image to as a texture. The tile clip is 100x40.Now I can do this fine with a repeating texture, because I can just randomize the matrix and not worry about being precise. However, I'm not sure how to randomize the angle of the applied texture without going out of bounds and showing a seam.Example of this with repeating texture:
Code:
textureWidth=600;
textureHeight=800;
[code].....
View 6 Replies
Aug 19, 2010
Here attached a simplified, reduced flash file as an example of my earlier problem. With some trial and error I changed the function rotation2. I changed (180/Math.PI) to (45/Math.PI) to get the mc_arm into the half circle, but it just moves a bit in the middle of the circle when you grab and drag it. How can you optimize this behaviour, so that the arm really follows the mouse on mouse down and move, within the borders of that half circle? The formula must be changed somehow, but I don't know how.
View 0 Replies
Mar 7, 2011
Here is the problem:
var p:int = 0;
var n:Number = 0;
n = 32.999999999999999;
p = Math.floor(n);
trace(p); // returns 33
n = 32.11111111111111;
p = Math.floor(n);
trace(p); // returns 32
I would expect both of these to return 32. I have searched, and it seems this is an unreported bug in AS3. Or ... am I doing something wrong?
View 4 Replies
Sep 26, 2005
Wat is the diffrence between these two?
View 2 Replies
Feb 16, 2009
I have a code in which I have to use Math.round if a certain value is for example 3.67 (67 is higher than 50) and Math.ceil if a value is for example 3.23 (23 is lower than 50). What can I do to make flash calculate if what after the dot �.� in 3.23 (for example) is higher than 50?
View 2 Replies
Jan 16, 2004
So here is a piece of code that I have seen used a lot but don't really quite understand:
myVar = Math.min(Math.max(myVar, this.min), this.max);
or some variation thereof. I understand that the function first finds the maximum value of two values then turns around and uses that to find the minimum between two values.why this is done? And how do you know when to use it?
View 3 Replies
Jan 16, 2004
So here is a piece of code that I have seen used a lot but don't really quite understand:[code]or some variation thereof. I understand that the function first finds the maximum value of two values then turns around and uses that to find the minimum between two values.And how do you know when to use it?
View 3 Replies
Feb 6, 2010
I am facing a curious issue. Generally when we draw lines in Flash either vertically or horizontally or through exact 45 degrees on either of the sides, they come out as straight and anti-aliased. While if they are drawn deviated from either 0 or 45 degrees, they come out as jagged. I want that to be anti-aliased too
View 1 Replies
Nov 16, 2010
When I select the text tool in Flash and click on screen to type, my text box is default rotated 90Ëš clockwise. In addition, the text is default bottom aligned so when you hit return, the next line is above the first line. So, simply rotating it back doesn't
Even my properties box align buttons are rotated: I should add that the little rotation button you see for "orientation" is not the fix- it rotates individual letters.I can't find anything in the menus, toolbars or preferences to change this...
View 1 Replies
Oct 31, 2009
I have created a simple text scroll ( on (release) {object.scroll += 1} and it works fine.
Now the image in the background is slightly tilted so I have to rotate the text box a bit and I do this the text disappeares.
Any Idea how to get that rotated text box visible when rotated?
View 3 Replies
Oct 7, 2011
I am currently making a game based on slicing other objects, basiclly when you hold down and drag your mouse and then release it an object that shows the cut will be created.
//Sliceline.as
package
{
import flash.display.Bitmap;
[code]....
View 1 Replies
Oct 12, 2011
Is there a way to know if user's camera is 180° rotated ?
View 3 Replies
Aug 21, 2009
I have made an application where you can design your own greeting cards. I use matrices to scale and rotate images, and I always need to know what scale the image has.
It works when the image isn't rotated, by taking the value from matrix.a or .d which are the scaleX and scaleY values. But when I rotate the image, using the matrix.rotate() function, the a and d values no longer corresponds to the scale of the image.
How can I get/calculate the scale value of an object that is rotated? And I don't want to scale the image by using the scaleX and scaleY methods.
View 9 Replies
May 5, 2010
I need to rotate the imageClip,then zoom in,then i need to scroll the imageClip fully.ve the tutorial for thisboth horizontal and vertical scroll for Rotated imageClip..
View 0 Replies
Aug 5, 2010
I'm using following code:
ActionScript Code:
var bd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
bd.draw(stage, null, null, null, new Rectangle(tmpX - (tmpW/2), tmpY - (tmpH/2), tmpW,
[code]....
View 9 Replies
Jan 20, 2009
Suppose I have a Sprite (A) that is constanly being rotated (as often as the mouse moves).
I have another Sprite (B) that is a child of (A). It makes sense that B is a Child of A because I want B's position to be relative to A's position, and I want B to become invisible when A goes invisible, etc.
However, I would like B NOT to rotate when A rotates. Is there a way to omit B from rotating when A rotates, even though B is A's child?
I know I could do something like B.rotation = - A.rotation everytime A gets rotated, but that feels like a clunky hack to me... there must be a better way?
Currently I'm considering making B a separate object, and not a child of A. But thats not much better because then I have to keep B updated with A's position and visibility, etc...
View 5 Replies
Dec 10, 2010
Quick question which is giving me difficulty, but I'm probably missing something...
How would I create a bounding box for any graphic, which can accommodate the graphic while bring rotated?
Simply making a square with the maximum of width or height doesn't cut it... think for example holding a T..
View 4 Replies
Apr 13, 2011
I am using Senocular transform tool and I have an object on the stage which I can rotate freely using the mouse. What I want to do is "capture" the total degrees I am rotating the object and write in a a text box. For example, if I will rotate the object clockwise 3 times, the text box will show 1080 (360 * 3), if I will rotate the object counter clockwise 1.5 times the text box will show -540 (360 * -1.5).
View 8 Replies
Dec 16, 2009
Say I've got a box that is 218 by 86. If I rotate it to 50 degrees then the width and height are reported as 206 by 222.3. I'm trying to take those rotated values back to the original values and I'm having a bad math day and can't figure it out.
View 11 Replies
Oct 17, 2011
I managed to have a working sample using the Gyroscope native extension. I followed these steps:
1) Downloaded the extension
2) Added the ANE file to the library path into Flash Professional CS 5.5
3) Coded as shown in the extensions documentation
4) Exported the SWF file
5) Compiled the SWF and extension using ADT
I worked perfectly. I had a 3D cube rotated using the gyroscope data. Well, not exactly perfecty because after some time app seems to have lost right direction. But I read this is normal and that you need to use Accelerator to balance this. I'm not worried about this though right now.
View 1 Replies
Jan 28, 2010
I have a container with masked bitmap in it. The scale and rotation of this container changes at runtime, and I need to draw the masked bitmap but cannot figure out the appropriate matrix calculations to do so.My code works correctly to reflect position, scale, offset for centering without rotation. When rotated, the angle is correct but the positioning is incorrect - I believe because the dimensions change when the rectangle is rotated.how to compensate for this in the positioning - here is some code:
// Adjust the transformation matrix to account for the position of the container
var tMatrix:Matrix = _imgContainer.transform.matrix;
//Offset for container
[code].....
View 4 Replies
Aug 5, 2010
I have a couple of images, representing tents, that look like this: The red and blue parts on each side of the tents are doorways, and several tents can be connected together via these doorways. For example, I want to connect the two blue doorways so that they match up like in this picture: If the first tent is stationary, around which point do I rotate the second tent and how do I calculate where to place it?
Currently, I have the upper left corner of each doorway as an x and a y value, together with the width and direction (in degrees) of the door. I'm treating the doorways as one dimensional, so they don't have heights. Would another representation suit this better? Perhaps a start point and an end point plus direction?
View 1 Replies
Sep 16, 2010
When rotating a bitmap with actionscript, the edges are jagged and not properly anti-aliased. How do you force anti-aliasing of the bitmap ?
this.stage.quality = StageQuality.BEST; // Tried this, but seems useless
var imgFromLib = new imgFromLib ();
imgFromLib.rotation = 30;
View 1 Replies
Mar 9, 2011
I am using the following to rotate a textfield from its top right corner, I would like to know the best way to find the point of the top right corner.
[Code]....
View 1 Replies
May 25, 2011
this is the code for 3d rotation [code]i want to rotate the image after dropping them in the canvas.i am able to rotate them in the panel.
View 1 Replies
Jan 4, 2010
Is there a simple way to take a few square images and set rotationY for each one to be the same degrees, then using an equation line each clip up after the previous one? For some reason the width property of the rotated clips is not lining them up correctly for me. I managed to get the desired result by trial and error (see below), but really need to get an equation for this so I can move the clips around with little hassle.
View 4 Replies
Feb 14, 2010
What does work : I want to put a dynamic textfield on my stage.Then i change the content of this field with AS3.But : when I rate the textfield on my stage, the text disappears.And I have embedded my font (also 'Export for actionscript')...I prefer not to put any textfields on the stage using ASSo the only code I use is : ActionScript Code:this.trial.text = "this is a test";
View 2 Replies
Sep 9, 2010
Using textfields. I need vertical text, rotated so that you could read it from bottom up. I can do it with static textfields, but I need to change the content of the textfield, so I cant use static textfield class. What other options are there? I've heard something about embedding fonts does the trick. The thing with embedding the font....I read that if it works, it increases the swf size quite significantly. Atm I am using a very narrow text field with multiline so that one letter is on a separate line, but it doesnt look good and I need to change it.
View 0 Replies
Aug 9, 2011
I have two sprites that are drawn as rectangles. I want to know if the rectangles are intersecting. I run into trouble when the objects rotate.
View 2 Replies