void Reset() { amount = 0f; raising = true; color = PixelColor.FromHSL(Program.random.NextDouble(), 1.0, 0.5); }
public override void Draw() { spectrumPosition += 0.001; if (spectrumPosition > 1) { spectrumPosition -= 1; } PixelColor[,] m = new PixelColor[Program.TableWidth, Program.TableHeight]; for (int x = 0; x < Program.TableWidth; x++) { for (int y = 0; y < Program.TableHeight; y++) { double offset = (x * 0.01f) + (y * 0.01f); double p = spectrumPosition + offset; //Invert Touched Pixels if (Program.touchManager.GetInputAt(new Position(x, y))) { p += 0.5; } if (p > 1) { p -= 1; } m[x, y] = PixelColor.FromHSL(p, 1f, 0.5f); } } SetPixels(m); }
PixelColor GetColor(int index, int x, int y) { switch (animationType) { case "Regenbogen": return(PixelColor.FromHSL((Math.Sin((index * 0.01f) + colorFade) + 1) * .5f, 0.5, 0.5)); case "Zufall": return(PixelColor.FromHSL(Program.random.NextDouble(), 1.0, 0.5)); case "Gelb": return(PixelColor.YELLOW); case "Rot": return(PixelColor.RED); case "Grün": return(PixelColor.GREEN); case "Blau": return(PixelColor.BLUE); default: return(PixelColor.BLACK); } }
public override void Draw() { ClearPixels(); for (int x = 0; x < Program.TableWidth; x++) { for (int y = 0; y < Program.TableHeight; y++) { SetPixel(x, y, PixelColor.FromHSL(0.0, 0.0, midBrightness)); } } int dirStep = 0; int nextStep = 0; Position pos = new Position(0, 0); for (int i = 0; i < 36; i++) { float hsv = i / 36f + time; if (hsv > 1f) { hsv -= (float)Math.Floor(hsv); } SetPixel(pos.x, pos.y, PixelColor.FromHSL(hsv, 1f, 0.5)); if (dirStep == 0) { pos.x++; } else if (dirStep == 1) { pos.y++; } else if (dirStep == 2) { pos.x--; } else if (dirStep == 3) { pos.y--; } nextStep++; if (nextStep >= 9) { dirStep++; nextStep = 0; } } time += 0.015f / 10f; if (midBrightness > 0f) { midBrightness -= 0.08f / 10f; } }
public override void Draw() { int w = Program.random.Next(0, Program.TableWidth); int h = Program.random.Next(0, Program.TableHeight); float hue = Program.random.Next(100) / 100f; SetPixel(w, h, PixelColor.FromHSL(hue, 1f, 0.5f)); }
public override void Draw() { for (int i = 0; i < 50; i++) { SetPixelAtIndex(i, PixelColor.FromHSL((Math.Sin(time) + 1) * 0.5, 1.0, 0.5)); } for (int i = 50; i < 100; i++) { SetPixelAtIndex(i, PixelColor.FromHSL((Math.Cos(time) + 1) * 0.5, 1.0, 0.5)); } time += 0.01f; }
public override void Draw() { int dirStep = 0; int nextStep = 0; Position pos = new Position(0, 0); for (int i = 0; i < 36; i++) { float hsv = i / 36f + time; if (hsv > 1f) { hsv -= (float)Math.Floor(hsv); } SetPixel(pos.x, pos.y, PixelColor.FromHSL(hsv, 0.5f, 0.5)); if (dirStep == 0) { pos.x++; } else if (dirStep == 1) { pos.y++; } else if (dirStep == 2) { pos.x--; } else if (dirStep == 3) { pos.y--; } nextStep++; if (nextStep >= 9) { dirStep++; nextStep = 0; } } time += 0.003f; SetPixels(chessMap); }
public override void Draw() { ClearPixels(); if (auto) { hue += 0.0005f; if (hue > 1f) { hue -= 1f; } } float delta = 0.01f; PixelColor color = PixelColor.LerpRGB(lastColor, PixelColor.FromHSL(hue, 1f, 0.5f), delta); SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, color)); lastColor = color; }
public override void Draw() { for (int x = 0; x < brightnesses.GetLength(0); x++) { for (int y = 0; y < brightnesses.GetLength(1); y++) { if (brightnesses[x, y] > 0f) { brightnesses[x, y] -= 0.02f; } SetPixel(x, y, PixelColor.FromHSL(brightnesses[x, y] * hueOffset, brightnesses[x, y], brightnesses[x, y] * 0.5)); if (Program.random.Next(0, 100) < 2) { brightnesses[x, y] = 1f; } } } }
public override void Draw() { ClearPixels(); for (int x = 0; x < 3; x++) { SetPixel(padPos + x, 0, PixelColor.FromHSL(curPadHue, 1f, 0.5f)); } MoveBall(); SetPixel(ballPos, PixelColor.FromHSL(hueBall, 1f, 0.5f)); if (hueSpeed > 0.0001f) { hueSpeed -= 0.00001f; } else if (hueSpeed < 0.0001f) { hueSpeed = 0.0001f; } if (lostTime > 0f) { SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.Random(new Random()))); lostTime += 0.001f; if (lostTime > 1f) { GameOver("Du hast wohl nicht genügend Zielwasser getrunken...", score, "pong"); Program.tableAppManager.LaunchApp(TableAppManager.GetAppById(new TableAppIdle().GetName())); } } hueBall += hueSpeed; if (hueBall > 1f) { hueBall -= 1f; } }
public PixelColor GetColor() { return(PixelColor.FromHSL(colorHue, brightness, 0.5f * brightness)); }
public PixelColor GetColor(float amount) { return(PixelColor.FromHSL(id == 0 ? 0.25 : 0.6, 1.0, amount)); }
public void RandomizedNewColor() { color = PixelColor.FromHSL(Program.random.NextDouble(), 1.0, 0.5); }
public override void Draw() { if (!gameOver) { ClearPixels(); SetPixel(ship.position.x, ship.position.y, ship.color); bool hitEdge = false; foreach (Invader i in invaders) { if (i.Update()) { if (i.position.x >= Program.TableWidth - 1 || i.position.x <= 0) { hitEdge = true; } if (i.position.y >= Program.TableHeight - 1) { gameOver = true; GameOver("Die Aliens haben dich zerstört!", score, "space_invaders"); ClearPixels(); return; } } SetPixel(i.position.x, i.position.y, i.color); } if (hitEdge) { foreach (Invader i in invaders) { i.ShiftDown(); } } foreach (Projectile p in projectiles) { if (p.position.y < 0) { projectiles.Remove(p); return; } p.Update(); int hitIndex = p.Hit(invaders); if (hitIndex >= 0) { invaders = invaders.Where((val, idx) => idx != hitIndex).ToArray(); } SetPixel(p.position.x, p.position.y, p.color); } } else { for (int i = 0; i < Program.TableWidth; i++) { SetPixel(i, flameWallRange, PixelColor.FromHSL(Math.Abs(flameWallRange / 50f - 0.10), 0.5, 0.5)); } flameWallRange--; if (flameWallRange < -4) { Close(); } } }