You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.rs
    path of file: ./repos/amethyst/examples/sprite_animation
    
    the code of the file until where you have to start completion: //! Demonstrates how to load and render sprites.
//!
//! Sprites are from <https://opengameart.org/content/bat-32x32>.

use amethyst::{
    animation::{
        get_animation_set, Animation, AnimationBundle, AnimationCommand, AnimationSet, EndControl,
        InterpolationFunction, Sampler, SpriteRenderPrimitive,
    },
    assets::{DefaultLoader, Handle, Loader, LoaderBundle, ProgressCounter},
    core::transform::{Transform, TransformBundle},
 
    
    fn on_start(&mut self, data: StateData<'_, GameData>) {
        let StateData {
            world, resources, ..
        } = data;

        self.progress_counter = Some(Default::default());

        {
            let loader = resources
                .get_mut::<DefaultLoader>()
                .expect("Missing loader");

            let texture = loader.load("texture/bat.32x32.png");
            let sprites = loader.load("sprites/bat.ron");

            let sheet: Handle<SpriteSheet> = loader.load_from_data(
                SpriteSheet { texture, sprites },
                self.progress_counter.as_mut().unwrap(),
                &resources.get().expect("processing queue for SpriteSheet"),
            );

            let anims = loader.load_from_data(
                Sampler::<SpriteRenderPrimitive> {
                    input: vec![0.0, 0.2, 0.4, 0.6, 0.8, 1.0],
                    output: vec![
                        SpriteRenderPrimitive::SpriteIndex(4),
                        SpriteRenderPrimitive::SpriteIndex(3),
                        SpriteRenderPrimitive::SpriteIndex(2),
                        SpriteRenderPrimitive::SpriteIndex(1),
                        SpriteRenderPrimitive::SpriteIndex(0),
                    ],
                    function: InterpolationFunction::Step,
                },
                self.progress_counter.as_mut().unwrap(),
                &resources.get().expect("queue for Sampler"),
            );

            let anim_handle: Handle<Animation<SpriteRender>> = loader.load_from_data(
                Animation::<SpriteRender>::new_single(
                    0,
                    amethyst::animation::SpriteRenderChannel::SpriteIndex,
                    anims,
                ),
                self.progress_counter.as_mut().unwrap(),
                &resources.get().expect("queue for Animation"),
            );

            let mut anim_set = AnimationSet::new();
            anim_set.insert(BatAnimations::Fly, anim_handle);

            world.push((SpriteRender::new(sheet, 0), Transform::default(), anim_set));
        }

        initialize_camera(world, resources);
    }