// Смещение лого и отрисовка подписи private void MovingTimer_Tick(object sender, EventArgs e) { arc1 -= 2.0; if ((arc1 >= 0.0) && (mode == DrawModes.Mode2)) { // Расходящаяся от центра рамка, стирающая лишние линии g.DrawRectangle(backPen, (int)((this.Width / 2 - (logoScale + tailsSize)) * ((1 + LogoDrawerSupport.Cosinus(arc1 + 180.0)) / 2.0)), (int)((this.Height / 2 - (int)(logoScale / 2 + tailsSize)) * ((1 + LogoDrawerSupport.Cosinus(arc1 + 180.0)) / 2.0)), (int)(logo1.Width + (this.Width - logo1.Width) * ((1 + LogoDrawerSupport.Cosinus(arc1)) / 2.0)), (int)(logo1.Height + (this.Height - logo1.Height) * ((1 + LogoDrawerSupport.Cosinus(arc1)) / 2.0))); // Смещающееся влево лого g.DrawImage(logo1, (this.Width - logo1.Width) / 2 - (int)(((1 + LogoDrawerSupport.Cosinus(arc1)) / 2.0) * (9 * this.Width / 10 - logo1.Width) / 2), (int)((this.Height - (logoScale + 2 * tailsSize)) / 2)); } else if (arc1 >= -90.0) { // Отображение текста g.DrawString(logoString1.Substring(0, (int)(logoString1.Length * LogoDrawerSupport.Sinus(-arc1))), logo1Font, foreBrush, 94 * this.Width / 100 - logo1Size.Width, this.Height / 2); g.DrawString(logoString2.Substring(0, (int)(logoString2.Length * LogoDrawerSupport.Sinus(-arc1))), logo2Font, foreBrush, 93 * this.Width / 100 - logo2Size.Width, this.Height / 2 - logo1Size.Height * 0.4f); } else { if (mode == DrawModes.Mode1) { Bitmap logo1tmp = new Bitmap(this.Width, this.Height); g2 = Graphics.FromImage(logo1tmp); g2.CopyFromScreen(0, 0, 0, 0, new Size(this.Width, this.Height), CopyPixelOperation.SourceCopy); g2.Dispose(); logo1 = logo1tmp.Clone(new Rectangle(this.Width / 6 - 7 * logoScale / 5, this.Height / 2 - 7 * logoScale / 5, 14 * logoScale / 5, 14 * logoScale / 5), PixelFormat.Format32bppArgb); logo1tmp.Dispose(); } MovingTimer.Enabled = false; PauseTimer.Enabled = true; } #if LDDEXPORT logo4b.Save("C:\\1\\" + (moves++).ToString("D8") + ".png", ImageFormat.Png); #endif }
// Метод рисует вертикальный разделитель private void DrawSplitter() { steps++; g.FillRectangle(foreBrush, 220, this.Height * 0.05f, drawerSize / 2, this.Height * 0.9f * (float)LogoDrawerSupport.Sinus(steps * 4)); if (steps > 45) { steps = 0; phase1++; } }
// Основное лого, вариант 2 private void DrawingTimer_Mode2(object sender, EventArgs e) { // Определение следующей позиции switch (phase1) { // Пауза в центре case 1: arc1 += 1.0; if (arc1 >= 70.0) { arc1 = 0.0; foreBrush = new SolidBrush(this.ForeColor); phase1++; } break; // Во всех направлениях от центра case 2: arc1 += 1.0; point1.X = (this.Width + logoScale) / 2 + (int)(LogoDrawerSupport.Cosinus(180.0 - arc1) * logoScale / 2.0); // Нижняя правая point1.Y = this.Height / 2 + (int)(LogoDrawerSupport.Sinus(180.0 - arc1) * logoScale / 2.0); point2.X = (this.Width + logoScale) / 2 + (int)(LogoDrawerSupport.Cosinus(180.0 + arc1 * 2.0) * logoScale / 2.0); // Верхняя правая point2.Y = this.Height / 2 + (int)(LogoDrawerSupport.Sinus(180.0 + arc1 * 2.0) * logoScale / 2.0); point3.X = (this.Width - logoScale) / 2 + (int)(LogoDrawerSupport.Cosinus(-arc1) * logoScale / 2.0); // Верхняя левая point3.Y = this.Height / 2 + (int)(LogoDrawerSupport.Sinus(-arc1) * logoScale / 2.0); point4.X = (this.Width - logoScale) / 2 + (int)(LogoDrawerSupport.Cosinus(arc1 * 2.0) * logoScale / 2.0); // Нижняя левая point4.Y = this.Height / 2 + (int)(LogoDrawerSupport.Sinus(arc1 * 2.0) * logoScale / 2.0); if (arc1 >= 90.0) { phase1++; } break; // К краям экрана case 3: point1.X += frameSpeed; point2.Y += frameSpeed; point3.X -= frameSpeed; point4.Y -= frameSpeed; break; } // Отрисовка if (phase1 == 3) { g.FillRectangle(foreBrush, point1.X - drawerSize / 2, point1.Y - drawerSize / 2, drawerSize, drawerSize); g.FillRectangle(foreBrush, point2.X - drawerSize / 2, point2.Y - drawerSize / 2, drawerSize, drawerSize); g.FillRectangle(foreBrush, point3.X - drawerSize / 2, point3.Y - drawerSize / 2, drawerSize, drawerSize); g.FillRectangle(foreBrush, point4.X - drawerSize / 2, point4.Y - drawerSize / 2, drawerSize, drawerSize); } else { g.FillEllipse(foreBrush, point1.X - drawerSize / 2, point1.Y - drawerSize / 2, drawerSize, drawerSize); g.FillEllipse(foreBrush, point2.X - drawerSize / 2, point2.Y - drawerSize / 2, drawerSize, drawerSize); g.FillEllipse(foreBrush, point3.X - drawerSize / 2, point3.Y - drawerSize / 2, drawerSize, drawerSize); g.FillEllipse(foreBrush, point4.X - drawerSize / 2, point4.Y - drawerSize / 2, drawerSize, drawerSize); } // Отрисовка и финальный контроль CheckTransition(); }
// Таймеры отрисовки // Основное лого, вариант 1 private void DrawingTimer_Mode1(object sender, EventArgs e) { // Определение следующей позиции switch (phase1) { // Пауза в центре case 1: arc1 += 1.0; if (arc1 >= 50.0) { arc1 = 0.0; foreBrush = new SolidBrush(this.ForeColor); phase1++; } break; // Во всех направлениях от центра case 2: arc1 += 1.3; point1.X = this.Width / 6 + 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Cosinus(135.0 - arc1) * logoScale / 2.0); // Нижняя правая point1.Y = this.Height / 2 - 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Sinus(135.0 - arc1) * logoScale / 2.0); point2.X = this.Width / 6 + 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Cosinus(135.0 + arc1 * 2.0) * logoScale / 2.0); // Верхняя правая point2.Y = this.Height / 2 - 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Sinus(135.0 + arc1 * 2.0) * logoScale / 2.0); point3.X = this.Width / 6 - 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Cosinus(315.0 - arc1) * logoScale / 2.0); // Верхняя левая point3.Y = this.Height / 2 + 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Sinus(315.0 - arc1) * logoScale / 2.0); point4.X = this.Width / 6 - 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Cosinus(315.0 + arc1 * 2.0) * logoScale / 2.0); // Нижняя левая point4.Y = this.Height / 2 + 707 * logoScale / 2000 + (int)(LogoDrawerSupport.Sinus(315.0 + arc1 * 2.0) * logoScale / 2.0); if (arc1 >= 90.0) { arc1 = 0.0; phase1++; } break; // К краям экрана case 3: int delta = (int)(2.3 - arc1 / 50.0); point1.X += delta; point1.Y -= delta; point2.X += delta; point2.Y += delta; point3.X -= delta; point3.Y += delta; point4.X -= delta; point4.Y -= delta; arc1 += 1.0; if (arc1 >= 2 * logoScale / 5) { phase1++; } break; case 4: arc1 = 0.0; DrawingTimer.Enabled = false; MovingTimer.Enabled = true; break; } // Отрисовка g.FillEllipse(foreBrush, point1.X - drawerSize / 2, point1.Y - drawerSize / 2, drawerSize, drawerSize); g.FillEllipse(foreBrush, point2.X - drawerSize / 2, point2.Y - drawerSize / 2, drawerSize, drawerSize); g.FillEllipse(foreBrush, point3.X - drawerSize / 2, point3.Y - drawerSize / 2, drawerSize, drawerSize); g.FillEllipse(foreBrush, point4.X - drawerSize / 2, point4.Y - drawerSize / 2, drawerSize, drawerSize); // Вместо CheckTransition #if LDDEXPORT logo4b.Save("C:\\1\\" + (moves++).ToString("D8") + ".png", ImageFormat.Png); #endif }