Class: Selenium::DevTools::V85::Animation

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Animation

Returns a new instance of Animation.



31
32
33
# File 'lib/selenium/devtools/v85/animation.rb', line 31

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



40
41
42
# File 'lib/selenium/devtools/v85/animation.rb', line 40

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

#enableObject



44
45
46
# File 'lib/selenium/devtools/v85/animation.rb', line 44

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

#get_current_time(id:) ⇒ Object



48
49
50
51
# File 'lib/selenium/devtools/v85/animation.rb', line 48

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

#get_playback_rateObject



53
54
55
# File 'lib/selenium/devtools/v85/animation.rb', line 53

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

#on(event, &block) ⇒ Object



35
36
37
38
# File 'lib/selenium/devtools/v85/animation.rb', line 35

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

#release_animations(animations:) ⇒ Object



57
58
59
60
# File 'lib/selenium/devtools/v85/animation.rb', line 57

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

#resolve_animation(animation_id:) ⇒ Object



62
63
64
65
# File 'lib/selenium/devtools/v85/animation.rb', line 62

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

#seek_animations(animations:, current_time:) ⇒ Object



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

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

#set_paused(animations:, paused:) ⇒ Object



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

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

#set_playback_rate(playback_rate:) ⇒ Object



79
80
81
82
# File 'lib/selenium/devtools/v85/animation.rb', line 79

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

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



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

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