This is part two of the Beginners Guide to Writing Fractal formulas.
In preparation for this you need to start UF
File-new-fractal
Select Fttutorial
Click ok
Make sure you have the Properties window up click the formula tab.
In that tab, notice the three little icons at the top
A circular arrow reload
Three little dots select
A little page edit
This last one is the one (edit) we'll click. Click it don't be afraid.
You should now see a fractal window with a dumbbell shaped image and a
A text window(like notepad) titled FTtut.
All the editing will occur in this window.
Highlight the existing formula and copy and paste another instance of
it into the editor.
Change the title of this second instance to FTtutorial2
Well what do I do now?
I think the first thing we should do is make A and B user selectable.
Lets do it. Any variables that are not system variables (Remember the #
sign in #PIXEL) has to be preceded by an @ symbol. These we will need to
define in our default section. This is done by using a parameter block.
PARAM variable name
Assignments
ENDPARAM
So lets do the A variable first. We're going to call it FTA (you can
call it anything as long as its not a system variable) so the parameter
block begins to look like
PARAM FTA
Assignments
Endparam
Whats with the assignments stuff?
These assignments are used to define your new parameter. Lets assign it
a default value so people won't see a black screen when they bring up
your formula.
PARAM FTA
Default = (1.0,0.0)
Endparam
This is enough but lets help the end-user a little. We'll add a caption
to the formula Tab so people will see it. Captions need to be enclosed in
quotes.
PARAM FTA
Default = (1.0,0.0)
Caption = "Coeff A"
Endparam
A little more user help, we'll put a hint so that when the user hovers
over the input he'll get this little message.
PARAM FTA
Default = (1.0,0.0)
Caption = "Coeff A"
Hint = "A in AZ^3+BZ+C"
Endparam
At this point we are going to use our newly defined parameter by
changing the asignment in the INIT sect for the parameter A Lets change
it from
A = 1
to
A = @FTA
Your formula should look like this now
FTtutorial2{
; If this tutorial goes any slower I'll have to go to the dentist.
; All right I made the appointment for the dentist
INIT:
Z = #PIXEL
A = @FTA
B = 1
C = #PIXEL
LOOP:
Z = A * Z^3 + B * Z + C
BAILOUT:
|Z| < 4
DEFAULT: ;It's a great habit to just comment
PARAM FTA
Default = (1.0,0.0)
Caption ="Coeff A"
Hint = "A in AZ^3+BZ+C"
Endparam
}
Click the little x box in FTtut and click yes save your changes.
In the formula tab click the three dot icon and select FTtutorial2
The image is the same as before but now you have a new drop down in the
properties tab for changing the valut of A.
Play a little with itb
&cool huh rotates the image and stuff and when
you click the icon at the bottom that looks like two speakers it will
restore the default value for that parameter.
Click the edit again and lets do the same for the B parameter. Your
formula should now look like this:
FTtutorial2{
; If this tutorial goes any slower I'll have to go to the dentist.
; All right I made the appointment for the dentist
; A root canal is more pleasureful than this excruciating slow torture
INIT:
Z = #PIXEL
A = @FTA
B = @FTB
C = #PIXEL
LOOP:
Z = A * Z^3 + B * Z + C
BAILOUT:
|Z| < 4
DEFAULT: ;It's a great habit to just comment
PARAM FTA
Default = (1.0,0.0)
Caption ="Coeff A"
Hint = "A in AZ^3+BZ+C"
Endparam
PARAM FTB
Default = (1.0,0.0)
Caption ="Coeff B"
Hint = "B in AZ^3+BZ+C"
Endparam
}
click the close and save your changes. Then click the circular arrow
to reload your formula and now you have a little drop down to select
either parameter A or B. Hover and check out your hints
This is the end of chapter two. Next chapter we might play with the
bailout section or create a julia switch formula for our formula