This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas = document.getElementById("canvas"); | |
var context = canvas.getContext("2d"); | |
var x = canvas.width / 2; | |
var y = canvas.height - 30; | |
var dx = 2; | |
var dy = -2; | |
var ballRadius = 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
const canvas = document.getElementsByTagName('canvas')[0]; | |
if (canvas.getContext) { | |
const ctx = canvas.getContext('2d'); | |
ctx.fillStyle = '#ecf0f1'; | |
const coordinates = [[200, 130], [250, 150], [270, 200], [250, 250], [200, 270], [150, 250], [130, 200], [150, 150]]; | |
for (const coordinate of coordinates) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten values | |
result = [] | |
values.each do |value| | |
result.concat(flatten(value)) if value.kind_of?(Array) | |
result << value unless value.kind_of?(Array) | |
end | |
result | |
end |