Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,27 @@
----------------------------------------
-- Creates an image of a fractal tree
-- @param {integer} width
-- @param {integer} height
-- @param {integer} fractalDepth
-- @param {integer|float} initSize
-- @param {float} spreadAngle
-- @param {float} [scaleFactor=1.0]
-- @return {image}
----------------------------------------
on fractalTree (width, height, fractalDepth, initSize, spreadAngle, scaleFactor)
if voidP(scaleFactor) then scaleFactor = 1.0
img = image(width, height, 24)
img.fill(img.rect, rgb(0,0,0))
_drawTree(img, width/2, height, -PI/2, fractalDepth, initSize, spreadAngle, scaleFactor)
return img
end
on _drawTree (img, x1, y1, angle, depth, size, spreadAngle, scaleFactor)
if (depth) then
x2 = x1 + cos(angle)*depth*size
y2 = y1 + sin(angle)*depth*size
img.draw(x1, y1, x2, y2, [#color:rgb(255,255,255)])
_drawTree(img, x2, y2, angle-spreadAngle, depth-1, size*ScaleFactor, spreadAngle, scaleFactor)
_drawTree(img, x2, y2, angle+spreadAngle, depth-1, size*ScaleFactor, spreadAngle, scaleFactor)
end if
end

View file

@ -0,0 +1,5 @@
fractalDepth = 10
initSize = 7.0
spreadAngle = 35*PI/180
scaleFactor = 0.95
img = fractalTree(480, 380, fractalDepth, initSize, spreadAngle, scaleFactor)