Line 5: | Line 5: | ||
<script> | <script> | ||
/** | /** | ||
− | Author: Lucas Mota Ribeiro | + | Original Author: Lucas Mota Ribeiro |
This project creates an adaptive array of leafs and animate them. | This project creates an adaptive array of leafs and animate them. | ||
*/ | */ | ||
Line 16: | Line 16: | ||
}); | }); | ||
− | var MID_HEIGHT = | + | var MID_HEIGHT = 2; // The height of the middle of the leaf. |
− | var HEIGHT = | + | var HEIGHT = 42; // Leaf Height. |
var WIDTH = 4; // Leaf width. | var WIDTH = 4; // Leaf width. | ||
var distance = 5; // Distance between leafs. | var distance = 5; // Distance between leafs. | ||
Line 26: | Line 26: | ||
var FPS = 30; | var FPS = 30; | ||
− | var SPEED = | + | var SPEED = 1.75; |
− | var LAMBDA = 0. | + | var LAMBDA = 0.05; |
/*! | /*! | ||
Line 41: | Line 41: | ||
* Canvas element to draw the leafs. | * Canvas element to draw the leafs. | ||
*/ | */ | ||
− | var canvas = document.getElementById(" | + | var canvas = document.getElementById("2021_grass_canvas"); |
/*! | /*! | ||
Line 262: | Line 262: | ||
*/ | */ | ||
function updateCanvasHeight(new_cheight) { | function updateCanvasHeight(new_cheight) { | ||
− | var canvas = document.getElementById(" | + | var canvas = document.getElementById("2021_grass_canvas"); |
canvas.height = Number(new_cheight); | canvas.height = Number(new_cheight); | ||
} | } | ||
Line 275: | Line 275: | ||
</script> | </script> | ||
− | <canvas height="150px" id=" | + | <canvas height="150px" id="2021_grass_canvas"></canvas> |
</html> | </html> |
Revision as of 09:51, 6 October 2021