Class AnimatedStroke

  • All Implemented Interfaces:
    java.awt.Stroke

    public class AnimatedStroke
    extends java.lang.Object
    implements java.awt.Stroke
    A Java2D basic stroke that also animates itself along the path of a shape it applied to. An animated stroke must have a dash pattern and a speed.
    • Constructor Detail

      • AnimatedStroke

        public AnimatedStroke()
      • AnimatedStroke

        public AnimatedStroke​(java.awt.Color c)
        Creates a default 1-pixel wide stroke that animates at a default speed. In order to get the animated effect, you must call the update() method on the AnimatedStroke instance, such as from inside a Layer's update() call.
        Parameters:
        c -
      • AnimatedStroke

        public AnimatedStroke​(java.awt.Color c,
                              float speed)
        Creates a default 1-pixel wide stroke that animates at the given speed. In order to get the animated effect, you must call the update() method on the AnimatedStroke instance, such as from inside a Layer's update() call.
        Parameters:
        c -
        speed -
    • Method Detail

      • getCap

        public int getCap()
      • setCap

        public void setCap​(int cap)
      • getColor

        public java.awt.Color getColor()
      • setColor

        public void setColor​(java.awt.Color color)
      • getDash

        public float[] getDash()
      • setDash

        public void setDash​(float[] dash)
      • getJoin

        public int getJoin()
      • setJoin

        public void setJoin​(int join)
      • getMiterLimit

        public float getMiterLimit()
      • setMiterLimit

        public void setMiterLimit​(float miterLimit)
      • getSpeed

        public float getSpeed()
      • setSpeed

        public void setSpeed​(float speed)
        Sets the speed for this stroke animation. Speed is expressed as in how many pixels per second will the animation go along the path.
        Parameters:
        speed - specifies number of pixels the animation moves along the path.
      • getWidth

        public float getWidth()
      • setWidth

        public void setWidth​(float width)
      • getMode

        public int getMode()
      • setMode

        public void setMode​(int mode)
        sets the animation mode to either MODE_ONEWAY (the default) or MODE_TWOWAY.
        Parameters:
        mode -
      • update

        public void update​(long elapsedTime)
      • getPhase

        public float getPhase()
      • getStroke

        public java.awt.Stroke getStroke()
      • createStrokedShape

        public java.awt.Shape createStrokedShape​(java.awt.Shape p)
        Specified by:
        createStrokedShape in interface java.awt.Stroke
      • setBackwardFlag

        public void setBackwardFlag​(boolean backwardFlag)
      • isBackwardFlag

        public boolean isBackwardFlag()