Particles Or Duplicatemovieclip Shower
Hey guys and girls. I trying to come up with a script where I can duplicate a movieclip and use it to make sort of a shower effect. So it will start from zero and then falling down (it can be a tween where the graphic falls down) and disappears after a while. After a couple of seconds the whole shower effect stops. Hope it's clear enough.Cheers!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 09-26-2007, 01:33 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Ebay Auction Info Shower?
i really like Ebay and was wondering if there is any way to make a info displayer so you type in the item number and it shows you the price and top bid and so on???
here is ebay: http://www.ebay.co.uk or http://www.ebay.com
Embed Two Flash Movies Into The Shower?
***WARNING, FOLLOWING LINKS FROM THIS POST MAY MAKE IE CRASH (THAT's the problem... )***
I'm trying to run 2+ flash movies in the same html page. You can see the essential files here: http://www.vgfx4.com/test/embedVideo.htm
If you view source you'll see what's going on. It shoud pull in: http://www.vgfx4.com/test/loader.swf & http://www.vgfx4.com/test/loader2.swf which, in turn, test real-world modem speed by loading a random small image: http://www.vgfx4.com/test/testModem.jpg & http://www.vgfx4.com/test/testModem2.jpg
Depending on the modem speed the swfs then pull in a video from a folder identified in the path variable sent to the swf file in the src attribute/param:
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/...version=7,0,0,0" width="100%" height="100%">
<param name="movie" value="loader.swf?path=themes">
<param name="autoplay" value="true"/>
<param name="salign" value="LT">
<param name="quality" value="high">
<param name="scale" value="noscale">
<embed src="loader.swf?path=themes" width="100%" height="100%" autoplay="true" salign="LT" quality="high" scale="noscale" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
An example video that eventually gets played might be: http://www.vgfx4.com/test/themes/videoBB.swf and it works fine when one video is loaded in, eg:
http://www.vgfx4.com/test/embedVideo_oneOnly.htm
But Internet Explorer crashes (IE 6, WIN XP or 2000) with a memory read error, as you may have got from the first link, when trying to load 2 movies I suspect this is due to the two movies trying to read the same bit of data: ie, one locks it and the other crashes. But I've changes all the files so they actually reference different files (hence testModem ¦ testModem2 etc).
Can't work out what the problem is: which is irritating, given this follows lots of careful planning of how to set this up as these files are just tests which need to be coded into a content management system which must be able to output webpages with more than one video! Otherwise I'm out of a job...
Can you help!? Thanks in advance,
James.
Particles Using AS...
Hi all,
I first posted this in the 3d forums, but I got answers saying this effect was made with actionscript so...
Is it possible to achieve something close to the effect on dennis interactive's website (here). I'm talking about the particles in the upper left corner (they appear before the name of the section you're visiting). If you could just hint me a little code so I get started in the right direction I would be very grateful.
Thanks in advance,
-Laz
Particles?
http://www.theimageplace.net/uploads/1bd54350d3.swf
Click to create smoke and embers.
Using movie clips for the fire ember makes the flash very slow. Could I speed it up using some kind of particle system?
Thanks!
Particles In AS3?
Hey all...
I've been trying to update my particle generator from AS2 to AS3 but am just not able to get it working... Any hints would be greatly appreciated...
So far I'm getting no errors but also no results... here's what I have now:
Code:
//variables
var vOldX=0;
var vOldY=0;
var vNextID=0;
//the life of line
var vMax=20
var vT=0;
addEventListener(Event.ENTER_FRAME , ParticleSystem);
function ParticleSystem(evt:Event):void {
vY=Math.sin(vT/41+0.4)*Math.sin(vT/9)*Math.sin(vT/13+2)*150;
vX=Math.sin(vT/53)*Math.sin(vT/7+1)*Math.sin(vT/10)*150;
vT++;
attachMovie("mlinea","iLine"+vNextID,vNextID);
setProperty("iLine"+vNextID,_x,vOldX);
setProperty("iLine"+vNextID,_y,vOldY);
setProperty("iLine"+vNextID,_xscale,vX-vOldX);
setProperty("iLine"+vNextID,_yscale,vY-vOldY);
vOldX=vX;
vOldY=vY;
vIndex=vNextID;
vCount=0;
while(vCount<vMax) {
setProperty("iLine"+vIndex,_alpha,100-(vCount*100/vMax))
vIndex--; if (vIndex<0) vIndex=vMax-1;
vCount++;
}
vNextID++; if(vNextID>=vMax) vNextID=0;
}
Help With Particles
I'm trying to make a basic particle system and am running into a pretty simple problem I just can't seem to find the answer to. For some reason none of the particles are moving. Here is my basic code just to start:
onClipEvent (enterFrame) {
i = 0;
totalParticles = 10;
gravity = 1;
}
onClipEvent (enterFrame) {
for (i; i<totalParticles;i++) {
attachMovie ("particle", "particle" + i, i);
_root.emitter["particle"+i].xSpeed = random(5);
_root.emitter["particle"+i].ySpeed = -5;
_root.emitter["particle"+i].onEnterFrame = function () {
ySpeed = ySpeed + gravity;
this._x += xSpeed;
this._y += ySpeed;
}
}
}
I'm sure the answer is pretty easy I just can't seem to see it. Thanks in advance.
Particles: Help
Hi
I'm really new to this actionscript game and even newer to actionscript 3, but i desperately need some help with something my brain just doesn't want to grasp. I am trying to change some open source code for a particle effect that makes some really nice snow. The source code uses a coded circle to generate the snowey effect, however i want to have a customised snowflake so i want to change the code so that it uses a movieclip to generate the snow.
Here is the .as code as i have changed it (i commented out the original):
Quote:
package
{
import flash.display.*;
import flash.geom.Rectangle;
import flash.filters.BlurFilter;
public class SnowFlake extends Sprite
{
// the x and y velocity of the snowflake
public var xVel:Number;
public var yVel:Number;
// the size of the snowflake
public var size:Number ;
// and the limits of the screen
public var screenArea:Rectangle;
//adds displayobject for particle
//public var clipisplayObject;
public function SnowFlake(screenarea:Rectangle, spriteclass : Class/*, targetclip : DisplayObjectContainer*/)
{
// instantiate a new particle graphic
screenArea = new spriteclass();
// and add it to the stage
//targetclip.addChild(clip);
// FIRST THINGS FIRST!
// let's draw a little dot.
//graphics.lineStyle(3,0xffffff);
//graphics.moveTo(0,0);
//graphics.lineTo(0.2,0.2);
//graphics.beginFill(0xffffff,1);
//graphics.drawCircle(0,0,1.5);
//graphics.endFill();
And here is the .fla stuff:
Quote:
import flash.events.Event;
import flash.geom.Rectangle;
// first make an array to put all our snowflakes in
var snowFlakes : Array = new Array();
// and decide the maxium number of flakes we want
var numFlakes : uint = 200;
// and define a rectangle to store the screen dimensions in.
var screenArea:Rectangle = new Rectangle(0,0,900,675);
// start listening for an ENTER_FRAME event (the equivalent
// of the AS2 onEnterFrame function)
addEventListener(Event.ENTER_FRAME, frameLoop);
// and define the function that is called on an ENTER_FRAME event
function frameLoop(e:Event)
{
var snowflake : SnowFlake;
// if we don't have the maximum number of flakes...
if(snowFlakes.length<numFlakes)
{
// then make a new one!
snowflake = new SnowFlake(screenArea, spark);
// add it to the array of snowflakes
snowFlakes.push(snowflake);
// and add it to the stage
//addChild(snowflake);
}
I keep getting the error "TypeError: Error #1034: Type Coercion failed: cannot convert spark@1cd66179 to flash.geom.Rectangle.
at SnowFlake$iinit()
at SnowStorm_fla::MainTimeline/frameLoop()"
...and i have no idea what this means...
Please can someone help me??
Particles
Can anyone help me create rain. I found a snow tutorial
and still working on the rain.
thanks
Help With Particles
I'm trying to make a basic particle system and am running into a pretty simple problem I just can't seem to find the answer to. For some reason none of the particles are moving. Here is my basic code just to start:
onClipEvent (enterFrame) {
i = 0;
totalParticles = 10;
gravity = 1;
}
onClipEvent (enterFrame) {
for (i; i<totalParticles;i++) {
attachMovie ("particle", "particle" + i, i);
_root.emitter["particle"+i].xSpeed = random(5);
_root.emitter["particle"+i].ySpeed = -5;
_root.emitter["particle"+i].onEnterFrame = function () {
ySpeed = ySpeed + gravity;
this._x += xSpeed;
this._y += ySpeed;
}
}
}
I'm sure the answer is pretty easy I just can't seem to see it. Thanks in advance.
Spraying Particles
hey, in my game the player gets to chainsaw through a desk, and for the duration of the chainsawing, i want brown "sawdust", or particles, flying off to the left in kind of a random way, but still somewhat controlled (i want them shooting off to the left, only going so far before they disappear, and if they had a bit of an arc to them, that would be even better... but that's asking for a bit much, so i'm not expecting that).
what would the script be for this? or does anyone have any examples? anything's good. and thanks a lot for any help i get, you guys kick ass.
Making Particles.. I Just Don't Get It
I read through about 100 posts vaguely related to particles and I didn't find a one that talked about how to do it. I looked through the tutorials and movies, too. The effect I want is tons of little glowie particles floating around randomly, kind of what you'd expect to see near a bunch of faeries in a forest. Know what I mean?
I have Flash 5- is there even a way to do this fabulous effect??
Thanks!
3d In Flash, Particles... Any Help...
Hey all. I just saw this site today http://www.kigot.com/ and it blew my mind. I was just wondering if anyone out there had any ideas as to how the particle effects are created or the 3d monitor menu. I'm realyl interested in the 3d. I don't know much about 3d in flash... is that just a movie they rendered and imported the frames from? wow.
[F8] Random Particles From Btm To Top?
Hi,
I have this code to make random particles for sum beer.
The code is
onClipEvent (load) {
this._x = Math.random()*-360;
this._y = Math.random()*240;
speed = Math.floor(Math.random()*3)+6;
variation = Math.floor(Math.random()*4)+1;
}
onClipEvent (enterFrame) {
this._x += this.variation;
if (this._y > 240) {
this._y = 0;
}
if (this._x > 320) {
this._x = 0;
}
}
Thing is I can't figure out how to make the dots go fm btm to top!
Can anyone help?
It'd be much appreciated!!
Thanks!!
Optimizing Particles In AS3
Hi Guys
I have a quick question for you all. I'm in the middle of developing a shooter which has a particle class that is spawning a lot of movieclip instances (all of which are vector art). Is there any way to optimize particles in AS3 to improve speed/performance (without destroying any of the older instances)? I've noticed things get a little sluggish when there's 250+ instances.
If there's no alternative then I was thinking of killing off old instances and recycling them, but I'm hoping to avoid that.
Any ideas?
Drawing With Particles
I have an idea for an ecard, but My version use hand made animation of falling snowflakes to form a pine tree...I wonder if an AS version could be more fluid, since my version use a lot of resources from the machine...
What kind of subject should I search in the forum? how is this called?
How To Create Particles?
HI
When I saw this experiment for the first time, I wondered, how was it made.
I think I'll need one enterFrame event, for loop, bitmapdata, bitmap, some effects, little of math,...
Did I missed something?
I had never written that kind of experiment before, especialy not in AS3...
So I'm asking you, how to achieve something like this?
I need just one starting point, for example one curve, that follows the mouse at different angles.
Thanks for now.
mloncaric
Particles Animation
Hello. I'm trying to create an animated piece that looks like particles of dust flying around in a container (which is a vector shape). The particles would bounce off the sides of the container while flying around inside. Could anyone send me an example of the script I would use to duplicated and animate randomly a movieclip and also detect sides of the container's shape?
thanks in advance,
Christy
Best Way To HitTest Particles?
I've set up a small mostly AS 2.0 particle engine, its pretty neat. My one problem is this: I want to make them hitTest walls/floors. I can do the actual hitTests just fine, the problem is that at a low velocity they just get stuck within the walls/floor, and just fall through slowly. Is there any good way avoid this?
Note: I am essentially remaking the engine in my signature in AS 2.0.
Square Particles
Hey im tryin to make a web site with dreamweaver and some flash integraton, but there is a problem i have not used flash very much. Anyway i was wondering if anyone could help me with my site.
I want to know how to make a flash effect that has square particles appearing around an object, text in my case, aligned in a grid. It is something similar to the flash effect on this site, the background grids;
http://www.templatemonster.com/show....g2=&order=date
Please help.
Is there a place where i can learn layers and what action script to use?
P.S. If anyone else has any neat ideas for my site feel free to shout em out. Its a Computer business called Lucent.
PEACE
Spining Particles
Hey there flashers, i know for some of you this must be a stupid question but i was wondering if you could tell me how to create spinning particles animation??? Pls
Let's Learn About Particles
Does anybody know how to construct a particle emitter that emits particles that follow a set motion guide.
Thanks in advance.
Blackfire
P.S Future questions to come in regards to flash particle emission. Also I have a particle emitter to work with if that helps.
Flash Particles
recently i have been trying to get into particles with actionscript and flash, however i can't seem to find any good material out there, does anyone know any links that might help
thanks
Best Way To HitTest Particles?
I've set up a small mostly AS 2.0 particle engine, its pretty neat. My one problem is this: I want to make them hitTest walls/floors. I can do the actual hitTests just fine, the problem is that at a low velocity they just get stuck within the walls/floor, and just fall through slowly. Is there any good way avoid this?
Note: I am essentially remaking the engine in my signature in AS 2.0.
How To Create Particles?
HI
When I saw this http://lab.andre-michelle.com/color-traces experiment for the first time, I wondered, how was it made.
I think I'll need one enterFrame event, for loop, bitmapdata, bitmap, some effects, little of math,...
Did I missed something?
I had never written that kind of experiment before, especialy not in AS3...
So I'm asking you, how to achieve something like this?
I need just one starting point, for example one curve, that follows the mouse at different angles.
Thanks for now.
mloncaric
Fireflies (Particles)
I'm looking for a good tutorial for a particle effect where 20 or so glowing spheres swarm around an object sort of like fireflies around a light.
I've looked around the net and have found some, but not exactly what I'm looking for... any thoughts?
Thanks,
Josh
How To Create An Effect Of Particles....
how to create an effect of particles that follows a path
- supposing - i do one mc - and run int w/o actionscript
in a path - how to dublicate it (supposing 10 rows of
that same mc and make it run continious)
or there is a full ascript way ?
- please if u have fla or something drop to
naim@netlux.org
3D Particles Rotating Around A Pivotpoint
Hi, I'm hoping some of you readers are familiar with Robert Penner's Vector3d and Particle3d. I'm currently creating a 3d engine with those classes in MX 2004 Pro but I've encountered a problem: when I rotate my particles they pivot around the "camera". I'd like to rotate them around the center of the group, a pivotpoint.
So now I'd like to create an extra Vector3d to my array of Particle3d's that works like a pivotpoint. All particles should rotate around that point so they form a group. This way I could create many groups that rotate around their own pivotpoint and I should be able to animatie the pivotpoints to animate the "camera" through 3d-space.
I've tried to solve this problem by looking at Penner's Particle wall example and I noticed this:
Code:
x = width * (i / xDivisions - .5);
Now i'm not much for a mathemagician but i'm quite sure the pivotpoint is being set up here. I just can't seem to grasp the theory behind it.
Could anyone help me out here?
So I'd like to create another Vector3d as a pivotpoint around wich a collection of particles should rotate.
click here
Thanks a lot! - Mediamonkey
Seamless Loop Of Particles
Im using adobe after effects to bounce some particles around in an orb. So far the best way to go about it for me has been using trapcodes particle filter. But I cant get it to seamlessly loop. Can anybody help me?
heres my orb im trying to loop
http://www.geocities.com/kendall_cole/particle_orb.avi
Floating Then Steeling Particles
I need to create a 'Snowglobe'... Don't need graphics (can do that), what I need is the script to make the 'Snowflakes' do their thing. IE:
A number of 'particles' which lie at the bottom until 'shaken', than swirl around randomly until eventually settling back to the bottom as a result of 'gravity'.
Can anyone point me in the direction of any suiatbel resource
Thanks in advance...
Turbulence... 100000 Particles By 18 FPS.
...hopefully!
Inspired by an example Keith Peters has done a while ago, I played arround with particles.
My results end up in a snippet called "turbulence". This little toy should
handle up to 100000 particles by 18FPS. In my example I just used 10000
particles ´cause it looks nicer on the effect that ist shown.
Want to play with it? Here you go
Maybe you just want to grap the sources
Some feedback would be nice...
drek
Clarification Question For Particles
quick (i hope) question about particles:
say i have a movie clip called "marble", i want to use a particle system and say i have nothing on my stage. i can pull instances of the move clip "marble" on to my stage by creating a variable holder which will serve as the instance of my movie clip, followed by an addChild method.
ie:
Quote:
var theMarble:marble = new marble;
addChild(theMarble);
now if i understand this correct "theMarble" is now the instance name of the movie clip "marble", which i have pulled on to the stage.
so if i wanted to add properties and functions to the marble, now pulled on to my stage when previewed as a swf, i can.
ie:
Quote:
theMarble.x = stage.stageWidth/2;
theMarble.y = stage.stageWidth/2;
//places marble in center of stage
but say i create an array and add multiple marbles- say 20- to my stage? what are the instance names of first "theMarble" and the subsequent ones after that? are they all "theMarble" or does flash label them something like "theMarble1", "theMarble2", "theMarble3", etc?
thanks for satisfying my curiosity!
`shields
Removing Particles From Game
Hey everyone!
This is my first question that i'm posting concerning flash so bare with me if i'm doing something completely wrong.
I'm making a game and i would like to create a particle based exhaust and some other particle elements. I did manage to remove the particles after they reach alpha <= 0 but my game still starts lagging quite quickly if i use continuous particles for my exhaust, and then snaps back to normal framerate after a while. You can se the unfinished game and the lag problem here. www.blulinedesign.com/flash1.html
I have a particle class and the class gets run by if (down) {...} else {fireParticles} so unless you hold the key down, the particles run. Here is my particle class.
PHP Code:
package {
import flash.display.Sprite;
import flash.events.Event;
public class Particle2 extends Sprite {
private var _xpos:Number;
private var _ypos:Number;
private var _xvel:Number;
private var _yvel:Number;
private var _grav:Number;
private var _col:Number;
private var _SW:Number;
private var _SH:Number;
public function Particle2(xpos:Number,ypos:Number,xvel:Number,yvel:Number,grav:Number,col:Number,SW:Number,SH:Number):void {
_xpos = xpos;
_ypos = ypos;
_xvel = xvel;
_yvel = yvel;
_grav = grav;
_col = col;
_SW = SW;
_SH = SH;
createParticle();
}
private function createParticle():void {
var P:ParticleGraphics2 = new ParticleGraphics2();
P.x = _xpos;
P.y = _ypos;
P.scaleX = P.scaleY = Math.random() * 1.5 + 0.2;
P.alpha = 0.6;
P.addEventListener(Event.ENTER_FRAME, moveParticle);
this.addChild(P);
}
private function moveParticle(evt:Event):void {
_yvel += _grav;
_xpos += _xvel;
_ypos += _yvel;
evt.target.x = _xpos;
evt.target.y = _ypos;
evt.target.scaleX *= 0.8;
evt.target.scaleY *= 0.8;
evt.target.alpha *= 0.6;
if (evt.target.alpha <= 0.1) {
this.killParticle();
}
}
// THIS IS WHERE I REMOVE IT
public function killParticle() {
if (this.parent != null ) {
this.parent.removeChild(this);
}
}
}
}
here is the relevent part in .fla
PHP Code:
function fireParticles2(posX:Number, posY:Number):void {
for (var i:uint=0; i<10; i++) {
var P2:Particle2 = new Particle2(posX,posY,
-7-Math.random()*5,
4-Math.random()*5,
0,0xFF0000,SW,SH);
addChild(P2);
particles2Array[i] = P2;
P2.filters = [new BlurFilter(12,12,1)];
}
}
and if/else statement(in .fla also)
PHP Code:
if (down) {
ship.y += shipSpeed;
shipVelY += 0.5;
ship.rotation = +3;
} else {
ship.rotation = 0;
fireParticles2(evt.target.x - 50, evt.target.y +7);
}
If any of you could please shed some light on this I would be very grateful!
Thank you!
Mouse Evetn For My Particles
Hi Guys ,
I'm stuck in my particles code . On my event I want my ball to bounce, when is not happenning right away. I'hv attached a zip for it .
Help me out pls !
Saba
Particles: Sparks-Effect
Hi
Im looking for a Spark-Effect but cant find a good one.
I found this one but its actualy to fast and big and .... loud. I'm looking for a small Spark-Effect that simulates an electric Cable thats sparks. So it has to spark sometimes... wait for a second... than again and so on...
I searched the whole Flashkit-Libary for Particle-Systems but they were not what Im looking for.
Did yomeone know a script where I can find something like this?
bye
Particles Move On MouseOver
I know I am a new member but hopefully my question won't be overlooked because of this fact. Anyway, here goes. I have a new project, a flash intro, and my client wants to be able to wipe away sand particles to reveal an enter website button. I tried an simple method of wiping away a image layer like an eraser but they want it to look like actual sand particles are moving around. Is there an easy solution to this?
Random Particles Genorator
Hey dudes
Anyone know the code on how to make a explosion of particles of random shapes that explodes outwards?
Cheers
Hey Kirupa, Sticky Particles
An interesting accident!
I was messing around with a pseudo-3d collision prototype, attempting to create a friction/inertia system, and I ended up with a kinda cool sitcky effect.
Sticky Particles
Click on the movie to regnerate the effect. It creates 10 particles in a z-index based 3d environment with random positioning and random motion vectors. The interesting thing is how my attempt at friction emulation created a stickiness. The particles almost seem to mimic atoms forming molecules!
I'm sure the code could be optimized, it is really just an accident!
ActionScript Code:
friction=0.005;MovieClip.prototype.moveRandom=function(){this.vx=0;this.vy=0;this.va=0;while(this.vx==0){this.vx=Math.round((Math.random()*2-1)*((Math.random()*16)+16));}while(this.vy==0){this.vy=Math.round((Math.random()*2-1)*((Math.random()*16)+16));}while(this.va==0){this.va=Math.round((Math.random()*2-1)*((Math.random()*4)+4));}this.onEnterFrame=function(){this.swapDepths(this._xscale);this.vx=this.vx<0?this.vx+_root.friction:this.vx-_root.friction;this.vy=this.vy<0?this.vy+_root.friction:this.vy-_root.friction;this.va=this.va<0?this.va+_root.friction:this.va-_root.friction;this.vx=Math.abs(this.vx)>0.1?this.vx:0;this.vy=Math.abs(this.vy)>0.1?this.vy:0;this.va=Math.abs(this.va)>0.1?this.va:0;thisone=this;for(p=1;p<_root.particlecount;p++){if(_root[p]!=thisone){//if(thisone.hittest(_root[p]) && Math.abs(thisone._xscale-_root[p]._xscale)<20){if(Math.pow(thisone._x-_root[p]._x,2)+Math.pow(thisone._y-_root[p]._y,2)+Math.pow(thisone._xscale-_root[p]._xscale,2)<=(thisone._xscale/100*1600)+(_root[p]._xscale/100*1600)){_root[p].vx=thisone.vx=(_root[p].vx+thisone.vx)/2;_root[p].vy=thisone.vy=(_root[p].vy+thisone.vy)/2;_root[p].va=thisone.va=(_root[p].va+thisone.va)/2;_root[p].vx*=-1;_root[p]._x+=_root[p].vx;_root[p].vy*=-1;_root[p]._y+=_root[p].vy;_root[p].va*=-1;_root[p]._xscale+=_root[p].va;_root[p]._yscale=_root[p]._xscale;thisone.vx*=-1;thisone._x+=_root[p].vx;thisone.vy*=-1;thisone._y+=_root[p].vy;thisone.va*=-1;thisone._xscale+=thisone.va;thisone._yscale=thisone._xscale;}}}if(this._x+this.vx>Stage.width-this._width/2 || this._x+this.vx<this._width/2){this.vx*=-1;this._x+=this.vx;}if(this._y+this.vy>Stage.height-this._height/2 || this._y+this.vy<this._height/2){this.vy*=-1;this._y+=this.vy;}if(this._xscale>=100 || this._xscale<=10){this.va*=-1;this._xscale+=this.va;this._yscale=this._xscale;}this._x+=this.vx;this._y+=this.vy;this._xscale+=this.va;this._yscale+=this.va;updateAfterEvent();};};particlecount=10;balls=['0xff0000','0xffff00','0x800080','0x800000','0x0000ff','0x000000','0x006400','0xe6e6e6','0xff0000','0xffff00'];for(p=1;p<=particlecount;p++){_root.createEmptyMovieClip(p,p);with(_root[p]){a=b=40;colors =[ 0xffffff,0x0000ff ];alphas =[ 100,100 ];ratios =[ 0,255 ];matrix ={matrixType:'box',x:-a/1.5,y:-b*1.5,w:a*2,h:b*2,r:(90/180)*Math.PI };lineStyle(1,0x0000ff,0);beginGradientFill('radial',colors,alphas,ratios,matrix );j=a*0.70711;n=b*0.70711;i=j-(b-n)*a/b;m=n-(a-j)*b/a;moveTo(a,0);curveTo(a,-m,j,-n);curveTo(i,-b,0,-b);curveTo(-i,-b,-j,-n);curveTo(-a,-m,-a,0);curveTo(-a,m,-j,n);curveTo(-i,b,0,b);curveTo(i,b,j,n);curveTo(a,m,a,0);endFill();_x=Math.ceil(Math.random()*(Stage.width-_xscale)+_xscale/2);_y=Math.ceil(Math.random()*(Stage.height-_yscale)+_yscale/2);_xscale=_yscale=Math.ceil(Math.random()*90)+10;}_root[p].moveRandom();}
Square Particles Timing
Hey I am trying to create a web site using flash. I have these square particles i want to come on when I open the browser, loop 2 times and then stop. I can figure out how to do this. Please help me.
I put on what i have so far so that you can get an idea of what i want.
Peace
Help: Particles> Fire Embers
Hi everyone, I am new here.
I run a small web design business, and I am making an intro for a Audio Video studio website. I have everything I need except during the intro, I need fire emberss raising up from the bottom.
the window is 648x486 and I want the embers to start at the bottom, and come up about 75% of the hight, and spread about 70% of the width of the movie starting from the middle (so they dont fly off the left and right side of the window.) squiggly random movement but nice and slow and they need to burn out at random heights...
Ive been everywhere, I am novice with Action Script. I tried regular particle effects from Flashkit, but they either arn't compatible or not what I am looking for at all, and the snow tutorial here is a full screen deal, when I flip it so the snow goes up It just isnt what i'm looking for at all.
Can anyone help me out? I have spent days on this intro and really need this effect.
Thanks for all your help in advance.
-Jeff ' Snow
Help With Particles Heading To Target
Hey!
I got the following code online to make particles head to a specific location on screen. I can't get it to work, though, because i'm not sure where to put which part of the script. (ie on timeline or movieclip).
i can't get it to work.
can anyone help out? the script might be useful to others too!
thanks!
S
speed =20;
target_x= //some number
target_y= //some number
tanx= target_x-this._x;
tany= target_y-this._y;
radangle = Math.atan2(tany,tanx);
this._rotation = radangle*180/Math.PI; // this is to point it in the right direction if you need to
deltay = speed * Math.sin(radangle);
deltax = speed * Math.cos(radangle);
function bombTarget(){
if(deltax<0){
if(target_x < this._x){
this._x += deltax;
this._y += deltay;
}
if(this._x <= target_x ){
bombing = false;
gotoAndPlay(2);
}
}
if(deltax>0){
if(target_x > this._x){
this._x += deltax;
this._y += deltay;
}
if(this._x >= target_x){
bombing = false;
gotoAndPlay(2);
}
}
}
i have the function as bombtarget but you can change it to whatever you want.
onClipEvent(enterFrame){
if(bombing){
bombTarget();
}
}
Particles Gallexy Becomes ICON
Hi
I am making a site for a technology firm, and would like to make an effect where particles of different sizes float in a random fashion in a sort of saturn ring like orbit around a fixxed center... and then on a specific event (onRollOver) they all quickly arrange themselves into a specific shape (ie. an icon of home, mail, etc.).
I have attached an image of the what the effect would look like.
Any help appreciated.
[very] Quick And Dirty Particles
It's sunday and I'm pretty bored, so I just coded up some particles, it's nothing mind blowing, just fun for a few seconds, I added the source for anyone who wants to take a look.
go take a look
Problem Removing Particles
Hi,
I´m doing a movie that has a particles system and I have two timers, one to start the particles and another to stop, the first is working but the second gives me an error (Error #2025: The supplied DisplayObject must be a child of the caller.)
So I think that my problem is the line when I try to removeChild... can anyone help me?
Thanks,
Here's the code:
package{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.display.MovieClip;
import flash.display.DisplayObject;
public class ParticulasDemo extends Sprite
{
private var inicioX:Number;
private var inicioY:Number;
public function ParticulasDemo()
{
var minuteTimer:Timer = new Timer(1000, 6);
minuteTimer.addEventListener(TimerEvent.TIMER_COMP LETE, comecar);
minuteTimer.start();
}
public function comecar(event:TimerEvent):void
{
stage.addEventListener(Event.ENTER_FRAME, emRepeticao);
}
public function emRepeticao(e:Event):void
{
inicioX = 306;
inicioY = 266;
var particula = new Particula(inicioX, inicioY, Math.random()*11-6, Math.random()* -20, 1, Math.random()*0xFFFFFF);
addChild(p);
var minuteTimer1:Timer = new Timer(1000, 16);
minuteTimer1.addEventListener(TimerEvent.TIMER_COM PLETE, acabar);
minuteTimer1.start();
function acabar(event:TimerEvent):void
{
removeChild(p);
}
}
}
}
Random Particles Genorator
Hey dudes
Anyone know the code on how to make a explosion of particles of random shapes that explodes outwards?
Cheers
Hey Kirupa, Sticky Particles
An interesting accident!
I was messing around with a pseudo-3d collision prototype, attempting to create a friction/inertia system, and I ended up with a kinda cool sitcky effect.
Sticky Particles
Click on the movie to regnerate the effect. It creates 10 particles in a z-index based 3d environment with random positioning and random motion vectors. The interesting thing is how my attempt at friction emulation created a stickiness. The particles almost seem to mimic atoms forming molecules!
I'm sure the code could be optimized, it is really just an accident!
ActionScript Code:
friction=0.005;MovieClip.prototype.moveRandom=function(){this.vx=0;this.vy=0;this.va=0;while(this.vx==0){this.vx=Math.round((Math.random()*2-1)*((Math.random()*16)+16));}while(this.vy==0){this.vy=Math.round((Math.random()*2-1)*((Math.random()*16)+16));}while(this.va==0){this.va=Math.round((Math.random()*2-1)*((Math.random()*4)+4));}this.onEnterFrame=function(){this.swapDepths(this._xscale);this.vx=this.vx<0?this.vx+_root.friction:this.vx-_root.friction;this.vy=this.vy<0?this.vy+_root.friction:this.vy-_root.friction;this.va=this.va<0?this.va+_root.friction:this.va-_root.friction;this.vx=Math.abs(this.vx)>0.1?this.vx:0;this.vy=Math.abs(this.vy)>0.1?this.vy:0;this.va=Math.abs(this.va)>0.1?this.va:0;thisone=this;for(p=1;p<_root.particlecount;p++){if(_root[p]!=thisone){//if(thisone.hittest(_root[p]) && Math.abs(thisone._xscale-_root[p]._xscale)<20){if(Math.pow(thisone._x-_root[p]._x,2)+Math.pow(thisone._y-_root[p]._y,2)+Math.pow(thisone._xscale-_root[p]._xscale,2)<=(thisone._xscale/100*1600)+(_root[p]._xscale/100*1600)){_root[p].vx=thisone.vx=(_root[p].vx+thisone.vx)/2;_root[p].vy=thisone.vy=(_root[p].vy+thisone.vy)/2;_root[p].va=thisone.va=(_root[p].va+thisone.va)/2;_root[p].vx*=-1;_root[p]._x+=_root[p].vx;_root[p].vy*=-1;_root[p]._y+=_root[p].vy;_root[p].va*=-1;_root[p]._xscale+=_root[p].va;_root[p]._yscale=_root[p]._xscale;thisone.vx*=-1;thisone._x+=_root[p].vx;thisone.vy*=-1;thisone._y+=_root[p].vy;thisone.va*=-1;thisone._xscale+=thisone.va;thisone._yscale=thisone._xscale;}}}if(this._x+this.vx>Stage.width-this._width/2 || this._x+this.vx<this._width/2){this.vx*=-1;this._x+=this.vx;}if(this._y+this.vy>Stage.height-this._height/2 || this._y+this.vy<this._height/2){this.vy*=-1;this._y+=this.vy;}if(this._xscale>=100 || this._xscale<=10){this.va*=-1;this._xscale+=this.va;this._yscale=this._xscale;}this._x+=this.vx;this._y+=this.vy;this._xscale+=this.va;this._yscale+=this.va;updateAfterEvent();};};particlecount=10;balls=['0xff0000','0xffff00','0x800080','0x800000','0x0000ff','0x000000','0x006400','0xe6e6e6','0xff0000','0xffff00'];for(p=1;p<=particlecount;p++){_root.createEmptyMovieClip(p,p);with(_root[p]){a=b=40;colors =[ 0xffffff,0x0000ff ];alphas =[ 100,100 ];ratios =[ 0,255 ];matrix ={matrixType:'box',x:-a/1.5,y:-b*1.5,w:a*2,h:b*2,r:(90/180)*Math.PI };lineStyle(1,0x0000ff,0);beginGradientFill('radial',colors,alphas,ratios,matrix );j=a*0.70711;n=b*0.70711;i=j-(b-n)*a/b;m=n-(a-j)*b/a;moveTo(a,0);curveTo(a,-m,j,-n);curveTo(i,-b,0,-b);curveTo(-i,-b,-j,-n);curveTo(-a,-m,-a,0);curveTo(-a,m,-j,n);curveTo(-i,b,0,b);curveTo(i,b,j,n);curveTo(a,m,a,0);endFill();_x=Math.ceil(Math.random()*(Stage.width-_xscale)+_xscale/2);_y=Math.ceil(Math.random()*(Stage.height-_yscale)+_yscale/2);_xscale=_yscale=Math.ceil(Math.random()*90)+10;}_root[p].moveRandom();}
Random Particles To Solid
I'm trying to figure out how I might achieve the reverse of Andy Fould's beautiful photo transition effect (http://www.andyfoulds.co.uk)...
basically I want a number of particles (squares) to begin small and invisible and then each have a random path and velocity as it scales to 100% and alphas in to form a larger, solid background. My main problem is with randomizing its movement from one place (random position on the stage) to its final destination (each square next to one another to form a solid). Any help would be much appreciated.
derek
[AS3] Turbulence... 100000 Particles By 18 FPS.
...hopefully!
Inspired by an example Keith Peters has done a while ago, I played arround with particles.
My results end up in a snippet called "turbulence". This little toy should
handle up to 100000 particles by 18FPS. In my example I just used 10000
particles ´cause it looks nicer on the effect that ist shown.
Want to play with it? drekHere you go
Maybe you just want to grap the sources
Some feedback would be nice...
Regards
drek
Making Particles Clickable
How do you make particles in Actionscript Physics Engine (APE) clickable and draggable?
All I get is a compiler error that says my variable (c5) is undefined. WTF?
Code:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import org.cove.ape.*;
public class ApeTest extends Sprite {
public function ApeTest() {
stage.frameRate = 60;
addEventListener(Event.ENTER_FRAME, run);
APEngine.init(1/4);
APEngine.container = this;
APEngine.addMasslessForce(new Vector(0,5));
var defaultGroup:Group = new Group();
defaultGroup.collideInternal = true;
var c5:CircleParticle = new CircleParticle(240,200,5,false,5,.4);
defaultGroup.addParticle(c5);
var r5:RectangleParticle = new RectangleParticle(240,100,5,1,0,true);
defaultGroup.addParticle(r5);
var s5:SpringConstraint = new SpringConstraint(c5,r5,1,false,3);
defaultGroup.addConstraint(s5);
APEngine.addGroup(defaultGroup);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onClick);
// stage.addEventListener(MouseEvent.MOUSE_UP, onRelease);
}
private function onClick(evt:Event):void{
//THIS IS THE OFFENDING CODE!!!
c5.position = new Vector(stage.mouseX,stage.mouseY);
}
private function run(evt:Event):void {
APEngine.step();
APEngine.paint();
}
}
}
Any help would be appreciated.
Thanks.
-Chris
Moving Particles Through Action Script
Hi all,
I'm trying to make a simple Action Script were particles can be controlled in speed (velocity_input_var) and quantity (amount_input_var) in simply moving from left to right over the screen.
I found this nice .fla which does a bit of the trick. But being a newbee I can't strip the code to it's essentials.
I don't need the green buttons and all the fancy movements.
Just moving from left to right on the screen would do.
Can anybody help me?
Here's the URL were you can find particle.fla
http://home.hccnet.nl/m.dijk/particle/
ThanX !!!
|