I've been taking some animations from codepen.io and refactoring them into classes.
I've seen this syntax a couple times that I've never seen before, where in the HTML file, an element is present that has an id -that is not in quotes-.
I noticed this at first when I was trying to figure out where some of the variables in the JS referred to.
Whats up with this way of doing things? I've noticed it in a few different animations from codepen.
var w = c1.width = c2.width = window.innerWidth,
h = c1.height = c2.height = window.innerHeight,
ctx1 = c1.getContext('2d'),
ctx2 = c2.getContext('2d'),
constAmount = ((w*h)/8000)|0,
minSpeed = 5,
maxSpeed = 7,
minSize = 20,
maxSize = 30,
<body>
<canvas id=c1></canvas>
<canvas id=c2></canvas>
<script src="js/index.js"></script>
</body>
</html>
Also another quick question, what is the syntax h = c1.height = c2.height = window.innerHeight
?
Does that mean both c1.height and c2.height are equal to the last? or does c1.height only equal window.innerHeight because c2.height equals it?