LivelyKernel / lively.morphic

An implementation of the Morphic user interface framework for lively.next.
13 stars 2 forks source link

Easy gradient objects? #149

Closed rksm closed 7 years ago

rksm commented 7 years ago

Gradients render great but are pretty awkward to create

  new LinearGradient({
    stops: [
      {offset: 0, color: Color.lightGray.lighter()},
      {offset: 1, color: new Color.rgb(236, 240, 241)}
    ]
  })

LinearGradient.create({"0": Color.lightGray.lighter(), "1": new Color.rgb(236, 240, 241)})

or maybe use parsing the argument given to fill?

morph.fill = "linear-gradient 0: light-gray 1: rgb(236, 240, 241)"?

merryman commented 7 years ago

I don't think that parsing strings is a good idea, since typos inside a string happen easily and we do not have tooling around that indicates malformed gradient strings or the like.

Take a look at the thing I pushed to the lively.graphics branch: https://github.com/LivelyKernel/lively.graphics/commit/fb13a6f15c28cd46a61e386c73f7075039625479

rksm commented 7 years ago

OK, thanks. We probably should figure out easy to remember interfaces for the other objects as well (RadialGradient, Shadow, Border). Let's talk about this later.