{{newin|[[0.10.0]]|100|type=function}}
Callback function triggered when the mouse wheel is moved.
== Function ==
=== Synopsis ===
<source lang="lua">
love.wheelmoved( x, y )
</source>
=== Arguments ===
{{param|number|x|Amount of horizontal mouse wheel movement. Positive values indicate movement to the right.}}
{{param|number|y|Amount of vertical mouse wheel movement. Positive values indicate upward movement.}}

=== Returns ===
Nothing.
== Examples ==
<source lang="lua">
local text = ""

function love.wheelmoved(x, y)
    if y > 0 then
        text = "Mouse wheel moved up"
    elseif y < 0 then
        text = "Mouse wheel moved down"
    end
end

function love.draw()
    love.graphics.print(text, 10, 10)
end
</source>


=== Smooth scrolling ===
<source lang="lua">
function love.load()
    posx, posy = love.graphics.getWidth() * 0.5, love.graphics.getHeight() * 0.5
    velx, vely = 0, 0 -- The scroll velocity
end

function love.draw()
    love.graphics.rectangle( 'line', posx, posy, 50, 50 )
end

function love.update( dt )
    posx = posx + velx * dt
    posy = posy + vely * dt

    -- Gradually reduce the velocity to create smooth scrolling effect.
    velx = velx - velx * math.min( dt * 10, 1 )
    vely = vely - vely * math.min( dt * 10, 1 )
end

function love.wheelmoved( dx, dy )
    velx = velx + dx * 20
    vely = vely + dy * 20
end
</source>

== See Also ==
* [[parent::love]]
[[Category:Callbacks]]
{{#set:Description=Callback function triggered when the mouse wheel is moved.}}
{{#set:Subcategory=Mouse}}
== Other Languages ==
{{i18n|love.wheelmoved}}