public void Run(IEffectPluginContext context) { var frequency = context.GetInput <int>("Frequency (Hz)"); if (frequency <= 0) { return; } var color = Color.FromArgb( context.GetInput <int>("RGB Value - R"), context.GetInput <int>("RGB Value - G"), context.GetInput <int>("RGB Value - B")); var period = 1000 / frequency; var numberOfHalfPeriodsPassed = Math.Round((double)context.ElapsedMilliseconds / (double)2 / (double)period, 0); var on = numberOfHalfPeriodsPassed % 2 == 0; foreach (var point in context.PointsCollection) { context.PointsCollection.ChangeColorOfPoint(point, on ? color : Color.Transparent); } }
public void Run(IEffectPluginContext context) { var durationInMilliseconds = context.GetInput <int>("Duration in seconds") * 1000; var angle = context.GetInput <int>("Angle in degrees"); var sin = Math.Sin(angle * (Math.PI / 180)); var cos = Math.Cos(angle * (Math.PI / 180)); var fractionalMove = (double)((double)context.ElapsedMilliseconds / (double)durationInMilliseconds); var xMove = (int)Math.Round(context.PointsCollection.XCount * fractionalMove * sin, 0); var yMove = (int)Math.Round(context.PointsCollection.YCount * fractionalMove * cos, 0); foreach (var point in context.PointsCollection) { context.PointsCollection.AddXToPoint(point, xMove); context.PointsCollection.AddYToPoint(point, yMove); } //var loopingX = context.GetInput<bool>("Looping horizontal boundary"); //var loopingY = context.GetInput<bool>("Looping vertical boundary"); //foreach (var point in context.PointsCollection) //{ // if (loopingX && point.X + xMove > context.PointsCollection.XCount) // { // xMove = xMove - context.PointsCollection.XCount; // } // if (loopingY && point.Y + yMove > context.PointsCollection.YCount) // { // yMove = yMove - context.PointsCollection.YCount; // } // context.PointsCollection.AddXToPoint(point, (int)xMove); // context.PointsCollection.AddYToPoint(point, (int)yMove); // if (point.Color == Color.White) // { // context.WriteToLog((double)(context.ElapsedMilliseconds / 1000) + ", " + xMove + ", " + yMove); // } //} }
internal Effect(IEffectPlugin plugin, IEffectPluginContext context) { Plugin = plugin; Context = context; }