private void initNumGroups(int initNumber, double baseSpeed, double stepSpeed, double randomSpeed, Random random) { // first number (char) NumberPanel number1 = new NumberPanel(2); number1.Speed = baseSpeed + (stepSpeed * 0) + random.NextDouble() * randomSpeed; stackPanelMain.Children.Add(number1); listNumber.Add(number1); // other numbers for (int i = 1; i < initNumber; i++) { NumberPanel number = new NumberPanel(1); number.Speed = baseSpeed + (stepSpeed * i) + random.NextDouble() * randomSpeed; stackPanelMain.Children.Add(number); listNumber.Add(number); } }
private void Init() { double baseSpeed = 8;//基础速度 double stepSpeed = 0.1;//累加速度 double randomSpeed = 3;//随机速度范围 Random random = new Random(); // first number (char) NumberPanel number1 = new NumberPanel(2); number1.Speed = baseSpeed + (stepSpeed * 0) + random.NextDouble() * randomSpeed; stackPanelMain.Children.Add(number1); listNumber.Add(number1); // other numbers for (int i = 1; i < 8; i++) { NumberPanel number = new NumberPanel(1); number.Speed = baseSpeed + (stepSpeed * i) + random.NextDouble() * randomSpeed; stackPanelMain.Children.Add(number); listNumber.Add(number); } }
private void Init() { double baseSpeed = 8; //基础速度 double stepSpeed = 0.1; //累加速度 double randomSpeed = 3; //随机速度范围 Random random = new Random(); // first number (char) NumberPanel number1 = new NumberPanel(2); number1.Speed = baseSpeed + (stepSpeed * 0) + random.NextDouble() * randomSpeed; stackPanelMain.Children.Add(number1); listNumber.Add(number1); // other numbers for (int i = 1; i < 8; i++) { NumberPanel number = new NumberPanel(1); number.Speed = baseSpeed + (stepSpeed * i) + random.NextDouble() * randomSpeed; stackPanelMain.Children.Add(number); listNumber.Add(number); } }