Code Monkey home page Code Monkey logo

Comments (3)

MtnViewJohn avatar MtnViewJohn commented on July 19, 2024

The single letter abbreviations already have long variants, except for x, y, and z. r and rotate are interchangeable, same for s and size, f and flip, trans and transform, h and hue, sat and saturation, b and brightness, a and alpha. skew has always just been skew, same with time and timescale.

We have already done a compatibility-breaking syntax change going from cfdg 2.x to cfdg 3.x. The code you are working with is in the old syntax, you can translate it here. I don't want to do another major syntax change unless it brings compelling new features.

On a side note, your code does randomness in the cfdg 2 manner, where random rule selection is the only way to make a shape do different things. With cfdg 3 you can have random actions inside a rule. Your grass code can be reduced to 5 rules:

startshape field

tile {s 150 }
background { hue 83.1 sat 0.4664 b -0.1255}

rule field
{
  grass{hue 97.6 sat 0.7282 b 0.7647}
}

# Add a chance to add a seedling. 
rule grass 5
{
  seedling{}
  grass{b -0.1…0.2 hue -0.1…0.1 sat -0.01…0.01
        r -5…5 x -10…10 y -10…10}
}

rule grass 0.1
{
  grass{r 0…360}
}

rule grass 0.01
{
  // end
}

rule seedling
{
  SQUARE{}
  seedling{y 1 r -2…2 s 0.991}
}

from context-free.

synxroform avatar synxroform commented on July 19, 2024

It is undesirable to elliminate startshape keyword, because it's a good way to switch between different branches during debugging. In the node based systems like Fusion, Nuke or Touchdesigner you can change the current node you want to output to the screen, just think of it in similar way.

from context-free.

MtnViewJohn avatar MtnViewJohn commented on July 19, 2024

I would never get rid of startshape. But I should make it optional. If there is no startshape then the first shape in the file is the startshape. I would rather do this than pick a default startshape name like main or scene because many non-english speakers use Context Free.

I think that adding a Pythonic syntax is a non-starter. But I would be interested in a ContextFree module for Python. I only know a little about Python. But it seems to me that function decorators could be used to allow shape rules to be expressed as Python code. The AGG rendering engine could be bound to Python as a C++ library. It would be a fun project for someone who knows a lot of Python. I would be glad to help if someone wanted to do this.

from context-free.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.