1 import java.util.Iterator;
2 class JackieSquares extends SCPattern {
3 private BasicParameter rateParameter = new BasicParameter("RATE", 0.25);
4 private BasicParameter attackParameter = new BasicParameter("ATTK", 0.3);
5 private BasicParameter decayParameter = new BasicParameter("DECAY", 0.2);
6 private BasicParameter saturationParameter = new BasicParameter("SAT", 0.7);
8 SinLFO hueMod = new SinLFO(0, 360, 4000);
9 SinLFO spreadMod = new SinLFO(1, 10, 8000);
19 f = model.faces.get(n % model.faces.size());
21 boolean infiniteAttack = (attackParameter.getValuef() > 0.999);
22 hasPeaked = infiniteAttack;
23 value = (infiniteAttack ? 1 : 0);
26 // returns TRUE if this should die
27 boolean age(double ms) {
29 value = value + (float) (ms / 1000.0f * ((attackParameter.getValuef() + 0.01) * 5));
36 value = value - (float) (ms / 1000.0f * ((decayParameter.getValuef() + 0.01) * 10));
42 private float leftoverMs = 0;
43 private List<FaceFlash> flashes;
44 private int faceNum = 0;
46 public JackieSquares(LX lx) {
48 addParameter(rateParameter);
49 addParameter(attackParameter);
50 addParameter(decayParameter);
51 addParameter(saturationParameter);
52 addModulator(hueMod).trigger();
53 addModulator(spreadMod).trigger();
55 flashes = new LinkedList<FaceFlash>();
58 public void run(double deltaMs) {
59 leftoverMs += deltaMs;
60 float msPerFlash = 1000 / ((rateParameter.getValuef() + .01) * 100);
61 while (leftoverMs > msPerFlash) {
62 leftoverMs -= msPerFlash;
63 faceNum += int(spreadMod.getValuef());
64 flashes.add(new FaceFlash(faceNum));
67 for (LXPoint p : model.points) {
71 for (FaceFlash flash : flashes) {
72 float hue = (hueMod.getValuef() + flash.hue) % 360.0;
73 color c = lx.hsb(hue, saturationParameter.getValuef() * 100, (flash.value) * 100);
74 for (LXPoint p : flash.f.points) {
79 Iterator<FaceFlash> i = flashes.iterator();
81 FaceFlash flash = i.next();
82 boolean dead = flash.age(deltaMs);
91 class JackieLines extends SCPattern {
92 private BasicParameter rateParameter = new BasicParameter("RATE", 0.25);
93 private BasicParameter attackParameter = new BasicParameter("ATTK", 0.3);
94 private BasicParameter decayParameter = new BasicParameter("DECAY", 0.2);
95 private BasicParameter saturationParameter = new BasicParameter("SAT", 0.7);
97 SinLFO hueMod = new SinLFO(0, 360, 4000);
98 SinLFO spreadMod = new SinLFO(1, 10, 8000);
108 f = model.strips.get(n % model.strips.size());
110 boolean infiniteAttack = (attackParameter.getValuef() > 0.999);
111 hasPeaked = infiniteAttack;
112 value = (infiniteAttack ? 1 : 0);
115 // returns TRUE if this should die
116 boolean age(double ms) {
118 value = value + (float) (ms / 1000.0f * ((attackParameter.getValuef() + 0.01) * 5));
125 value = value - (float) (ms / 1000.0f * ((decayParameter.getValuef() + 0.01) * 10));
131 private float leftoverMs = 0;
132 private List<StripFlash> flashes;
133 private int stripNum = 0;
135 public JackieLines(LX lx) {
137 addParameter(rateParameter);
138 addParameter(attackParameter);
139 addParameter(decayParameter);
140 addParameter(saturationParameter);
141 addModulator(hueMod).trigger();
142 addModulator(spreadMod).trigger();
144 flashes = new LinkedList<StripFlash>();
147 public void run(double deltaMs) {
148 leftoverMs += deltaMs;
149 float msPerFlash = 1000 / ((rateParameter.getValuef() + .01) * 100);
150 while (leftoverMs > msPerFlash) {
151 leftoverMs -= msPerFlash;
152 stripNum += int(spreadMod.getValuef());
153 flashes.add(new StripFlash(stripNum));
156 for (LXPoint p : model.points) {
160 for (StripFlash flash : flashes) {
161 float hue = (hueMod.getValuef() + flash.hue) % 360.0;
162 color c = lx.hsb(hue, saturationParameter.getValuef() * 100, (flash.value) * 100);
163 for (LXPoint p : flash.f.points) {
168 Iterator<StripFlash> i = flashes.iterator();
169 while (i.hasNext()) {
170 StripFlash flash = i.next();
171 boolean dead = flash.age(deltaMs);
181 class JackieDots extends SCPattern {
182 private BasicParameter rateParameter = new BasicParameter("RATE", 0.15);
183 private BasicParameter attackParameter = new BasicParameter("ATTK", 0.3);
184 private BasicParameter decayParameter = new BasicParameter("DECAY", 0.2);
185 private BasicParameter saturationParameter = new BasicParameter("SAT", 0.7);
187 SinLFO hueMod = new SinLFO(0, 360, 4000);
188 SinLFO spreadMod = new SinLFO(1, 10, 16000);
198 f = model.points.get(n % model.points.size());
200 boolean infiniteAttack = (attackParameter.getValuef() > 0.999);
201 hasPeaked = infiniteAttack;
202 value = (infiniteAttack ? 1 : 0);
205 // returns TRUE if this should die
206 boolean age(double ms) {
208 value = value + (float) (ms / 1000.0f * ((attackParameter.getValuef() + 0.01) * 5));
215 value = value - (float) (ms / 1000.0f * ((decayParameter.getValuef() + 0.01) * 10));
221 private float leftoverMs = 0;
222 private List<PointFlash> flashes;
223 private int pointNum = 0;
225 public JackieDots(LX lx) {
227 addParameter(rateParameter);
228 addParameter(attackParameter);
229 addParameter(decayParameter);
230 addParameter(saturationParameter);
231 addModulator(hueMod).trigger();
232 addModulator(spreadMod).trigger();
234 flashes = new LinkedList<PointFlash>();
237 public void run(double deltaMs) {
238 leftoverMs += deltaMs;
239 float msPerFlash = 1000 / ((rateParameter.getValuef() + .01) * 5000);
240 while (leftoverMs > msPerFlash) {
241 leftoverMs -= msPerFlash;
242 pointNum += int(spreadMod.getValuef());
243 flashes.add(new PointFlash(pointNum));
246 for (LXPoint p : model.points) {
250 for (PointFlash flash : flashes) {
251 float hue = (hueMod.getValuef() + flash.hue) % 360.0;
252 color c = lx.hsb(hue, saturationParameter.getValuef() * 100, (flash.value) * 100);
253 colors[flash.f.index] = c;
256 Iterator<PointFlash> i = flashes.iterator();
257 while (i.hasNext()) {
258 PointFlash flash = i.next();
259 boolean dead = flash.age(deltaMs);