Inertia and angular momentum in a wheel

Hello Friends, some could give me indications of how to give inertia / angular momentum to a rotating object (the hammer ride for example), the ideal would be that it works as a pendulum, slowing down until it comes to rest.

Thanks

Example:

Are you doing this with or without physics?

@youstar without physics, I really want it to be as simple as possible, it can be a kind of fake, it’s just an accessory (prop) in the scene/proyect that needs that movement

I would do something along the lines of applying rotational acceleration based on the direction that arm is pointing towards relative to world up.

@youstar If it looks good, but I really do not know where to start, I will pass you the code of the script that I plan to use, maybe adding some lines can it work?

var Cuerda = pc.createScript('Cuerda');


// initialize code called once per entity
Cuerda.prototype.initialize = function() {
    // Use on() to listen for events on the keyboard device.
    // Arguments are:
    // 1) The event name to listen for
    // 2) The callback function to call when the event fires
    // 3) (optional) The value to use for 'this' in the callback function
    
    this.app.keyboard.on(pc.EVENT_KEYDOWN, this.onKeyDown, this);
    this.app.keyboard.on(pc.EVENT_KEYUP, this.onKeyUp, this);
};

// update code called every frame
Cuerda.prototype.update = function(dt) {
    /*
     * Notice in the demo that pressing and holding the arrow keys doesn't 
     * make the block spin. wasPressed() is used to detect a 
     * keypress that occurred since the last frame and will only be 
     * called once even if the key is held down.
     */
    var angle = 0;
    if (this.app.keyboard.wasPressed(pc.KEY_LEFT)) {
        angle = -5;
    } else if (this.app.keyboard.wasPressed(pc.KEY_RIGHT)) {
        angle = 5;
    } 

    /*
     * Notice that pressing and holding the space bar makes the block 
     * continuously spin. isPressed() is used to detected if a
     * key is down right now. So it will be true every frame as long as 
     * the key is still pressed.
     */
    if (this.app.keyboard.isPressed(pc.KEY_C)) {
        angle = 5;
    }
    
     if (this.app.keyboard.isPressed(pc.KEY_V)) {
        angle = -5;
    }

    // Update the spinning cube
    this.entity.rotateLocal(0, angle, 0);
};