Fork me on GitHub
Not signed in (Sign In)
    • CommentAuthorradykal
    • CommentTimeAug 31st 2010 edited
    Hey guys,

    first of all a great compliment to Richard, amazing Particle Engine. So I played around with your Particle Engine and I would like to use it for some projects. But I have one questions:

    How can I ignore transparent pixels. I convert a movieclip into a bitmapdata object and give this one to the paramter of a createPixelParticlesFromBitmapData() method. Now when the emitter starts, I see also black particles, although the movieclip has only 2 white lines. This is my code:

    mc.visible = false;
    var bmd:BitmapData = new BitmapData(mc.width, mc.height, true, 0x00000000);

    emitter = new Emitter2D();
    renderer = new PixelRenderer(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));

    particles = Particle2DUtils.createPixelParticlesFromBitmapData(bmd, emitter.particleFactory, bmHolder.x, bmHolder.y);

    emitter.addInitializer(new Velocity(zone));
    emitter.addInitializer(new Lifetime(0.5, 1));
    emitter.addExistingParticles(particles, true);

    emitter.addAction(new Age(Sine.easeOut));
    emitter.addAction(new Move());
    emitter.addAction(new RandomDrift(-600, -600));
    emitter.addAction(new Fade(1, 0));
    emitter.addAction(new SpeedLimit(200));

    renderer.addFilter(new BlurFilter(2, 2, 1), false);


    I notice that I only see the black particles in combination with the Fade action.

    • CommentAuthorRichard
    • CommentTimeSep 1st 2010

    This happens because createPixelParticlesFromBitmapData() copies all pixels, including the transparent ones. The Fade method then changes the alpha of the particles to create the fade, which reveals the transparent pixels.

    I've added a couple of lines of code to the createPixelParticlesFromBitmapData() method to fix the problem (see line 124 here). This is committed to the GitHub repository and will be in the next full release.

    • CommentAuthorradykal
    • CommentTimeSep 1st 2010
    Awesome, no it works.

    I would like to use the subversion of git. I´m using svnX on Max, but it seems that´s not working. I already checked out any FAQ and tutorials but nothing works.

    Is this the correct subersion path:
    • CommentAuthorRichard
    • CommentTimeSep 2nd 2010 edited
    Yes, that's the correct path. However, since it's not really a subversion repository, it's rather a git repository being accessed by a conversion tool, it's not browsable. The only thing you can do is checkout the full repository. This should work from the command line -

    svn checkout

    I expect svnX is trying to browse the repository and show you what's in it. That unfortunately won't work.

    More (but not much more) here -
    • CommentAuthorradykal
    • CommentTimeSep 2nd 2010
    Ok thanks a lot. I really appreciate that you take time for answering question.
    I try to rebuild an effect of this website:

    Move mouse over the yellow buttons. The developers of this site said already that they used your engine for this effect.

    I was looking for an event which dispatch when moving the mouse over a particle and return the particle, but there is no one for it. You already implent a MouseAntiGravity action, but then the particles will not go back.
    So I dont want the exact code, only some tipps that show me the direction to develop something like that. :)

    • CommentAuthorRichard
    • CommentTimeSep 5th 2010
    I suspect they created a couple of custom actions - one to push particles away from the mouse if they are too close and the other to return them to their original position if otherwise.

    The former may be possible by simply adding a distance limit to the MouseAnitGravity action, and the latter by treating the original position as a personal gravity well for the particle. In both cases you'd require a lot of damping to make the particles stop quickly when they reach the target position.

    Ryan Hodson describes creating custom actions in his Flinteroids tutorial.