@Override public void paint(float alpha) { for (ImageLayer dot : dots) { if (random() > 0.95) { dot.setTranslation(dotBox.x + random()*(dotBox.width-10), dotBox.y + random()*(dotBox.height-10)); } } if (paintUpped != null) { float now = (elapsed + UPDATE_RATE*alpha)/1000; float sin = Math.abs(FloatMath.sin(now)), cos = Math.abs(FloatMath.cos(now)); int sinColor = (int)(sin * 255), cosColor = (int)(cos * 255); int c1 = (0xFF << 24) | (sinColor << 16) | (cosColor << 8); int c2 = (0xFF << 24) | (cosColor << 16) | (sinColor << 8); paintUpped.surface().clear(); paintUpped.surface().setFillColor(c1).fillRect(0, 0, 50, 50); paintUpped.surface().setFillColor(c2).fillRect(50, 50, 50, 50); } }