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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! Be-Tween
//!
//! Provides tweening values over time.
//! These examples run with Bevy:
//! ```no_run
//! use bevy::prelude::*;
//! use be_tween::*;
//!
//! App::default()
//! .add_plugins(DefaultPlugins)
//! // Add the plugin - NoEvent means that no custom events will be used
//! .add_plugins(TweenPlugin)
//! .run();
//! ```
//!
//! Animate the position ([`Transform::translation`]) of an [`Entity`]:
//! ```
//! # use bevy::prelude::*;
//! # use be_tween::*;
//! # use std::time::Duration;
//! # fn system(mut commands: Commands) {
//! // Create a single animation (tween) to move an entity.
//! let tween = Tween::new(
//! // Animation time.
//! Duration::from_secs(1),
//! // Use a quadratic easing on both endpoints.
//! EaseFunction::QuadraticInOut,
//! // What we want to tween - the translation part of a transform
//! TweenTranslation {
//! start: Vec3::ZERO,
//! end: Vec3::X,
//! },
//! );
//!
//! commands.spawn((
//! // Spawn an entity to animate the position of.
//! Transform::default(),
//! // Add an Animator component to control and execute the animation.
//! PlayTween::new(tween),
//! ));
//! # }
//! ```
//! A more elaborate example:
//! ```
//! # use bevy::prelude::*;
//! # use be_tween::*;
//! # use std::time::Duration;
//! # fn system(mut commands: Commands) {
//! let tween_translation = Tween::sequence([
//! // First move to Vec3::X
//! Tween::new(
//! Duration::from_secs(1),
//! EaseFunction::QuadraticInOut,
//! TweenTranslation {
//! start: Vec3::ZERO,
//! end: Vec3::X,
//! }),
//! // Then move from Vec3::X to Vec3::Y 12 times
//! Tween::repeat(
//! RepeatTimes::N(12),
//! Tween::new(
//! Duration::from_secs(1),
//! EaseFunction::QuadraticInOut,
//! TweenTranslation {
//! start: Vec3::X,
//! end: Vec3::Y,
//! })),
//! // Then move up and down forever
//! Tween::repeat(
//! RepeatTimes::Infinite,
//! Tween::sequence([
//! Tween::new(
//! Duration::from_secs(1),
//! EaseFunction::QuadraticInOut,
//! TweenTranslation {
//! start: Vec3::Y,
//! end: -Vec3::Y,
//! }),
//! Tween::new(
//! Duration::from_secs(1),
//! EaseFunction::QuadraticInOut,
//! TweenTranslation {
//! start: -Vec3::Y,
//! end: Vec3::Y,
//! }),
//! ]))
//! ]);
//! let tween_color = Tween::sequence([Tween::new(
//! Duration::from_secs(1),
//! EaseFunction::QuadraticInOut,
//! TweenSpriteColor {
//! start: LinearRgba::WHITE.into(),
//! end: LinearRgba::RED.into()
//! })]
//! );
//!
//! commands.spawn((
//! // Spawn an entity to animate the position of.
//! Transform::default(),
//! // Now play the tweens
//! PlayTween::new(tween_translation),
//! // Note that both will be played in parallel!
//! PlayTween::new(tween_color),
//! ));
//! # }
//! ```
pub use *;
pub use *;