The invention relates to an oscillating apparatus, such as a tattooing apparatus applying an electric motor such as a linear motor. The tattooing apparatus comprises a housing (8), a handle (4) a power supply (3) and - a needle (2) having at least one needle tip (5), said needle (2) is configured to move relative to a stationary part of a linear electric motor (1), the needle (2) is configured to move reciprocating along a line between a retracted position and a forward position; - a linear electric motor (1) having a variable and controllable motor controlling stroke length, position and velocity of the needle (2). The apparatus further comprises a first sensor (6) and a controller (7), where the first sensor (6) is configured to read the linear position of the needle (2), and transmit the reading as an input to the controller (7), and the controller (7) is provided with a profile for the linear position of the needle (2) and is configured to receive the input from the first sensor (6) and compare the input from the first sensor (6) with the profile for the linear position of the needle (2) and sending an output to the linear electric motor correcting the stroke length and velocity of the needle to adapt to the profile for the linear position of the needle.