| @@ -83,8 +83,16 @@ | ||
| 83 | 83 | */ |
| 84 | 84 | protected $_alignments; |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | + * Whether this chart supports animation or not. | |
| 88 | + * | |
| 89 | + * @access protected | |
| 90 | + * @var bool | |
| 91 | + */ | |
| 92 | + protected $_supportsAnimation = true; | |
| 93 | + | |
| 94 | + /** | |
| 87 | 95 | * Constructor. |
| 88 | 96 | * |
| 89 | 97 | * @since 1.0.0 |
| 90 | 98 | * |
| @@ -310,9 +318,58 @@ | ||
| 310 | 318 | |
| 311 | 319 | self::_renderSectionStart( esc_html__( 'Tooltip', 'visualizer' ), false ); |
| 312 | 320 | $this->_renderTooltipSettigns(); |
| 313 | 321 | self::_renderSectionEnd(); |
| 322 | + | |
| 323 | + $this->_renderAnimationSettings(); | |
| 324 | + | |
| 314 | 325 | self::_renderGroupEnd(); |
| 326 | + } | |
| 327 | + | |
| 328 | + /** | |
| 329 | + * Renders animation settings section. | |
| 330 | + * | |
| 331 | + * @access protected | |
| 332 | + */ | |
| 333 | + protected function _renderAnimationSettings() { | |
| 334 | + if ( ! $this->_supportsAnimation ) { | |
| 335 | + return; | |
| 336 | + } | |
| 337 | + | |
| 338 | + self::_renderSectionStart( esc_html__( 'Animation', 'visualizer' ), false ); | |
| 339 | + | |
| 340 | + self::_renderCheckboxItem( | |
| 341 | + esc_html__( 'Animate on startup', 'visualizer' ), | |
| 342 | + 'animation[startup]', | |
| 343 | + $this->animation['startup'], | |
| 344 | + true, | |
| 345 | + esc_html__( 'Determines if the chart will animate on the initial draw.', 'visualizer' ) | |
| 346 | + ); | |
| 347 | + | |
| 348 | + self::_renderTextItem( | |
| 349 | + esc_html__( 'Duration', 'visualizer' ), | |
| 350 | + 'animation[duration]', | |
| 351 | + isset( $this->animation['duration'] ) ? $this->animation['duration'] : 0, | |
| 352 | + esc_html__( 'The duration of the animation, in milliseconds', 'visualizer' ), | |
| 353 | + 0, | |
| 354 | + 'number' | |
| 355 | + ); | |
| 356 | + | |
| 357 | + self::_renderSelectItem( | |
| 358 | + esc_html__( 'Easing', 'visualizer' ), | |
| 359 | + 'animation[easing]', | |
| 360 | + isset( $this->animation['easing'] ) ? $this->animation['easing'] : null, | |
| 361 | + array( | |
| 362 | + 'linear' => esc_html__( 'Constant speed', 'visualizer' ), | |
| 363 | + 'in' => esc_html__( 'Start slow and speed up', 'visualizer' ), | |
| 364 | + 'out' => esc_html__( 'Start fast and slow down', 'visualizer' ), | |
| 365 | + 'inAndOut' => esc_html__( 'Start slow, speed up, then slow down', 'visualizer' ), | |
| 366 | + ), | |
| 367 | + esc_html__( 'The easing function applied to the animation.', 'visualizer' ) | |
| 368 | + ); | |
| 369 | + | |
| 370 | + self::_renderSectionEnd(); | |
| 371 | + | |
| 315 | 372 | } |
| 316 | 373 | |
| 317 | 374 | /** |
| 318 | 375 | * Renders tooltip settings section. |