Android Open Source - pixel-art Marching Ants

From Project

Back to project page pixel-art.


The source code is released under:

Apache License

If you think the Android project pixel-art listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jaween.pixelart.util;
/*from  w w  w .  j  a v a2s .  co m*/

import java.util.ArrayList;

 * Created by ween on 12/14/14.
public class MarchingAnts {

    private ArrayList<DashPathEffect> bees = new ArrayList<>();
    private int currentFrame = 0;

    public MarchingAnts(int dashOn, int dashOff, float dp) {
        for (int i = 0; i < dashOn + dashOff; i++) {
            int offset = (int) (i * dp);
            bees.add(new DashPathEffect(new float[]{ dashOn * dp, dashOff * dp }, offset));

    public DashPathEffect getNextPathEffect() {
        currentFrame = (currentFrame + 1) % bees.size();
        return bees.get(currentFrame);


Java Source Code List