Can I clear only lines in a program? If not, is there an alternative?
#1
Posted 09 December 2016 - 07:38 PM
The way it functions:
- The prog converts every possible direction of the clock hands (1, 2, 3,.. 12) into radians. (angle=A)
(hour=H)
- Then a line is drawn with Coordinates x1=0 y1=0 and x2=-sin x 30 A y2=30 x cos A
- Each time, the loop repeats, H changes to H+1, A changes according to H, the line is cleared, and redrawn with the new values, resulting in a movement of the clock hands by one hour clockwise.
- Loop:
ViewWindow -64,64,0,-32,32,0
For 1-> H To 12
(Hours (H) convert to radian R)
SketchThick F-Line 0, 0, 30 x -sin A, 30 x cos A
Circle 0, 0, 30
(draws numbers on clock 1-12)
SketchThick F-Line 0, 0, 30 x -sin A, 30 x cos A
Cls
Next
-The loop is inside another loop
Problem: every movement of the Line cause the circle to disapear and reappear again, while the line is drawn twice during the loop, so it doesn't have the same effect.
However I only want the line to be cleared each time, I tried using Picture recall for the clock frame, but it doesn't work, and "Cls" clears everything
#2
Posted 11 December 2016 - 02:13 AM
To do that you'll have to remove all Cls commmands and instead of clearing the whole screen each frame, just clear the parts of the screen you are changing.
For example, if you only want to change the line, draw the line in white over the current line and then draw your new line.
- omarelnaggary likes this
#3
Posted 12 December 2016 - 04:30 AM
Yeah I thought about the PixelOff or PlotOff commands but they dont work. how can I draw a white line?To do that you'll have to remove all Cls commmands and instead of clearing the whole screen each frame, just clear the parts of the screen you are changing.
For example, if you only want to change the line, draw the line in white over the current line and then draw your new line.
#4
Posted 13 December 2016 - 07:59 AM
What exactly is happening when you use PixelOff or PlotOff?
Because those two functions are the only way to clear a pixel using BASIC. (that I know of)
#5
Posted 15 December 2016 - 06:06 AM
Hi everyone
I'm afraid Casio Basic does not support a command/function to draw line with pixels off, just like PlotOff against PlotOn.
If use PlotOn / PlotOff to draw line (clock hand), it will take long time, so this way looks just visionary and using Cls is much realistic in slow and poor Casio Basic.
====
You may not have any interest in C.Basic, a new Add-In Basic interpreter, but you can clear only the clock hand;
Instead of "Cls", use "SketchThick F-Line 0, 0, 30 x -sin A, 30 x cos A, C" in C.Basic.
C.Basic is very compatible with genuine Casio Basic and also supports extended commands and quite new commands.
F-Line x1, y1, x2, y2, [C / X]
- C: clear the line
- X: reverse the line
just for our info.
sentaro21 has been developed C.Basic and I've been supporting for testing and debugging, we speak Japanese, so all the documents are in our language.
Now I'm working on translation of manual and command reference.
http://egadget2.web....nterpreter.html
I just translated the above command reference;
http://egadget2.web....xtGraphCom.html
I hope to complete this by 17th Jan, 2017 (so almost all time stamp of articles are that date), but not sure possibly later.
Edited by Krtyski, 15 December 2016 - 06:54 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users