I've been playing around with Shapes and I've noticed that the GRect doesn't seem to behave the way I thought it should. For example if I create a EllipseShape and add it to a canvas I can specify the positioning of the ellipse when I create the Ellipse vis the GRect (I also can use the translation attribute). I would have thought that the GRect of a shape is aligned with its parent so if
Then sphere3's GRect should be relative to sphere2, but its not. It's stays relative to sphere1 regardless of how deep in the object graphy I go. I don't know if that makes sense but here is my applicaitons I'm working on which I'm trying to make behave like this example written in the processing.org langauge.
{ canvas.add sphere1}
{sphere1.add spehre2}
{sphere2.add sphere3}
Then sphere3's GRect should be relative to sphere2, but its not. It's stays relative to sphere1 regardless of how deep in the object graphy I go. I don't know if that makes sense but here is my applicaitons I'm working on which I'm trying to make behave like this example written in the processing.org langauge.
{curl 6.0 applet}
{import * from CURL.GUI.SHAPES}
{def ran = {Random}}
{def colour = {Color 0,0,0,opacity=0.0}}
{define-class public SmokeRing {inherits EllipseShape}
{constructor public {default ...}
{construct-super.EllipseShape ...}
{Timer
interval = ({ran.next-in-range 1,20}/10) * 1s,
repeat = 1,
{on TimerEvent do
def lrOffset = 1mm ||{ran.next-in-range 1,10} *1mm
def wOffset = 1mm ||{ran.next-in-range 1,10} *1mm
def childRing =
{SmokeRing
{GRect (5mm + lrOffset), (5mm - lrOffset), (5mm + wOffset), (5mm - wOffset)},
color= colour,
border-color="black",
border-width=1pt
}
{self.add childRing}
}
}
}
}
{value
let anchorRing:SmokeRing = {SmokeRing {GRect 5mm, 5mm, 5mm, 5mm}, color="red",translation = {Distance2d 20mm,20mm}}
def canvas = {Canvas width=100mm, height=100mm, background="silver"}
{canvas.add anchorRing}
canvas
}