Character animation jerks when moving

Hello! I’m new to unity. I’m trying to master the engine in 2D. There is one thing that is very alarming: when the hero moves, his animation jerks. However, when it stands still, the animation works as expected. It’s hard to explain, so I shot a video where the problem is visible:

On the left - animation of a stationary object, on the right - in motion. The animation starts to twitch just from the movement. This happens regardless of whether the camera is attached to the object or not.

I’ll throw off the code, but I don’t see the point in it.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Platformer : MonoBehaviour
{
    Rigidbody2D rb;
    public float speed;

    Animator anim;

    void Start()
    {
        //rb = 
        rb = GetComponent<Rigidbody2D>();
        //
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        Flip();
    }

    void FixedUpdate()
    {
        rb.velocity = new Vector2(Input.GetAxis("Horizontal") * speed, rb.velocity.y);
    }

    void Flip()
    {
        if (Input.GetAxis("Horizontal") > 0)
            transform.localRotation = Quaternion.Euler(0, 180, 0);
        if (Input.GetAxis("Horizontal") < 0)
            transform.localRotation = Quaternion.Euler(0, 0, 0);
    }
}

Please help.

http://answers.unity.com/comments/1796866/view.html