Skip to content

Instantly share code, notes, and snippets.

@statico
Created November 16, 2011 05:47
Show Gist options
  • Save statico/1369379 to your computer and use it in GitHub Desktop.
Save statico/1369379 to your computer and use it in GitHub Desktop.
craftyjs cursor
Crafty.sprite 20, '/images/sprites/pointer.png',
pointer: [0, 0]
# Pointer?
pointer = Crafty.e('2D, DOM, pointer, SpriteAnimation')
.animate('pointer', 0, 0, 1)
.bind 'enterframe', ->
if not @isPlaying()
@animate 'pointer', 20
Crafty.addEvent this, Crafty.stage.elem, 'mousemove', (e) ->
pointer.x = e.clientX
pointer.y = e.clientY
Crafty.stage.elem.style.cursor = 'none'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment