Hatena2009-04-03
code:hatena
<body>
*1238707279*Context Free Art
immediately
||
startshape EGG
rule EGG{
CIRCLE { }
CIRCLE { b 1 s 0.9 }
EGG { x 0.3 s 0.6 r 10}
EGG { x -0.3 s 0.6 r 10}
}
||<
Compared to the 3D version of StructureSynth, which tended to look cheap unless fed to a clean renderer, this one looks great even though it was just made in black and white.
||
startshape EGG
rule RING{
CIRCLE { }
CIRCLE { b 1 s 0.9 }
SQUARE { s 0.6 }
}
rule EGG{
RING {}
12 * {r 30} RING { s 0.2 x 0.4 r 30 }
EGG {s 0.6 r -10}
}
||<
The image appears to be a spiral though it is a wakka.
||
startshape EGG
rule RING{
CIRCLE { }
CIRCLE { b 1 s 0.9 }
SQUARE { s 0.6}
}
rule EGG{
RING {}
12 * {r 30} RING { s 0.2 x 0.4 r 30 }
EGG {s 0.8 r -10 z 0.1 a -0.1 b 0.2}
}
||<
Oh, there is also a z value in the sense of a z-order.
I can't find anything max-depth-like in the references.
||
startshape EGG
rule RING{
10 * {s 0.99 hue 30 z 0.1} CIRCLE {b 1}
CIRCLE {z 1 b 1 sat -1 s 0.9 }
}
rule EGG{
RING {hue 0 sat 1}
3 * {r 120} EGG1 { s 0.8 x 0.1 z 3 r 10}
}
rule EGG1{
RING {hue 0 sat 1}
3 * {r 120} EGG2 { s 0.8 x 0.1 z 3 r 10}
}
rule EGG2{
RING {hue 0 sat 1}
3 * {r 120 z 2} EGG3 { s 0.8 x 0.1 z 3 r 10}
}
rule EGG3{
RING {hue 0 sat 1}
3 * {r 120 z 2} EGG4 { s 0.8 x 0.1 z 3 r 10}
}
rule EGG4{
RING {hue 0 sat 1}
}
||<
I like that there is an alpha, but it seems like the only synthesis is additive synthesis. Also, I wonder if there is a way to create hollowed out ones.
||
startshape GATES
rule GATE {
SQUARE {x 1 s 1 3}
SQUARE {y 1}
SQUARE {x -1 s 1 3}
}
rule GATE_S {
GATE {}
GATE {z -0.1 b 0.2 s 1 0.6 skew 50 0 y -0.6 x 1.8}
}
rule GATES {
GATE_S {}
GATES { s 0.8 y 2 x 3 b 0.05}
GATE_SPAWN { s 0.8 y 2 x -3 b 0.05}
}
rule GATE_SPAWN {
GATE_S {}
}
rule GATE_SPAWN 0.1 {
GATES {}
}
||<
||
startshape EGG
background { b -1 }
rule GLOW {
20 * { s 0.98 }
CIRCLE {a -0.9 b 1}
}
rule ARC {
8 * {r 30 hue 3} GLOW { x 1 sat 1}
}
rule ARCS {
8 * {r 30 hue 3} ARC { x 4}
}
rule ARCSS {
9 * {r 30 hue 3} ARCS { x 16}
}
rule EGG {
3 * {r 120} ARCSS {x 24.5}
}
||<
||
startshape EGG
background { b -1 }
rule GLOW {
20 * { s 0.98 }
CIRCLE {a -0.9 b 1}
}
rule ARC {
8 * {r 30 hue 3} GLOW { x 1 sat 1}
}
rule ARCS {
8 * {r 30 hue 3} ARC { x 4}
}
rule ARCSS {
9 * {r 30 hue 3} ARCS { x 16}
}
rule ES {
ARCSS {}
ARCSS {r 180 x 41}
}
rule STAR {
7 * {r 51} ES {x 25}
}
rule EGG {
STAR {}
3 * {r 120} STAR {x 100 s 0.3 flip 180 }
}
||<
*1238742197*Is Context Free Art suitable for educational use?
>
id:TAKESAKO programming, cg Is this language suitable for educational use?
<<
In a word, "NO. It is not a teaching material to teach a programming language, but rather more like "I was just messing around with the parameters in the fractal generator, and I got some cool images! It's more like "I made a cool image when I was messing around with the parameters in the fractal generator! It may be good as a starting point to interest people who have no experience of "writing code to create interesting things," but it has no potential for further development.
Context Free Art is ultimately just a very limited expressive DSL for describing "shapes that can be written naturally using recurrence calls" such as tree curves and the like. Pros
- No need to explicitly write an exit condition for the recurrence call (it automatically stops when it becomes small enough), avoiding the common mistake of creating an infinite loop.
- Automatically scales to appropriate size
- Not only does it make recursive calls while drawing directly on the canvas, but it also automatically does the process of sorting by Z-order and then redrawing.
- Clean because it is anti-aliased (probably drawn once on a large canvas and then shrunk)
- It does the push and pop of context such as rotation, scale, color, etc. without explicitly writing it down.
On the other hand, there are some weaknesses. On the other hand, the cons are
- No variables, so a storm of magic numbers
- Since there is no addition, subtraction, or multiplication, "one-seventh of 360" is also written as a magic number, such as 51.4.
- The rules cannot take arguments, so if you want to make the same spiral but with different shrinking speeds, you have to copy and paste the rules and rewrite the magic number.
- If you wanted to write a code that said, "Do something every five," you'd write five nearly identical rules.
- Very low readability, such as a one-letter alphabetical instruction.
I guess. A recommended use case would be to let students play with it for about 30 minutes during information time at a junior high school or high school, and guide those who show strong interest to NodeBox, Processing, ActionScript, and so on.
*1238768103*Context Free Art 2
||
startshape EGG
rule RING{
100 * {s 0.98 hue 10 z 0.01} CIRCLE {b 1}
}
rule EGG{
5 * {r 6 z 1}{
12 * {r 30 } RING {sat 1 s 10 1}
}
}
||<
The first time I saw an HDR photo, I was amazed at how vivid it was, but now I'm just like, "Oh, it's HDR. I was surprised at the vividness of HDR photos when I first saw them. I wonder if there is such a thing as beauty that does not become obsolete. Also, with Context Free Art, it's extremely difficult to tweak the colors other than rotating the hue ring, so it's very hard to go any further. I think it would be better to stick to black and white than to use stale color schemes.
<hr>
||
startshape EGG
rule PART {
SQUARE {x -0.6 y -0.6}
SQUARE {x 0.6 y -0.6}
SQUARE {x 0.6 y 0.6}
SQUARE {x -0.6 y 0.6}
CIRCLE { b 1 s 2 z 1}
}
rule EGG {
PART {}
EGG {s 0.95 x 1.95 r 31}
}
||<
Spirals are spirals, too, and they are all stale isometric spirals. Well, it's not impossible to shake things up with a random element. Hmmm.
I was messing around with it and this is what I got.
||
startshape EGG
rule PART {
SQUARE {x -0.6 y -0.6}
SQUARE {x 0.6 y -0.6}
SQUARE {x 0.6 y 0.6}
SQUARE {x -0.6 y 0.6}
CIRCLE { b 1 s 2 z 1}
PART { s 0.75 z 1 r 5}
}
rule EGG {
PART {}
EGG {s 0.95 x 1.95 r 31 z -1}
}
||<
It's a spoiler if you can see the edges, but if you cut out just this part, it's a mysterious pattern.
<hr>
Oh, the twist got interesting when I increased the size of the twist.
||
PART { s 0.75 z 1 r 15}
||<
<hr>
Oh, I see some unwritten lines!
||
PART { s 0.75 z 1 r 15 flip 180}
||<
<hr>
rosy
<hr>
||
startshape EGG
rule EGG {
SQUARE { a -0.8}
EGG {s 0.8 1.01 a -0.01 r 5}
}
||<
*1238771461*Tea
f:id:nishiohirokazu:20090404001058j:image
*1238779865*Context Free Art for Math Study
Well, we are talking about the golden ratio.
||
startshape EGG
rule PART {
SQUARE {s 16.2 1 a -0.5 x 8.1}
SQUARE {s 16.2 1 a -0.5 x 18.1}
}
rule STAR {
5 * {r 72} SQUARE {y 4.3 s 26.2 0.3 a -0.7}
}
rule EGG {
STAR {x 13.1 y -4.1 }
STAR {x 13.1 y 4.1 flip 0}
EGG_DOWN{y -1.2}
EGG_UP{y 1.2}
}
rule EGG_DOWN{
PART {}
EGG_DOWN {y -1.2 s 0.62 1}
}
rule EGG_UP {
PART {}
EGG_UP {x 10 y 1.2 s 0.62 1}
}
||<
</body>
---
This page is auto-translated from /nishio/Hatena2009-04-03. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.