Module: Ferrum::Page::Animation

Included in:
Ferrum::Page
Defined in:
lib/ferrum/page/animation.rb

Overview

Controls the playback of CSS animations on the page via the CDP Animation domain, allowing animations to be sped up, slowed down, or paused.

Instance Method Summary collapse

Instance Method Details

#playback_rateNumber

Returns playback rate for CSS animations, defaults to 1.

Returns:

  • (Number)


16
17
18
# File 'lib/ferrum/page/animation.rb', line 16

def playback_rate
  command("Animation.getPlaybackRate")["playbackRate"]
end

#playback_rate=(value) ⇒ Object

Sets playback rate of CSS animations.

Examples:

browser = Ferrum::Browser.new
browser.playback_rate = 2000
browser.go_to("https://google.com")
browser.playback_rate # => 2000

Parameters:

  • value (Number)


31
32
33
# File 'lib/ferrum/page/animation.rb', line 31

def playback_rate=(value)
  command("Animation.setPlaybackRate", playbackRate: value)
end