Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override void Generate()
- {
- VeryCool("sb/pixel.png", 11.25f, 71831, 82617, 93404, 320, 240, 100, 0.7, new Vector2(30, 2)); // The lines
- VeryCool("sb/pixel.png", 11.25f, 81775, 82617, 93404, 320, 240, 70, 0.7, new Vector2(10, 8)); // The Boxes
- }
- public void VeryCool(String spritePath, float angleGap, double startTime, double endTime, double endtimeSpin, float x, float y, float distance, double fadeOpac, Vector2 scale)
- {
- // Animation
- double spriteCount = 360 / (angleGap * 2);
- double duration = endTime - startTime;
- double startTimeIncrement = startTime;
- for (float angle = 0; angle < 180; angle += angleGap)
- {
- float radian = MathHelper.DegreesToRadians(angle);
- var p = GetLayer("Foreground").CreateSprite(spritePath);
- p.Fade(startTimeIncrement, fadeOpac);
- p.ScaleVec(startTimeIncrement, scale);
- p.Rotate(startTimeIncrement, radian);
- p.Move(OsbEasing.OutCirc, startTimeIncrement - 150, startTimeIncrement, x + Math.Cos(radian) * (distance + 80), y + Math.Sin(radian) * (distance + 80),
- +x + Math.Cos(radian) * (distance), y + Math.Sin(radian) * (distance));
- startTimeIncrement += duration / spriteCount;
- p.Fade(endTime, 0);
- }
- startTimeIncrement = startTime;
- for (float angle = 180; angle < 360; angle += angleGap)
- {
- float radian = MathHelper.DegreesToRadians(angle);
- var p = GetLayer("Foreground").CreateSprite(spritePath);
- p.Fade(startTimeIncrement, fadeOpac);
- p.ScaleVec(startTimeIncrement, scale);
- p.Rotate(startTimeIncrement, radian);
- p.Move(OsbEasing.OutCirc, startTimeIncrement - 150, startTimeIncrement, x + Math.Cos(radian) * (distance + 80), y + Math.Sin(radian) * (distance + 80),
- +x + Math.Cos(radian) * (distance), y + Math.Sin(radian) * (distance));
- startTimeIncrement += duration / spriteCount;
- p.Fade(endTime, 0);
- }
- // Spin
- for (double angle = 0; angle < 360; angle += angleGap)
- {
- double startMove = endTime;
- double radian = MathHelper.DegreesToRadians(angle);
- var p = GetLayer("Foreground").CreateSprite(spritePath);
- p.Fade(endTime, fadeOpac);
- p.ScaleVec(endTime, scale);
- p.Rotate(startTimeIncrement, radian);
- double loopTimes = 360 / angleGap;
- duration = (endtimeSpin - endTime) / loopTimes;
- for (double angle2 = 0; angle2 < 360; angle2 += angleGap)
- {
- double secRadian = MathHelper.DegreesToRadians(angle + angle2);
- double movRadian = secRadian + MathHelper.DegreesToRadians(angleGap);
- p.Move(startMove, startMove + duration, x + Math.Cos(secRadian) * (distance), y + Math.Sin(secRadian) * (distance),
- x + Math.Cos(movRadian) * (distance), y + Math.Sin(movRadian) * (distance));
- p.Rotate(startMove, startMove + duration, secRadian, movRadian);
- startMove += duration;
- }
- p.Fade(endtimeSpin, 0);
- }
- }
Add Comment
Please, Sign In to add comment