private void OnTouch(object sender, TouchTracking.TouchActionEventArgs args) { if (args.Type == TouchTracking.TouchActionType.Pressed) { var x = args.Location.X * _density; var y = args.Location.Y * _density; var ppi = new PointParticleInitializer(new Window(Height, Width), new Vector2((float)x, (float)y)); var emitter = new Emitter <SKParticle2D>(ppi, 100) { //AvgLife = 5, Forces = new List <IApplyForce>() { new Gravity() } }; _renderer.AddEmitter(emitter); } }
protected override void OnAppearing() { base.OnAppearing(); _isPageActive = true; var ppi = new PointParticleInitializer(new Window(Height, Width), new Vector2(300, 200)); _emitter = new Emitter <SKParticle2D>(ppi, 100) { //AvgLife = 5, Forces = new List <IApplyForce>() { new Gravity() } }; _renderer = new Renderer(_emitter, (int)(5 * _density)); canvas.PaintSurface += Canvas_PaintSurface; Device.StartTimer(TimeSpan.FromSeconds(1.0 / 30.0), () => { canvas.InvalidateSurface(); return(_isPageActive); }); }