-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Tracks and Sequence functionality #8
Comments
Thanks for logging this and for the video. It's definitely something I want to add. |
Note: I've looked into looping |
@djeedai Makes sense... Maybe we should keep only |
@Shatur I'm not sure I follow, that sounds like what |
@djeedai sorry for confusion, I didn't mean indexing. |
Correct.
Yes. But that's the easy part of making |
Oh, I see. Hm... Maybe instead of having tracks, we allow could to store multiply tweenable objects inside the |
So far animator allows us to mutate various components in a seq or track. What if we wanted to add another seq/track to the same animator?
|
@azarmadr Makes sense to me. So we will be able to store multiply |
I don't really like the I'm open to discuss modifying |
@djeedai I mentioned the use-case in the first message, but I don't know what to suggest for architecture to provide such functionality :( |
Opened #16 for the case of making |
I have been playing around with lens and settled on this. multiple-field-lens.mp4 |
I observed that Animator is constrained to Yesterday I was trying to make the animator with /// trying to create a bundled animator
pub fn component_animator2_system<T:Component+Clone,R:Component+Clone>(
time: Res<Time>,
mut query: Query<(Entity, (&mut T,&mut R), &mut Animator<(T,R)>)>,
mut event_writer: EventWriter<TweenCompleted>,
)
{
for (entity, ref mut target, ref mut animator) in query.iter_mut() {
if animator.state != AnimatorState::Paused {
if let Some(tweenable) = animator.tweenable_mut() {
let nt = &mut(target.0.clone(),target.1.clone());
tweenable.tick(time.delta(), nt, entity, &mut event_writer);
let (ref a,ref b) = nt;
*target.0 = a.clone();
*target.1 = b.clone();
}
}
}
} You can find the above system in my fork bundle_animator.mp4 |
I'm also facing difficulties with the lack of flexibility in the current API. So I'm thinking of a different approach: in addition to entity-level animators, we can also provide system-level animators. A sketch of what the API might look like: let tween = SystemTween::new(EaseFunction::QuadraticInOut, Duration::from_secs(1))
.with_repeat_count(RepeatCount::Finite(2))
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
// a `SystemAnimator` associated with this system will be passed
let system = |In(mut animator): In<&mut SystemAnimator>,
mut foo_query: Query<&mut Transform, With<Foo>>,
mut bar_query: Query<&mut Transform, With<Bar>>| {
let ratio = animator.get_ratio();
let mut transform = foo_query.get_single().unwrap();
transform.x = 50.0_f32.lerp(80.0, ratio);
animator.set_speed(0.5);
// do some other stuff
};
app.add_animation(SystemAnimator::new(tween), system); This gives the user a lot of flexibility to basically do anything they want. But after a quick look through the library, it looks like that What do you think? |
I also expected to be able to have different Lens types in one Track but that doesn't work either. Not sure if there is a way and I was just too blind to see it though. let seq = Tracks::new([
Tween::new(
EaseFunction::QuarticOut,
Duration::from_secs_f32(0.2),
TransformPositionLens {
start: Vec3::ZERO,
end: Vec3::ONE,
},
),
Tween::new(
EaseFunction::QuarticOut,
Duration::from_secs_f32(0.2),
SpriteColorLens {
start: Color::WHITE,
end: Color::BLACK,
},
),
]); |
To combine multiply tweens and loop them I have to create custom lens which is not very ergonomic. We currently have
Tracks
andSequence
, but they aren't loopable.I would like to request to extend their functionality. It would be great if we could combine multiply tweens with different tweening type. For example, to animate healing pickup like in Owerwatch I need rotation tween with
Loop
and translation tween withPingPong
. Video of how such pickups look.The text was updated successfully, but these errors were encountered: