ActionScript 3.0 :: Building Random Shaped Close Smooth Curve

Sep 30, 2009

I need some tips, algorithms, code samples, whatever relative to building random shaped close smooth curves, that have no intersections, not many "close to intersect" parts. Pretty much like on the image attached. If there are any algorithms for the same task but allowing intersections - would be great to know too.

View 4 Replies


Similar Posts:


Flash :: Achieve A Smooth Painted Curve For A White Board App?

Feb 23, 2010

I'm building a simple white board app in ActionScript 3. Most white board or painting apps in ActionScript tend to use an interval, timer, mouseMove event, or enterFrame event to track the mouse position and paint lines or brushes in between the tracked points.

What I'm trying to achieve is the nice smooth painted line that a program like Photoshop can render while painting with the brush tool. In Photoshop, no matter how fast you move the mouse around the canvas, the painted lines always end up with a nice smooth curved edge. In my app, using any of the methods mentioned prior, there is always latency between the function calls that render the brush to the stage. Thus, using any of those techniques can result in a sharp cornered line when moving the mouse very quickly in a circular manner.

This is no surprise to me, I just have no idea how I could achieve a smoother line like Photoshop's brush tool. Mind you, the brushes for my app are mostly based on shapes and do not or cannot use the drawing API to draw continues lines. In other words, graphics.curveTo() is not an option. I am also rendering the Sprites or Shapes generated by the brushes to a BitmapData instance.

View 4 Replies

ActionScript 3.0 :: Generate A Random Coordinate Within An Irregular Shaped Movieclip

Feb 3, 2012

I have a series of dots on a world map that depending on certain criteria move from one country to another. At the moment they move to a random point around the country's (mc) centre, as calculated by addind half the width to the x or y coordinate etc. This pressents certain problems such as the centre of the US is actually outside the boundries of the countries borders because of Alaska. Other countries such as the UK have dots floating just off the coast. The dots also cluster coveringing each other up.

Is it posible to generate a random x and y coordinate that is inside the boundries of an irregular shaped mc such as a country. I know that Flash must have these values because of colision detection and mouse overs. I just don't know how you go about accessing them.

View 3 Replies

ActionScript 3.0 :: Curve A Dynamic Text From A Straight Line To Circular Curve?

Sep 9, 2009

I want to curve a dynamic text from a straight line to circular curve (using a slider). I have placed the characters of the string in each textfield created at runtime.

View 3 Replies

Flash :: Function For Extrapolating Points On A Spline Curve Or Hermite Curve Similar To Keframe Interpolation?

Aug 26, 2011

I was hoping someone could help me working out some advanced data reformatting. What I'm hoping for is a function where I can input a value along with an array of key positions like so:

function remap(percentage:Number, keypoints:Array) { ...

The array would start with the minimum and end with the maximum point, with nested key points along the way. For example, I would input something like remap(0.25, [0:0,80:50,100:100] ) and the function would 'imagine' a spline curve graph from (0,0)-(100,100) with a key point of (80,50), then return the y value that is 25% along that graph.

View 1 Replies

ActionScript 2.0 :: Plotting On A Curve - Return The X And Y Of A Point Along That Curve?

May 10, 2007

I have a curveTo an anchor point and a control point.Then I have a function that will return the x and y of a point along that curve if I give it a number as a percentage of the curve (0 to 1).It looks like this, and works perfectly..

Code:
function drawOnCurve( interval:Number, x0,y0,x1,y1,x2,y2)
{
interval = Math.max( Math.min( 1, interval ), 0 );[code]....

x0,y0 are the start point, x1,y1 the control point and x2,y2 the final anchor point.But... I want to give it a _y value instead of a percentage (interval) and it return where on the curve that would intersect.

View 2 Replies

ActionScript 3.0 :: Building A Random Name Generator?

Jul 27, 2010

As a teacher I am looking to create a random name generator to use with my classes. I don't know much but I am willing to learn.I want my random name generator to be able to load class lists from an external file - I want the random name generator to be able to recognise the time and load the pre-defined class for that time of day. I think this will work best if the day and time were listed above each class list in the file. I will also look to add a basic action button which generates a new name when pressed. I have seen some posts referring to creating a random number generator and then link this to a text list but I think I am trying to do something a bit more different.

View 2 Replies

Professional ::building A Random XML Content Area?

Feb 18, 2010

I'm trying to build a "product spotlight" area on my site's homepage. There are a lot of products, so I want to display them randomly, and I want to specify an image, link and text in the XML file.
 
I've started by using the XML gallery on kirupa.com, but that didn't quite do what I wanted. I found a little workaround when I found a random XML image loader on another site, and used that.. all it would load was an image, so to make the product photos be links and have special text I made each photo a .swf instead of .jpg file and added a button link over the whole image. This way works, but we are adding more and more products and it's becoming cumbersome. There will be about 50 different products randomly changing.
 
It would be perfect if we could just set up the xml like
 
<list>  <product>    <image>whatever.com/product1.jpg</image>    <url>whatever.com/product.2htm</url>    <title>Buy this now for $3.50</title>  </product>  <product>    <image>whatever.com/product2.jpg</image>    <url>whatever.com/product2.htm</url>    <title>Buy this now for $4.50</title>  </product></list>
 
And then the flash file would have the link on the top layer and pull the url from the xml file, bottom layer would load in the image, and in the middle we'd have the title, maybe I'd have it slide in with a basic tween or something like that. And then, there could be like 50 different images listed in the xml, and it would display one randomly for like 10 seconds, then fade into a new one, and just keep swapping it out forever and ever. I really want to do it this way because I can update the text or images without having to build a new .swf file every time something changes.I know how to do some regular basic flash stuff, but I never got into the hardcore actionscripting, so I'm kinda stumped. Anyone know how I can pull something like this off or know of freeware example that I can use and build off of?

View 1 Replies

Professional :: Building A Random XML Content Area?

Nov 11, 2010

I'm trying to build a "product spotlight" area on my site's homepage. There are a lot of products, so I want to display them randomly, and I want to specify an image, link and text in the XML file.I've started by using the XML gallery onbut that didn't quite do what I wanted. I found a little workaround when I found a random XML image loader on another site, and used that.. all it would load was an image, so to make the product photos be links and have special text I made each photo a .swf instead of .jpg file and added a button link over the whole image. This way works, but we are adding more and more products and it's becoming cumbersome. There will be about 50 different products randomly changing.

<list>  <product>  <image>whatever.com/product1.jpg</image> <url>whatever.com/product.2htm</url>  <title>Buy this now for $3.50</title>  </product>  <product>  <image>whatever.com/product2.jpg</image> 

[code].....

View 1 Replies

ActionScript 2.0 :: Random Smooth Waving Line?

Aug 10, 2006

And I want it to randomly wave like if it was a hair in the wind, or like a snake moving, or even like a flame waving.Is there any way of doing it with actionscript?Is it also possible to make react to the cursor? When I pass through it with the mouse it moves, like if I just touched it.

View 6 Replies

ActionScript 2.0 :: Advanced Random Movement - Smooth?

Sep 1, 2003

Let me explain - on my upcoming website (in a year, maybe?) i'll have some sort of cartoon character walking above my contents - and I want his charcter to be smooth and actionscripted. However his movements should be done as a curved motion path would, but random.Now random movement will either: a) get you to one point and then to the other, but making a sharp turn or b) have no coordination in movement (good for making a bee fly but not for anything else).here's what im trying to do:

transform straight lines movement (random):

to something smoother

something inside me tells me it's got something to do with cos and sin functions but I've no idea how to make that work.And I don't want to do motion path because I need to do actions that rule that out.

View 7 Replies

Actionscript 3.0 :: Random Tweening - Make The Curves Of The Animation Nice And Smooth

Feb 11, 2009

Im animating an around in 3d space with papervision and Id like to make the curves of the animation nice and smooth, if I put random values into the xyz and bezier values the turns are quite weird and erratic. Does anyone know of a way I can animate something around in smooth curves, but not have to create specific values for the tween?

View 2 Replies

ActionScript 2.0 :: Random Movie Slideshow - So Close But Yet So Far?

Feb 2, 2005

I have a library of about 70 movie clips of company logos that fade in and fade out...I wanted to make a sort of 'random slideshow' of all the move clips, so I went ahead and copied the actionscript code for a timer that would (ideally) delay the time that it takes for the next clip to load.

Problem is, the timer starts up first thing rather than after a clip has played, and the clips then play at the same time.

The actionscript is on frame one of the Flash movie (there are about 70 clips, for the example I'm working on I'm just using 3 to start with):

stop();
function wait() {
for (i=25; i<=27 {
_root.attachMovie("my"+i+"_clip","new"+i+"clip", i);
clearInterval(myTimer);

[code]...

View 1 Replies

ActionScript 3.0 :: BeginBitmapFill And Setting The Smooth Attribute To 'true' Causes The Player To Hang A Few Milliseconds At Random

Jun 4, 2008

Since i upgraded to Flashplayer 9.0.124.0 i've noticed that using textures on 3D Objects via the beginBitmapFill method and setting the smooth attribute to 'true' causes the player to hang a few milliseconds at random. Setting smooth to 'false', the player runs without any hang. I tested this on different machines. An upgrade to player 10 beta didn't cure the symptoms but the hangs appear less in time. Has anyone else such problems or an idea what is going on?

View 1 Replies

ActionScript 2.0 :: Smooth Resize Onclick And Animation To Be Smooth?

Feb 9, 2004

I have a movieclip that I want to be resized when a button is clicked. I want the animation to be smooth as if it had weight though. I read the tutorial on this but I need something slightly different, I would rather it where I can just refer to a function that is set in another movieclip. That way I could easily refer to it again and just set the height, width, and if possible, x, and y.

And my second question, is how to keep the border of my movieclip that is going to be resized the same thickness. I want the inside to be resized but the sides to stay the same width but move to stay on the edge.

View 8 Replies

ActionScript 2.0 :: Close Browser By Clicking On Close Button Embedded Swf?

Jul 27, 2009

i want to close browser by clicking on close button embedded swf. I have tried fscommand("quit"), but which is not working on browser.

View 9 Replies

Hittesting Odd Shaped Objects?

Sep 8, 2009

I created a .PNG in Photoshop (see attachment) -- now when I make this into a movieclip the bounding box covers the entire area so the hittest activates as soon as my helicopter flies into the bounding box.I looked at adobe's "help" they recommended this code (by the way, I'm using Flash 8):

my_mc.hitTest(x, y, shapeFlag )
my_mc.hitTest(target)

The way I interpreted the code was like this:

onClipEvent(enterFrame){
heli.hitTest(248.1, -38, shapeFlag)
}

I read somewhere that you only use one of the two, and the shapeFlag one is the one to use.The above code I placed into the helicopter MC (named heli) - I set the x & y to where the PNG is.The PNG moves towards the helicopter, so I'm not sure if that makes a difference.I just want that if the helicopter runs into the ceiling or floor, the level resets.However my current actions activate as soon as it hits the bounding box.This is my code in the PNG:

onClipEvent(enterFrame){
this._x -= _root.levelSpeed;
}[code]....

I've tried a lot of things, and nothing seems to be working.

View 5 Replies

ActionScript 2.0 :: Dynamic Pie Shaped Wedge?

Oct 9, 2009

if I had a better understanding of bezier curves. This should draw a wedge of specified angle and radius, with the the bisector a vertical line. There appears to be something I don't get, because the curve does not conform to a perfect circle.

Code:
function doWedge(rad, angle, target) {
//angle to radians, then cut in half

[code].....

View 2 Replies

IDE :: 3D And Masking - Create A Different Shaped Mask?

Apr 1, 2010

I'm dabbling with 3D tweens but I've hit a snag. The tween works fine on it's own and also with a simple mask on it. My issue is when I add a second keyframe to the mask layer to create a different shaped mask. When it reaches that frame my 3d tween goes crazy and flies off.

View 1 Replies

ActionScript 3.0 :: Hittesting Irregular Shaped Objects?

Dec 16, 2010

What I'm trying to do is hittest two irregularly shaped objects using their alphas and not the bounding box.

The code below hittests two objects named target 1 & target 2. This is not my code, but mine looks exactly alike, except target 1 & target 2 are replaced with my MC's. the thing is, I keep getting an error.At every function line, like the "public static function complexHitTestObject I get an error that says: Expecting right paren before left-bracket. I don't know what this error is caused by, because I can't really see why Flash wants another right paren.

[Code]...

View 6 Replies

Professional :: Round Document Circle Shaped Workspace?

Aug 2, 2010

I want to make a simple animation with some photos.  But I'd like to create this in a circle shaped workspace (stage), so when I export the movie as a .swf it will be shown as a round document, instead of the basic rectangle.

View 1 Replies

Actionscript 3 :: Irregular Shaped Gradiant Contour In Flash?

Jan 30, 2012

I am looking for a way to get a similar effect as posted in the Adobe forums The current solution is very brute force using about 60 intermediate shapes gradually going from the outer shape towards the inner shape while slightly changing the color each time.

[Code]...

particular problem, I only wanted to have a shape fade into the color of the background so my solution was to draw the image slightly larger than usual and use Flash's blur filter to create the gradient effect. This is suitable only because my background image is a solid color so this won't work for everybody. This is also a very cpu intensive method but is faster than drawing 60 shapes.

View 1 Replies

ActionScript 3.0 :: Collision Between Elliptical And Irregularly Shaped Object

Apr 22, 2009

What is the most efficient way to text for a collision between an elliptical object, and an irregularly shaped object (closely related to a line) that rotates?

View 6 Replies

Actionscript 3 :: Randomly Place An MovieClip On An Irregularly Shaped Object?

Mar 8, 2011

Is there anyway to randomly place a MovieClip/Sprite on an irregularly shaped object?For a rectangle, it seems pretty straightforward (i.e. use Math.random with the range being the coordinates of an object)...but what if say, you would like to avoid placing objects in the center?

View 2 Replies

ActionScript 2.0 :: Bunch Of Square Shaped MovieClips - Snap To Objects

Dec 6, 2002

I am making a thing where a bunch of square shaped movie clips will be placed on the desktop, and will be draggable. I was wondering if there was a way to get them to stick together... similar to the snap to objects tool. Like say I am dragging one and I want to make a large square out of the smaller squares. I want them to snap together...

View 5 Replies

Actionscript 3 :: Calculating Column And Row Number In An Isometric Rectangular Shaped Grid

Jul 1, 2011

I'm trying to extend an isometric Flash game based on as3isolib. The game does only support diamond shaped grids but I have to implement the possibility to have rectangular shaped grids, too.

[Code]...

View 1 Replies

ActionScript 2.0 :: Solid Fill Color For Several Irregularly Shaped Movie Clips With Different Colors?

Jun 25, 2007

I have several movie clips of the main character (one for each primary and secondary direction), each of which contains 7 or so layers, one for each body part, and each layer then has about 6 keyframes, each keyframe containing a different graphic of the body part.All I want to do is create a shadow of the character. Originally, I just duplicated the main character movie clip, changed the _yscale, _rotation, _alpha and applied a color via setRGB(). It sort of worked, but because I was applying the setRGB() to the collective group of graphics having multiple colors, the variances showed up in the shadow, so you could make out the character's features.

View 2 Replies

ActionScript 3.0 :: Project: Lava Lamp - Generate Some Randomly Shaped Blobs Of Liquid?

Dec 28, 2007

I am working on a project, and I'm planning to make a flash lava lamp.I am currently working on the "giving heat to the blobs" part of the project.Currently it looks something like this:Link

[code]...

In the next part of the project I will generate some randomly shaped blobs of liquid and place them in a movie.And then they will find out the amount of yellow inside to get the average "temperature" of the blob, and then the upwards acceleration of the blobs will be determined. So if the blob is relatively hot, it will flow upwards, if it's low, it will flow downwards. As it gets higher, the blob will lose some heat. Touching another blob will exchange some heat and other lava-lamp'ish stuff will happen.Do you think I should do it with pixels? (like above) or do you think I should use "normal flash stuff" ? (By that I mean using movieclips, etc)Is my method of displaying "heat" good? Or could I use another way?

View 14 Replies

ActionScript 3.0 :: Image Panning With Irregular Shaped Image?

Apr 13, 2009

I have modified the code from the Interactive Image Panning AS3 version (found here) and I have come to a standstill. If you look at my .fla (link) or the image (link) you can see its not a rectangle but has two of the top corners cut off. So it can't really be panned using the usual method because the corners need to be avoided.I have managed to trace 'white' or 'not white' when the areas i don't want panned are visible but I can't figure out how to get the scrolling to stop! My code is as follows:

Code:
import flash.display.*;
import flash.events.*;

[code].....

View 4 Replies

ActionScript 3.0 :: Lenght Of A Curve?

Feb 20, 2011

I'm draving a loooong curve and i want to see what is the length of that, how to do that?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved