@@ -18,23 +18,23 @@ A = Observable(20.0) # width of the figure-eight
1818B = Observable (10.0 ) # height of the figure-eight
1919C = Observable (0.0 ) # size of right part of the figure-eight
2020D = Observable (0.0 ) # asymmetry factor
21- x0 = 0.0 # center x-coordinate
21+ x0 = Observable ( 0.0 ) # center x-coordinate
2222y0 = Observable (25.0 ) # center y-coordinate
2323theta = 0 * π/ 6 # rotation angle in radians
2424num_points = 200
2525
26- function figure_eight_y (A, B, C, D, y0)
26+ function figure_eight_y (A, B, C, D, x0, y0)
2727 x, y = figure_eight_path (A, B, C, D, x0, y0, theta, num_points)
2828 return y
2929end
3030
31- function figure_eight_x (A, B, C, D, y0)
31+ function figure_eight_x (A, B, C, D, x0, y0)
3232 x, y = figure_eight_path (A, B, C, D, x0, y0, theta, num_points)
3333 return x
3434end
3535
36- y = @lift (figure_eight_y ($ A, $ B, $ C, $ D, $ y0))
37- x = @lift (figure_eight_x ($ A, $ B, $ C, $ D, $ y0))
36+ y = @lift (figure_eight_y ($ A, $ B, $ C, $ D, $ x0, $ y0))
37+ x = @lift (figure_eight_x ($ A, $ B, $ C, $ D, $ x0, $ y0))
3838
3939# Create the figure and axis
4040fig = Figure ()
@@ -53,6 +53,7 @@ sg = SliderGrid(
5353 (label = " B (height)" , range = 5 : 0.01 : 20.0 , startvalue = 10.0 ),
5454 (label = " C (right_size)" , range = - 2.0 : 0.01 : 2.0 , startvalue = 0.0 ),
5555 (label = " D (asymmetry)" , range = - 3 : 0.01 : 3.0 , startvalue = 0.0 ),
56+ (label = " x0" , range = - 10 : 0.01 : 10.0 , startvalue = 0.0 ),
5657 (label = " y0" , range = 20 : 0.01 : 30.0 , startvalue = 25.0 )
5758)
5859
@@ -74,6 +75,10 @@ on(sg.sliders[4].value) do val
7475end
7576
7677on (sg. sliders[5 ]. value) do val
78+ x0[] = val
79+ end
80+
81+ on (sg. sliders[6 ]. value) do val
7782 y0[] = val
7883end
7984
0 commit comments