daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Oct 21st, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Danboard
  2.   constructor: (id) ->
  3.     $danboard = $(id)
  4.     baseRotateX = 60
  5.     baseRotateY = 150
  6.     baseRotateZ = -20
  7.  
  8.     $(window).keydown (e) =>
  9.       if e.which is 37  # KEYLEFT
  10.         e.preventDefault()
  11.         baseRotateY -= 1
  12.         $danboard.css
  13.           WebkitTransform: "rotateX(#{baseRotateX}deg) rotateY(#{baseRotateY}deg) rotateZ(#{baseRotateZ}deg)"
  14.       else if e.which is 39  # KEYRIGHT
  15.         e.preventDefault()
  16.         baseRotateY += 1
  17.         $danboard.css
  18.           WebkitTransform: "rotateX(#{baseRotateX}deg) rotateY(#{baseRotateY}deg) rotateZ(#{baseRotateZ}deg)"
  19.  
  20.       else if e.which is 38  # KEYUP
  21.         e.preventDefault()
  22.         baseRotateX += 1
  23.         $danboard.css
  24.           WebkitTransform: "rotateX(#{baseRotateX}deg) rotateY(#{baseRotateY}deg) rotateZ(#{baseRotateZ}deg)"
  25.  
  26.       else if e.which is 40  # KEYDOWN
  27.         e.preventDefault()
  28.         baseRotateX -= 1
  29.         $danboard.css
  30.           WebkitTransform: "rotateX(#{baseRotateX}deg) rotateY(#{baseRotateY}deg) rotateZ(#{baseRotateZ}deg)"
  31.  
  32.  
  33. $ ->
  34.   if document.getElementById('danboard')?
  35.     danboard = new Danboard('#danboard')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top