001package com.ctre.phoenix.led; 002 003/** 004 * Animation that gradually lights the entire LED strip one LED at a time. 005 */ 006public class ColorFlowAnimation extends BaseTwoSizeAnimation { 007 /** 008 * What direction does the color go 009 */ 010 public enum Direction { 011 /** 012 * Color goes forward, away from CANdle 013 */ 014 Forward(0), 015 /** 016 * Color goes backward, toward CANdle 017 */ 018 Backward(1); 019 020 final public int value; 021 022 Direction(int value) { 023 this.value = value; 024 } 025 } 026 027 /** 028 * Constructor for a ColorFlowAnimation 029 * @param r How much red should the color have [0, 255] 030 * @param g How much green should the color have [0, 255] 031 * @param b How much blue should the color have [0, 255] 032 * @param w How much white should the color have [0, 255] 033 * @param speed How fast should the color travel the strip [0, 1] 034 * @param numLed How many LEDs is the CANdle controlling 035 * @param direction What direction should the color move in 036 */ 037 public ColorFlowAnimation(int r, int g, int b, int w, double speed, int numLed, Direction direction) { 038 super(0x62, r, g, b, w, speed, numLed, direction.value, 0); 039 } 040 /** 041 * Constructor for a ColorFlowAnimation 042 * @param r How much red should the color have [0, 255] 043 * @param g How much green should the color have [0, 255] 044 * @param b How much blue should the color have [0, 255] 045 */ 046 public ColorFlowAnimation(int r, int g, int b) { 047 this(r, g, b, 0, 1, -1, Direction.Forward); 048 } 049 050 /** 051 * Sets the direction the color flow moves in 052 * @param direction What direction should the color move in 053 */ 054 public void setDirection(Direction direction) { 055 setDirection(direction.value); 056 } 057}