14 {
'X',
"F-[[X]+X]+F[+FX]-X"},
22std::string
E(std::string
s) {
26 for (
int i=0;
i<6;
i++) {
27 if (rules[
i].c ==
s[0]) {
28 return rules[
i].s +
E(
s.substr(1));
44 p.setColor(0xFFA6761D);
49 std::vector<struct Pt> ptstack;
50 std::string plant =
E(
E(
E(
E(
E(
"X")))));
51 const double len = 2.5;
52 struct Pt pt = {128, 256, 3.14};
54 path.moveTo(pt.x, pt.y);
56 for (std::string::iterator it=plant.begin(); it!=plant.end(); ++it) {
58 pt.x +=
len*sin(pt.a);
59 pt.y +=
len*cos(pt.a);
60 path.lineTo(pt.x, pt.y);
61 }
else if (*it ==
'+') {
62 pt.a += (0.15 + sin(
frame*2.0*3.14159)*0.05);
63 }
else if (*it ==
'-') {
64 pt.a += (-0.15 + sin(
frame*2.0*3.14159)*0.05);
65 }
else if (*it ==
'[') {
66 ptstack.push_back(pt);
67 }
else if (*it ==
']') {
70 path.moveTo(pt.x, pt.y);
constexpr SkColor SK_ColorLTGRAY
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawPath(const SkPath &path, const SkPaint &paint)
@ kStroke_Style
set to stroke geometry
REG_FIDDLE_ANIMATED(l_system_plant, 256, 256, false, 0, 3)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path