Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Fixed single frame animation #1015

Merged
merged 5 commits into from Oct 14, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions amethyst_animation/src/systems/sampling.rs
Expand Up @@ -196,17 +196,16 @@ where

// sampling is running, update duration and check end condition
Running(duration) => {
let zero = Duration::from_secs(0);
let current_dur =
duration + secs_to_duration(time.delta_seconds() * control.rate_multiplier);
let last_frame = sampler
.input
.last()
.cloned()
.map(secs_to_duration)
.unwrap_or(zero.clone());
.unwrap_or(Duration::from_secs(0));
// duration is past last frame of sampling
if last_frame != zero && current_dur > last_frame {
if current_dur > last_frame {
// Check end conditions
match control.end {
// Do loop control
Expand Down
3 changes: 0 additions & 3 deletions examples/gltf/main.rs
Expand Up @@ -206,9 +206,6 @@ fn toggle_or_cycle_animation(
);
}
scene.animation_index += 1;
if scene.animation_index == 6 {
scene.animation_index = 7;
}
Rhuagh marked this conversation as resolved.
Show resolved Hide resolved
if scene.animation_index >= animations.animations.len() {
scene.animation_index = 0;
}
Expand Down