ActionScript 3.0 :: Animate Circles On Random
Apr 29, 2010I try to animate cricles on random.. Its not working for me.. somewhere the code needs to correct.. Here my code...
[Code]....
I try to animate cricles on random.. Its not working for me.. somewhere the code needs to correct.. Here my code...
[Code]....
how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out..
View 1 RepliesMy problem is I need to generate numbered circles ( from 1 to 100) and I need to make them click able. When I click the circles in order (i.e. 1, 2 , 3...etc) the clicked circle should change color or get disabled (to indicate it is clicked). I should not be able to click the next numbered circle until I press the previous numbered circle and there should be a counter to show how many correct circles are clicked.
View 1 Repliesi'm "experimenting" a bit with code at the moment and now i have written a class that creates a circle that bounces at the bottom of the stage. Wich has a random size and a random starting point.But now i wan't to expand the code so that i can have a random amount of balls bouncing down, so instead of only one there are f.e. 3 balls.Also i have noticed that the stage.stageHeight does not get updated when i resize my screen when i run iton how to make that happen ?
package {
import flash.display.Stage;
import flash.events.*;
[code]....
I followed a text base mouse trail tutorial and the random vibration tutorial (found here). The issue I am having is being able to use both at the same time. I can either have the text based mouse trail OR the random multiple vibrating circles, but not both. I think it has to do with the "MovieClip" name. Here is the code for both items: Mouse trail - Found in frame one
[Code]....
The basic area:
add 5 circles on random locations on stage...
and animate them to random locations on stage without touching each other...
The problem::
The code below works perfectly (up to a certain point). It succeeds in making the circles animate to random points on stage. It also succeeds in detecting if once circle comes to close proximity with another circle... Code on main timeline:
Code:
var enemyArray:Array = new Array();
var timeToCreateEnemy:Timer;
// set up timer that will fire every 2 seconds, 5 times
timeToCreateEnemy = new Timer(2000, 5)
timeToCreateEnemy.addEventListener(TimerEvent.TIMER, createEnemy);
timeToCreateEnemy.start();
[Code] ......
I need to use a Timer for time controlled animation, time the drawing to occur every 500 milliseconds & Draw 20 circles in total. I also need to make sure the circles are completely drawn inside the limits of the stage...
import flash.events.TimerEvent;
import flash.utils.Timer;
// creates a new hundred-second Timer, ticks every 250 milliseconds
var faster_minuteTimer:Timer = new Timer(250, 6);
// designates listeners for the interval and completion events
[Code] .....
add 5 circles on random locations on stage... and animate them to random locations on stage without touching each other... THE PROBLEM: the code below works perfectly (up to a certain point)... it succeeds in making the circles animate to random points on stage... it also succeeds in detecting if once circle comes to close proximity with another circle... only problem is, i dont know what i should do next...
[Code]....
I try to animate cricles on random.. Its not working for me.. somewhere the code needs to correct..
Here my code...
[Code]...
supposing there is a movieclip in stage.. let's say its a circle with an instance name of "theCircle"..
the circle has to move / go to / animate to a random location on stage every 5 seconds... basically, the circle should move to the random location, stop and wait for 5 seconds, then move again to another random location.. again and again...
the code below is untested and incomplete.. but it is what i am trying to do.
Code:
var randomXPosition:int;
var randomYPosition:int;
var positionTimer:Timer;
[Code]....
on the moveCircle function, i can simply set the X and Y of the circle equal to randomXPosition and randomYPosition... but that would just change the location of the circle, not move it.. i am trying to make the circle animate towards that location at a constant speed..
supposing there is a movieclip in stage.. let's say its a circle with an instance name of "theCircle"..
the circle has to move / go to / animate to a random location on stage every 5 seconds... basically, the circle should move to the random location, stop and wait for 5 seconds, then move again to another random location.. again and again...
the code below is untested and incomplete.. but it is what i am trying to do... how i should go about this...
ActionScript Code:
var randomXPosition:int;
var randomYPosition:int;
var positionTimer:Timer;
[Code]....
on the moveCircle function, i can simply set the X and Y of the circle equal to randomXPosition and randomYPosition... but that would just change the location of the circle, not move it.. i am trying to make the circle animate towards that location at a constant speed..
I've been playing with the random motion code from the vibrate tutorial.I like the effect I'm getting but I'm wondering if it's possible to write some code to animate the movement between the random jumps the objects make.I'm trying to create random motion with smooth transitions.
View 1 Repliesanyone know of any tutorials or any codes on how to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out.. yeah, by the way i have attched the file so more or less u will understand wat im saying.
View 1 RepliesI got to create an app with 3 draggable circles. (Red,Green,Blue). At the centre overlay the RGB needs to display the mixed RGB. I.e if red and blue, overlay display magenta. If green and red overlay display yellow. If red, blue and green overlay display white, etc.
View 1 Repliesim so lost in how to make the circles go from down to up instead of going left to right.
Tutorail: Creating Continuous Movement
[URL]
Specifically i'd like to know the actionscript code.
I want to use semi transparent circles to show the intensity of the effect by altering the radius of the circle and animate it while placing them. for example it appears as a dot and then grows to the intended size in fraction of a sec.
I could see some functions in javascript API but not in Flex. Saw some examples that uses polygon. But i dont want to plot all 360 points for just one circle.
import flash.display.Sprite;
var bin:Sprite = new Sprite();
var cir:Sprite = new Sprite();
cir.graphics.beginFill(0x00ff00,1);
cir.graphics.drawCircle(0,0,30);
cir.graphics.endFill();
bin.graphics.beginFill(0xff0000,1);
bin.graphics.drawRoundRect(40,40,100,100,5,5);
bin.graphics.endFill();
addChild(bin);
bin.addChild(cir);
Here why do the circle added outside the square box?
I can make images transparrent and tween etc. I want to create an animation (like this one), if someone can please help put me in the correct direction? I am not sure how to get the circles animated to get the next image to display.
View 2 RepliesThe issue I am having is how to tackle forming a logo using circles. I have done one letter manually, however it would take forever to do this with every single letter, and so I am asking here if anyone knew of a faster method. Requirements:
- Has to fill non-circular letters(i.e. does not have to be precise, but look like it has edges)
- Circles have to animate in, therefore they need to have drop shadow and seem like they are landing in place
I've got the code for circle on an image (mask). I've got it in my first frame and I need do something else in 2nd frame but after the movie in 1st frame is finished.
Code:
//This container contains all the circles that act as a mask for the picture
var container:Sprite = new Sprite();
//Assign the container to be the image's mask
picture.mask = container;
//Add the container to the stage
addChild (container);
/*
This timer is responsible for creating a circle every 0.05 seconds. A total of 20 circles will be created.
*/
var timer = new Timer(50,20);
timer.addEventListener (TimerEvent.TIMER, createMaskBall);
timer.start ();
//The timer calls this function every 0.05 seconds
function createMaskBall (e:Event):void {
[Code] .....
I have been working on a drawing "game" in my spare time (which is limited). This is probably a common question, if so I appologize. By the way, I do not have the code here, it is on my other computer. Anyway, I was using the lineTo method and a timer listener to fire the addition of each new line segment, if that makes sense. The problem is that when you try to draw an arc quickly, it looks terrible. It draws straight lines. I tried adjusting the timer, which helps a bit but still not great. I looked at the curveTo but could not figure out a logical way to get the achor coordinates. I did some research online and found some that use addChild with bitmaps. I would rather use lines. Has anyone tackled this before?
View 3 RepliesI am looking for a way to draw circles using the mouse using the lineTo method, but need a way to find when collision occurs between the line that you're drawing and the line that's already on the screen.
View 0 RepliesI am trying to code some circles to move around inside one another. I have managed to do the hit test bit, but its getting them to stop at the edge inside one another is what I am having problem with. The aim is so the user can drag the red circle and the yellow stays where it is within the red, but when you drag the yellow circle the red moves with it.
View 2 RepliesI have used Kirupa's tutorial on vibrating circles and dont know how to turn it off.I am using the circles in Scene 1 and want them to disappear when you enter into Scene 2.
View 2 RepliesI've been messing with some code from lionbichstudios.com. I'm looking for a way to have 5 circles appear in succession and expand and fade away. Works fine for one circle but I haven't found a good way to create a sequence of circles. The one hitch: the code needs to appear all in one frame. (I'm using Flash MX 2004)
Here's the basic code:
[Code]...
"How do I get 2 circles to bounce off eachother correctly??". I am currently making an air hockey game. I have seen great physics explanations, and great swf's, but I can't seem to do it myself. I know how to get the puck to bounce off the walls, and that code is very stable/simple, but the hitter-against-puck collision is very elusive. Bit-101 has some great swf's on flashkit forums about the exact same thing I am looking for. I have heard of somebody on super samurai giving a great explanation. I have seen a physics student's explanation. It seems to be a lot of code involving the radii of the circles, and the only thing I really understand is this:
r1 = radius of puck | r2 = radius of hitter | d = distance between them
if r1+r2 > d, then they have collided.
Here is my puck-against-wall code:
onClipEvent (load) {
speed = 0;
dist = 0;
dx = 1;
dy = 1;
[Code] .....
So anyway, obviously that code is inside of the puck.
I have used Kirupa's tutorial on vibrating circles and dont know how to turn it off. I am using the circles in Scene 1 and want them to disappear when you enter into Scene 2. I know very little about actionscript and am asking for help. I am including the .fla
View 2 Repliesim so lost in how to make the circles go from down to up instead of going left to right.
Tutorail: Creating Continuous Movement
[Url]
Specifically i'd like to know the actionscript code
I'm creating a mask in what can best be described as a glorified spotlight effect program. It involves dynamically creating a gradient circle that will be the spotlight in question. However, I've run into a problem while creating gradient circles dynamically.
Code:
// in CS4
var testCircle:Sprite = new Sprite();
testCircle.cacheAsBitmap = true; // this can be true or false; doesn't fix the problem
[code]....
However, no matter what you put as CIRCLE_RADIUS, this will always output an approx 100-radius gradient in the center, and whatever is left over will have 0.0 alpha the rest of the way.So if you make one with a radius of 300, it'll show up as a circle with radius 100 and 200 pixels either side of blank space.Intersetingly enough, if you set the radius to less than 100 (say, 80), it'll cut off the circle at the radius and leave you with a hard edge.
I've found that if you set the ending alpha to anything other than 0.0, the full gradient is rendered. But I don't really want a hard edge Of course, fancy matrix transformations can fix this. But even those are unpredictable for some strange reason...even an identity matrix scales it drastically.Or do I have to go with pre-rendered ones or fancy matrixwork?
When I am drawing with a pencil, the line looks like the shape I want to draw, but when I stop drawing, the shape reshapes to another shape whick looks like circles and rectangles = it does not look like the shape I wanted to draw. What is the problem?
View 1 Replies