Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorTuric
- CommentTimeJul 26th 2010 edited
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.counters.Blast;
import org.flintparticles.common.energyEasing.Quadratic;
import org.flintparticles.common.events.ParticleEvent;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.twoD.actions.TweenToZone;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.Position;
import org.flintparticles.twoD.particles.Particle2D;
import org.flintparticles.twoD.renderers.PixelRenderer;
import org.flintparticles.twoD.zones.BitmapDataZone;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.particles.Particle2DUtils;
import org.flintparticles.twoD.renderers.*;
import org.flintparticles.twoD.zones.RectangleZone;
var flintImage:BitmapData = new FlintImage( 320, 80 );
var particlesImage:BitmapData = new FlintImage( 320, 80 );
var startEmitter:Emitter2D = new Emitter2D();
var particles:Array = Particle2DUtils.createPixelParticlesFromBitmapData( new FlintImage(337,225), startEmitter.particleFactory, 50, 75 );
startEmitter.addExistingParticles( particles, true );
startEmitter.counter = new Blast( 5000 );
startEmitter.addInitializer( new Lifetime( 10 ) );
startEmitter.addInitializer( new Position( new BitmapDataZone( flintImage, 40, 60 ) ) );
startEmitter.addAction( new Age( Quadratic.easeInOut ) );
startEmitter.addAction( new TweenToZone( new BitmapDataZone( particlesImage, 40, 60 ) ) );
var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, 500, 500 ) );
renderer.addEmitter( startEmitter );
addChild( renderer );
startEmitter.start();
I'm try to make animated logo, like at example, but add the color of the logo and transform of color clother to a destination object.
This code is work, but logo is going to be only black and white, what is need to be added to code? -
- CommentAuthorRichard
- CommentTimeJul 27th 2010
To modify the color during the tween, add a ColorChange action to the emitter. For examplestartEmitter.addAction( new ColorChange( 0xFFFF6600, 0xFF0000FF ) ); -
- CommentAuthorTuric
- CommentTimeJul 27th 2010 edited
Richard, thank for the answer and cool particle engine :)
But color change is give only 2 colors, i want to make full-colors particle change, try to illustrate idea at image:
http://ib1.keep4u.ru/b/2010/07/27/9a/9aee382aa648cb84fa15214d2aa3e60a.jpg -
- CommentAuthorRichard
- CommentTimeJul 28th 2010 edited
That will require a custom action. The action would store the original color and target color for each particle in the particle's dictionary and then transform the color using a similar algorithm to that used in the ColorChange action but using these two particle specific colors. -
- CommentAuthorTuric
- CommentTimeJul 28th 2010
action, like at http://flintparticles.org/forum/comments.php?DiscussionID=26&page=1#Item_0 ? -
- CommentAuthorRichard
- CommentTimeAug 3rd 2010 edited
Sort of. You'll probably want a custom Initializer to set the start and end colors for each particle and store these in the particle's dictionary, and then a custom action similar to the ColorChange action but using the particle specific colors to interpolate between these colors.
Ryan Hodson wrote an article which contains some examples of custom actions and initializers at http://slekx.com/2009/12/flinteroids-advanced-flint-tutorial/. -
- CommentAuthorTuric
- CommentTimeAug 4th 2010
thank a lot, i'll try it.
1 to 7 of 7
