Blowing leaves effect with per object rotation.
Works with any leaf sprite or even sakura petals. Can specify start and end location as well as approximate amount of sprites generated. Leaf sprites will generate randomized between two color options for added realism.
Script
public void makeLeaf(string path, int Start, int End, Vector2 startpos, Vector2 endpos, int amt, Color4 color1, Color4 color2, double alpha){
var Beat = Beatmap.GetTimingPointAt(Start).BeatDuration;
for(double i = Start; i < End; i += Beat/8){
var Sprite = GetLayer("Particles").CreateSprite(path);
Vector2 Position = startpos;
Vector2 EndPosition = endpos;
Sprite.Move(i, i + 2000, Position, EndPosition);
Sprite.Fade(i, i + 2000, 1, 1);
Sprite.Fade(Start, End, alpha, alpha);
Sprite.StartLoopGroup(i, amt);
Sprite.ScaleVec(0, 500, 0.5, 0.5, 0.5, -0.5);
Sprite.Rotate(0, 500, 0, Math.PI*2);
Sprite.EndGroup();
if(Random(0, 100)>50)
Sprite.Color(i, Color4.Green);
else Sprite.Color(i, Color4.LightGreen);
}
}
Example Usage
//Declare variables
string path = "sb/leaf.png";
Vector2 StartPosition = new Vector2(-120, Random(-100, 480));
Vector2 EndPosition = new Vector2(760, StartPosition.Y + 200);
Color4 Color1 = Color4.Green; Color4;
Color2 = Color4.LightGreen;
//Call function
makeLeaf(51897,72897,StartPosition,EndPosition, 4, Color1, Color2, 0.8);"