Exemple #1
0
 public Rainbow2DEffect(
     NeoPixelSetup neoPixelSetup,
     NeoStripXYCoordinates coordinates)
 {
     this.neoPixelSetup = neoPixelSetup;
     this.coordinates   = coordinates;
 }
        public PixelController(EffectController effectController)
        {
            neoPixelSender        = new NeoPixelSender("localhost", 80);
            this.effectController = effectController;

            neoPixelSetup = NeoPixelFactory.CreateNeoPixelSetup(Devices, 8, 45);
            coordinates   = new NeoStripXYCoordinates(neoPixelSetup);
            effectFactory = new EffectFactory(neoPixelSetup, coordinates);

            effectController.AddEffect(effectFactory.CreateDefaultCurveEffect(
                                           name: "Rainbow",
                                           isEnabled: false,
                                           colorProvider: new RainbowColorProvider(0.2f),
                                           areaStartPosition: 0,
                                           areaLength: 45,
                                           effectLength: 10,
                                           speed: 5
                                           ));

            effectController.AddEffect(effectFactory.CreateDefaultCurveEffect(
                                           name: "Small slow rainbow",
                                           isEnabled: false,
                                           colorProvider: new RainbowColorProvider(0.2f),
                                           areaStartPosition: 30,
                                           areaLength: 15,
                                           effectLength: 5,
                                           speed: 1
                                           ));


            effectController.AddEffect(effectFactory.CreateDefaultCurveEffect(
                                           name: "Green",
                                           isEnabled: false,
                                           colorProvider: new StaticColorProvider(Color.Green),
                                           areaStartPosition: 0,
                                           areaLength: 45,
                                           effectLength: 13,
                                           speed: 3
                                           ));


            effectController.AddEffect(effectFactory.CreateDefaultCurveEffect(
                                           name: "Red",
                                           isEnabled: false,
                                           colorProvider: new StaticColorProvider(Color.Red),
                                           areaStartPosition: 0,
                                           areaLength: 45,
                                           effectLength: 10,
                                           speed: 7
                                           ));

            effectController.AddEffect(effectFactory.CreateDefaultCurveEffect(
                                           name: "Blue",
                                           isEnabled: false,
                                           colorProvider: new StaticColorProvider(Color.Blue),
                                           areaStartPosition: 0,
                                           areaLength: 45,
                                           effectLength: 7,
                                           speed: 5
                                           ));

            effectController.AddEffect(new FullColorEffect(neoPixelSetup, new RainbowColorProvider(0.2f))
            {
                Name      = "Full white",
                IsEnabled = false
            });

            //effectController.AddEffect(effectFactory.CreateScrollEffectFromTestImage(
            //    name: "Test image",
            //    isEnabled: false,
            //    speed: 10));

            effectController.AddEffect(effectFactory.CreateScrollEffectFromFile(
                                           name: "Color Wheel From Image",
                                           isEnabled: false,
                                           horizontalDirection: false,
                                           file: resourceLoader.CreateFullFilePath("colorwheel_line.png"),
                                           speed: 500));

            effectController.AddEffect(effectFactory.CreateColorWheelEffect(
                                           name: "Color Wheel",
                                           isEnabled: false,
                                           speed: 100));

            effectController.AddEffect(effectFactory.CreateRainbow2DEffect(
                                           name: "2D Rainbow",
                                           isEnabled: true,
                                           zoom: 3f,
                                           speed: 100f));
        }