Last active
April 28, 2019 14:51
-
-
Save cormullion/6d39b18a1eb47615e546a69f438d2735 to your computer and use it in GitHub Desktop.
This file contains 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
using Luxor, Colors | |
function flame(pos, col, action=:none) | |
@layer begin | |
translate(pos) | |
col == 1 && (mesh1 = mesh(box(O - (0, 100), 200, 260), [ | |
Colors.RGB(colorant"orange"), | |
Colors.RGB(colorant"darkorange"), | |
Colors.RGB(colorant"red"), | |
Colors.RGB(colorant"firebrick4")])) | |
col == 2 && (mesh1 = mesh(box(O - (0, 100), 200, 260), [ | |
Colors.RGB(colorant"darkolivegreen1"), | |
Colors.RGB(colorant"chartreuse"), | |
Colors.RGB(colorant"limegreen"), | |
Colors.RGB(colorant"mediumseagreen")])) | |
col == 3 && (mesh1 = mesh(box(O - (0, 100), 200, 260), [ | |
Colors.RGB(colorant"purple"), | |
Colors.RGB(colorant"blue"), | |
Colors.RGB(colorant"red"), | |
Colors.RGB(colorant"magenta")])) | |
setmesh(mesh1) | |
scale(0.36) | |
newpath() | |
move(Point(-63., -627.)) | |
curve(Point(-36., -610.), Point(208., -451.), Point(208., -246.)) | |
curve(Point(208., -108.), Point(86., -27.), Point(66., -4.)) | |
curve(Point(79., -48.), Point(117., -117.), Point(114., -231.)) | |
curve(Point(116., -301.), Point(24., -375.), Point(-11., -405.)) | |
curve(Point(-24., -360.), Point(-49., -309.), Point(-73., -272.)) | |
curve(Point(-98., -235.), Point(-147., -194.), Point(-148., -141.)) | |
curve(Point(-151., -59.), Point(-83., -0.), Point(-83., -0.)) | |
curve(Point(-83., -0), Point(-171., -58.), Point(-199., -94.)) | |
curve(Point(-229., -133.), Point(-243., -164.), Point(-243., -216.)) | |
curve(Point(-243., -268.), Point(-218., -312.), Point(-193., -343.)) | |
curve(Point(-160., -384.), Point(-128., -434.), Point(-112., -463.)) | |
curve(Point(-91., -502.), Point(-68., -602.), Point(-63., -627.)) | |
do_action(action) | |
end | |
end | |
function spark(pt, k) | |
@layer begin | |
translate(pt + (0, -60)) | |
scale(0.22) | |
setcolor((Luxor.darker_red, Luxor.darker_green, Luxor.darker_purple)[k]) | |
p = [Point(85, -235.), | |
Point(-6., -38.), | |
Point(168., -40.), | |
Point(-149., 250.), | |
Point(-10., 32.), | |
Point(-178., 34.)] | |
poly(p, :fill, close=true) | |
end | |
end | |
function main() | |
Drawing(500, 500, "/tmp/energy.png") | |
background(0, 0, 0, 0.0) | |
origin() | |
for (k, pt) in enumerate(ngon(O + (0, 140), 140, 3, π/6, vertices=true)) | |
flame(pt, k, :fill) | |
spark(pt, k) | |
end | |
finish() | |
preview() | |
end | |
main() |
Author
cormullion
commented
Apr 28, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment