// Copyright © 2020 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp.DevTools.Animation { using System.Linq; /// /// Animation /// public partial class Animation : DevToolsDomainBase { private CefSharp.DevTools.IDevToolsClient _client; public Animation(CefSharp.DevTools.IDevToolsClient client) { _client = (client); } /// /// Disables animation domain notifications. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task DisableAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.disable", dict); return methodResult; } /// /// Enables animation domain notifications. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task EnableAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.enable", dict); return methodResult; } partial void ValidateGetCurrentTime(string id); /// /// Returns the current time of the an animation. /// /// Id of animation. /// returns System.Threading.Tasks.Task<GetCurrentTimeResponse> public async System.Threading.Tasks.Task GetCurrentTimeAsync(string id) { ValidateGetCurrentTime(id); var dict = new System.Collections.Generic.Dictionary(); dict.Add("id", id); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.getCurrentTime", dict); return methodResult.DeserializeJson(); } /// /// Gets the playback rate of the document timeline. /// /// returns System.Threading.Tasks.Task<GetPlaybackRateResponse> public async System.Threading.Tasks.Task GetPlaybackRateAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.getPlaybackRate", dict); return methodResult.DeserializeJson(); } partial void ValidateReleaseAnimations(string[] animations); /// /// Releases a set of animations to no longer be manipulated. /// /// List of animation ids to seek. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task ReleaseAnimationsAsync(string[] animations) { ValidateReleaseAnimations(animations); var dict = new System.Collections.Generic.Dictionary(); dict.Add("animations", animations); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.releaseAnimations", dict); return methodResult; } partial void ValidateResolveAnimation(string animationId); /// /// Gets the remote object of the Animation. /// /// Animation id. /// returns System.Threading.Tasks.Task<ResolveAnimationResponse> public async System.Threading.Tasks.Task ResolveAnimationAsync(string animationId) { ValidateResolveAnimation(animationId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("animationId", animationId); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.resolveAnimation", dict); return methodResult.DeserializeJson(); } partial void ValidateSeekAnimations(string[] animations, long currentTime); /// /// Seek a set of animations to a particular time within each animation. /// /// List of animation ids to seek. /// Set the current time of each animation. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SeekAnimationsAsync(string[] animations, long currentTime) { ValidateSeekAnimations(animations, currentTime); var dict = new System.Collections.Generic.Dictionary(); dict.Add("animations", animations); dict.Add("currentTime", currentTime); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.seekAnimations", dict); return methodResult; } partial void ValidateSetPaused(string[] animations, bool paused); /// /// Sets the paused state of a set of animations. /// /// Animations to set the pause state of. /// Paused state to set to. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetPausedAsync(string[] animations, bool paused) { ValidateSetPaused(animations, paused); var dict = new System.Collections.Generic.Dictionary(); dict.Add("animations", animations); dict.Add("paused", paused); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.setPaused", dict); return methodResult; } partial void ValidateSetPlaybackRate(long playbackRate); /// /// Sets the playback rate of the document timeline. /// /// Playback rate for animations on page /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetPlaybackRateAsync(long playbackRate) { ValidateSetPlaybackRate(playbackRate); var dict = new System.Collections.Generic.Dictionary(); dict.Add("playbackRate", playbackRate); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.setPlaybackRate", dict); return methodResult; } partial void ValidateSetTiming(string animationId, long duration, long delay); /// /// Sets the timing of an animation node. /// /// Animation id. /// Duration of the animation. /// Delay of the animation. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetTimingAsync(string animationId, long duration, long delay) { ValidateSetTiming(animationId, duration, delay); var dict = new System.Collections.Generic.Dictionary(); dict.Add("animationId", animationId); dict.Add("duration", duration); dict.Add("delay", delay); var methodResult = await _client.ExecuteDevToolsMethodAsync("Animation.setTiming", dict); return methodResult; } } }