Class: Selenium::DevTools::V130::Animation

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v130/animation.rb

Constant Summary collapse

EVENTS =
{
  animation_canceled: 'animationCanceled',
  animation_created: 'animationCreated',
  animation_started: 'animationStarted',
  animation_updated: 'animationUpdated',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Animation

Returns a new instance of Animation.



32
33
34
# File 'lib/selenium/devtools/v130/animation.rb', line 32

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



41
42
43
# File 'lib/selenium/devtools/v130/animation.rb', line 41

def disable
  @devtools.send_cmd('Animation.disable')
end

#enableObject



45
46
47
# File 'lib/selenium/devtools/v130/animation.rb', line 45

def enable
  @devtools.send_cmd('Animation.enable')
end

#get_current_time(id:) ⇒ Object



49
50
51
52
# File 'lib/selenium/devtools/v130/animation.rb', line 49

def get_current_time(id:)
  @devtools.send_cmd('Animation.getCurrentTime',
                     id: id)
end

#get_playback_rateObject



54
55
56
# File 'lib/selenium/devtools/v130/animation.rb', line 54

def get_playback_rate
  @devtools.send_cmd('Animation.getPlaybackRate')
end

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v130/animation.rb', line 36

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["Animation.#{event}"] << block
end

#release_animations(animations:) ⇒ Object



58
59
60
61
# File 'lib/selenium/devtools/v130/animation.rb', line 58

def release_animations(animations:)
  @devtools.send_cmd('Animation.releaseAnimations',
                     animations: animations)
end

#resolve_animation(animation_id:) ⇒ Object



63
64
65
66
# File 'lib/selenium/devtools/v130/animation.rb', line 63

def resolve_animation(animation_id:)
  @devtools.send_cmd('Animation.resolveAnimation',
                     animationId: animation_id)
end

#seek_animations(animations:, current_time:) ⇒ Object



68
69
70
71
72
# File 'lib/selenium/devtools/v130/animation.rb', line 68

def seek_animations(animations:, current_time:)
  @devtools.send_cmd('Animation.seekAnimations',
                     animations: animations,
                     currentTime: current_time)
end

#set_paused(animations:, paused:) ⇒ Object



74
75
76
77
78
# File 'lib/selenium/devtools/v130/animation.rb', line 74

def set_paused(animations:, paused:)
  @devtools.send_cmd('Animation.setPaused',
                     animations: animations,
                     paused: paused)
end

#set_playback_rate(playback_rate:) ⇒ Object



80
81
82
83
# File 'lib/selenium/devtools/v130/animation.rb', line 80

def set_playback_rate(playback_rate:)
  @devtools.send_cmd('Animation.setPlaybackRate',
                     playbackRate: playback_rate)
end

#set_timing(animation_id:, duration:, delay:) ⇒ Object



85
86
87
88
89
90
# File 'lib/selenium/devtools/v130/animation.rb', line 85

def set_timing(animation_id:, duration:, delay:)
  @devtools.send_cmd('Animation.setTiming',
                     animationId: animation_id,
                     duration: duration,
                     delay: delay)
end