summaryrefslogtreecommitdiffstats
path: root/components/view_manager/public/interfaces/animations.mojom
blob: 6a4e55987043bf77fc9e514776250e4c1d8653a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module mojo;

import "ui/mojo/geometry/geometry.mojom";

enum AnimationTweenType {
  LINEAR,
  EASE_IN,
  EASE_OUT,
  EASE_IN_OUT,
};

enum AnimationProperty {
  // Used for pausing.
  NONE,
  OPACITY,
  TRANSFORM,
};

struct AnimationValue {
  float float_value;
  Transform transform;
};

// Identifies how a particular property should be animated between a start and
// target value.
struct AnimationElement {
  AnimationProperty property;

  // Duration is in microseconds.
  int64 duration;

  AnimationTweenType tween_type;

  // If not specified the start value is taken from either the current value
  // (for the first element) or the target_value of the previous element.
  AnimationValue? start_value;

  // target_value may be null when property is NONE.
  AnimationValue? target_value;
};

// An AnimationSequence consists of a number of AnimationElements to animate.
// Each element is animated serially.
struct AnimationSequence {
  // Number of times to run the sequence. Value of 0 means run until
  // explicitly stopped.
  uint32 cycle_count;

  array<AnimationElement> elements;
};

// AnimationGroup identifies a view and a set of AnimationSequences to apply
// to the view. Each sequence is run in parallel.
struct AnimationGroup {
  uint32 view_id;
  array<AnimationSequence> sequences;
};