Skip to content

Instantly share code, notes, and snippets.

@becojo
Created November 4, 2013 02:03
Show Gist options
  • Save becojo/7297070 to your computer and use it in GitHub Desktop.
Save becojo/7297070 to your computer and use it in GitHub Desktop.
Dogescript canvas experiment
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Such canvas</title>
<style type="text/css">
canvas {
position: absolute;
top: 50%;
left: 50%;
margin-left: -250px;
margin-top: -250px;
}
</style>
<script type="text/javascript" src="test.djs.js"></script>
</head>
<body>
</body>
</html>
such random
very awesomeheight is plz Math.random
very coolwidth is plz Math.random
wow [awesomeheight*250, coolwidth*250]
very barks is plz Array with 'wow' 'such canvas' 'much javascript' 'wow' 'dogescript' 'amaze' 'wow' 'technologey' 'wowser'
such message
very lengthy is barks.length - 1
very randomized is plz Math.random
very index is plz Math.round with lengthy*randomized
wow barks[index]
such color
very green is plz Math.random with &
> 0.5 ? 'f' : '0'
very blue is plz Math.random with &
> 0.5 ? 'f' : '0'
wow '#f' + green + blue
such load
very doge is new Image
doge.src is 'http://f.cl.ly/items/3w0Z2t0f0N0c1W453Q3c/264px-Doge_(1).jpg'
very canvas is plz document.createElement with 'canvas'
very context is plz canvas.getContext with '2d'
canvas.width is 500
canvas.height is 500
context.font is '20pt Comic Sans MS'
plz document.body.appendChild with canvas
such dogeload
plz context.drawImage with doge -20 -20 1000 1000
wow
doge.onload is dogeload
very frame is plz Number with 0
such loop
very modernsize is plz random
very superbpos is plz random
plz context.drawImage with doge superbpos[0] superbpos[1] modernsize[0] modernsize[1]
rly frame % 4 is 0
very bark is plz message
very barkpos is plz random
context.fillStyle is plz color
plz context.fillText with bark 2*barkpos[0] 2*barkpos[1]
wow
frame is frame + 1
wow
plz setInterval with loop 100
wow
plz window.addEventListener with 'load' load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment