alix
Junior Member
Posts: 57
|
Post by alix on Apr 16, 2008 6:10:36 GMT -5
Hello Everyone,
Here is a very simple question : Is it possible to display successive objects on top of each other ?
In the code below, a yellow box is displayed after a black box. Is it possible to display the yellow box on top of, rather than below, the black box ? (without having to click on any "next" button).
@+
graphic #g, 300,100 #g fill("black") #g color("white") #g size(5) #g line(0,50,300,50) render #g #g fill("yellow") #g color("red") #g size(5) #g line(0,50,300,50) render #g
|
|
|
Post by carlgundel on Apr 16, 2008 9:44:12 GMT -5
Hello Everyone, Here is a very simple question : Is it possible to display successive objects on top of each other ? In the code below, a yellow box is displayed after a black box. Is it possible to display the yellow box on top of, rather than below, the black box ? (without having to click on any "next" button). @+ graphic #g, 300,100 #g fill("black") #g color("white") #g size(5) #g line(0,50,300,50) render #g #g fill("yellow") #g color("red") #g size(5) #g line(0,50,300,50) render #g Do you mean you want to display them one way, and then after a moment switch them the other way? -Carl
|
|
alix
Junior Member
Posts: 57
|
Post by alix on Apr 16, 2008 10:15:44 GMT -5
with the following code : graphic #g, 50,50 for i=1 to 3 #g fill("black") #g color("yellow") #g place(20,25) #g "\";i render #g next i
I get this : Is it possible to have box1 displayed, then box2 displayed on top of box1, and then box3 displayed on top of box2 ? so as to get some sort of animation ... @+
|
|
|
Post by mikeukmid on Apr 16, 2008 10:21:57 GMT -5
graphic #g, 300,100
#g fill("black") #g color("white") #g size(5) #g line(0,50,300,50) render #g 'wait 3 seconds t=time$("ms") tt = t+3000 [delay] if time$("ms") < tt then goto [delay] cls #g fill("yellow") #g color("red") #g size(5) #g line(0,50,300,50) render #g
I was going to suggest the above, but it doesn't work. Putting a link in place of the delay does work, no doubt you already tried these, hence your query. The delay seems to be executed first.
Maybe a bug?
|
|
|
Post by carlgundel on Apr 16, 2008 13:59:40 GMT -5
graphic #g, 300,100
#g fill("black") #g color("white") #g size(5) #g line(0,50,300,50) render #g 'wait 3 seconds t=time$("ms") tt = t+3000 [delay] if time$("ms") < tt then goto [delay] cls #g fill("yellow") #g color("red") #g size(5) #g line(0,50,300,50) render #g
I was going to suggest the above, but it doesn't work. Putting a link in place of the delay does work, no doubt you already tried these, hence your query. The delay seems to be executed first. Maybe a bug? No, it isn't a bug. Run BASIC is not designed to create animations in this way. The page will not be rendered until the it reaches a WAIT, or an INPUT or until it ends. For a Javascript technique that may be helpful, check this out runbasic.wikispaces.com/Timer+Replacement-Carl
|
|
|
Post by mikeukmid on Apr 16, 2008 14:16:50 GMT -5
Thanks Carl,
That's an important point to remember - 'wait, input or end before render'! Usually I would go with making an animated GIF to do what alix was suggesting, unless he needed to programatically animate.
|
|
|
Post by StefanPendl on Apr 17, 2008 11:51:08 GMT -5
... what alix was suggesting, unless he needed ... Sorry, female not male, have done this mistake before too Sure it is good to know, that rendering is done, when code pauses.
|
|
alix
Junior Member
Posts: 57
|
Post by alix on Apr 17, 2008 12:28:44 GMT -5
OK, thanks, I will use the javascript code for my project. Will it ever be possible to program animation with RunBASIC ? just asking ... because animation is what makes LB and JB really fun for me, so it would be fantastic to have it in RB @+
|
|
|
Post by mikeukmid on Apr 17, 2008 13:04:58 GMT -5
Sorry Alix for changing your gender, I must be more observant in future
|
|
alix
Junior Member
Posts: 57
|
Post by alix on Apr 17, 2008 14:56:30 GMT -5
Hey Mike, no offense taken. On the contrary, where else, but the Internet, can one change gender effortlessly ? When it comes to the mind, gender is just an other category, I quite enjoyed the confusion +@
|
|