| @@ 142-166 (lines=25) @@ | ||
| 139 | * @param float $peak (Optional) Defines where in a period the target color is at its maximum. Defaults to `0.5`. Minimum `0.0`, maximum `1.0`. |
|
| 140 | * @return \Psr\Http\Message\StreamInterface |
|
| 141 | */ |
|
| 142 | public function breatheLights( |
|
| 143 | $selector = 'all', |
|
| 144 | $color = 'purple', |
|
| 145 | $from_color = null, |
|
| 146 | $period = 1.0, |
|
| 147 | $cycles = 1.0, |
|
| 148 | $persist = false, |
|
| 149 | $power_on = true, |
|
| 150 | $peak = 0.5 |
|
| 151 | ) { |
|
| 152 | $request = new Request('POST', 'lights/' . $selector . '/effects/breathe'); |
|
| 153 | $response = $this->sendRequest($request,[ |
|
| 154 | 'query' => [ |
|
| 155 | 'color' => $color, |
|
| 156 | 'from_color' => $from_color, |
|
| 157 | 'period' => $period, |
|
| 158 | 'cycles' => $cycles, |
|
| 159 | 'persist' => $persist, |
|
| 160 | 'power_on' => $power_on, |
|
| 161 | 'peak' => $peak, |
|
| 162 | ] |
|
| 163 | ]); |
|
| 164 | ||
| 165 | return $response->getBody(); |
|
| 166 | } |
|
| 167 | ||
| 168 | /** |
|
| 169 | * Performs a pulse effect by quickly flashing between the given colors. |
|
| @@ 182-207 (lines=26) @@ | ||
| 179 | * @param float $duty_cycle (Optional) Ratio of the period where color is active. Defaults to `0.5`. Minimum `0.0`, maximum `1.0`. |
|
| 180 | * @return \Psr\Http\Message\StreamInterface |
|
| 181 | */ |
|
| 182 | public function pulseLights( |
|
| 183 | $selector = 'all', |
|
| 184 | $color = 'purple', |
|
| 185 | $from_color = null, |
|
| 186 | $period = 1.0, |
|
| 187 | $cycles = 1.0, |
|
| 188 | $persist = false, |
|
| 189 | $power_on = true, |
|
| 190 | $duty_cycle = 0.5 |
|
| 191 | ) { |
|
| 192 | $request = new Request('POST', 'lights/' . $selector . '/effects/pulse'); |
|
| 193 | $response = $this->sendRequest($request,[ |
|
| 194 | 'query' => [ |
|
| 195 | 'selector' => $selector, |
|
| 196 | 'color' => $color, |
|
| 197 | 'from_color' => $from_color, |
|
| 198 | 'period' => $period, |
|
| 199 | 'cycles' => $cycles, |
|
| 200 | 'persist' => $persist, |
|
| 201 | 'power_on' => $power_on, |
|
| 202 | 'duty_cycle' => $duty_cycle, |
|
| 203 | ] |
|
| 204 | ]); |
|
| 205 | ||
| 206 | return $response->getBody(); |
|
| 207 | } |
|
| 208 | } |
|