For 3D graphics kindly refer to the documentation on Renderer3d and Scene.
There are some examples of spheres.
In my last example the ball will not be visible if I move it outside the
bounds of the Canvas that contains it.
Note that in Curl there are two differnt kinds of Boxes. One that can contain only one child (e.g. Frame) and the other that can contain more than one children (e.g. Canvas). Kindly read the documentation on Canvas to see how to add children to it. Here is one way of doing it.
{let frame:Frame =
{Frame font-size = 14pt, font-weight = "bold", background = "" } } {let c1:Canvas=
{Canvas background = "", width = 9cm, height = 8cm, {ShapeGroup translation = {Distance2d 0cm, 7cm}, {RectangleShape {GRect 0cm, 1cm, 1cm, 0cm}, color = "#006968", translation = {Distance2d (1.1cm * 1), 0cm} }, {RectangleShape {GRect 0cm, 1cm, 5cm, 0cm}, color = "#2462a2", translation = {Distance2d (1.1cm * 6), 0cm} } } } } {do
{c1.add frame, x = 2cm, y = 2cm} } {CommandButton
label = "bounce", {on Action do let random:RolledRandom = {RolledRandom 0, 5} {frame.add {random.next-roll}, replace? = true} } } {value c1}
{curl 4.0 applet}
{curl-file-attributes character-encoding = "windows-latin-1"} {import * from CURL.GUI.SHAPES}
{let c1:Canvas=
{Canvas background = "", width = 9cm, height = 8cm, {ShapeGroup translation = {Distance2d 0cm, 7cm}, {RectangleShape {GRect 0cm, 1cm, 1cm, 0cm}, color = "#006968", translation = {Distance2d (1.1cm * 1), 0cm} }, {RectangleShape {GRect 0cm, 1cm, 5cm, 0cm}, color = "#2462a2", translation = {Distance2d (1.1cm * 6), 0cm} } } } } {value c1}
{hrule}
{let e1:EllipseShape =
{EllipseShape {GRect 0cm, 1cm, 1cm, 0cm}, color = "#006968" } } {e1.apply-translation 0cm, 1cm}
{let c2:Canvas= {Canvas background = "", width = 9cm, height = 8cm, e1 } } {value c2}
{let f:Frame = {Frame}}
{value f} {CommandButton label = "bounce", {on Action do let random:RolledRandom = {RolledRandom 0, 5} {let t:Timer = {Timer interval = .1s, repeat = 30, {on TimerEvent do let delta:int = {random.next-roll} {f.add delta, replace? = true} {c2.move-to-xy e1, 1cm, delta * 1cm} } } } } }
__________________________________________________ |
- Re: Generating Random number Duke Briscoe
- Re: Generating Random number pang tee
- Re: Generating Random number Kamal Bhatt
- Re: Generating Random number pang tee
- Re: Generating Random number Kamal Bhatt
- Re: Generating Random number pang tee
- Bouncing balls in Curl pang tee
- Re: Bouncing balls in Curl pang tee
- Re: Bouncing balls in Curl Duke Briscoe
- Re: Bouncing balls in Curl pang tee
- Re: Bouncing balls in Curl Kamal Bhatt
- Re: Bouncing balls in Curl Duke Briscoe
- Re: Bouncing balls in Curl pang tee
- Re: Bouncing balls in Curl Kamal Bhatt
- Re: Bouncing balls in Curl pang tee