+ p1.draw(col1);\r
+ p1.shift(0, pitch);\r
+ }\r
+ ///- 2.1 Drawing a column\r
+\r
+ p1.shift(1, -height * pitch); //back to vertical intitial point after drawing one column.\r
+ }\r
+ disp.flip();\r
+ ///- 2 Drawing\r
+\r
+ while (!Keyboard.spc.pushed()) { }; //Wait until space key is pressed.\r
+ }\r
+\r
+\r
+ }\r
+\r
+}\r
+\r
+\r
+/*\r
+///+ Prefix\r
+//// Lines for set up Psychlops environment\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlightApp\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {///- Prefix\r
+\r
+\r
+\r
+ ///+ Main Routine\r
+ //// Psychlops runs at the first line of this function psychlops_main().\r
+ public void psychlops_main()\r
+ {\r
+ Canvas window = new Canvas(300, 300); //Create a window. Here, window variables are preset mode.\r
+\r
+ var FIGURE = Psychlops.Widgets.Browser.Element.byID("FIGURE");\r
+ var SIZE_X_ = Psychlops.Widgets.Browser.Element.byID("SIZE_X");\r
+ var SIZE_Y_ = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");\r
+ var COLOR_R = Psychlops.Widgets.Browser.Element.byID("COLOR_R");\r
+ var COLOR_G = Psychlops.Widgets.Browser.Element.byID("COLOR_G");\r
+ var COLOR_B = Psychlops.Widgets.Browser.Element.byID("COLOR_B");\r
+ var COLOR_BG = Psychlops.Widgets.Browser.Element.byID("COLOR_BG");\r
+ var Period_Size = Psychlops.Widgets.Browser.Element.byID("Period_Size");\r
+ var Period_Position = Psychlops.Widgets.Browser.Element.byID("Period_Position");\r
+ var Speed_HSize_ = Psychlops.Widgets.Browser.Element.byID("Speed_HSize");\r
+ var Speed_VSize = Psychlops.Widgets.Browser.Element.byID("Speed_VSize");\r
+ var Speed_VMotion = Psychlops.Widgets.Browser.Element.byID("Speed_VMotion");\r
+ double SIZE_X = SIZE_X_, SIZE_Y = SIZE_Y_;\r
+\r
+ ///+ 2\r
+ //// Set a figure size, position and color.\r
+ Rectangle figure = new Rectangle();\r
+ Ellipse figure2 = new Ellipse();\r
+ figure.set(SIZE_X_, SIZE_Y_); // Set the size of figure.\r
+ figure2.set(SIZE_X_, SIZE_Y_); // Set the size of figure.\r
+ figure.centering().shift(0, 0); // Move the figure to the starting point.\r
+ figure2.centering().shift(0, 0); // Move the figure to the starting point.\r
+ ///- 2\r
+\r
+ int frame = 0;\r
+ int looming_direction = 1, motion_dir = 1;\r
+ double direction = 1.0;\r
+ //looming_direction is a variable for size change.\r
+ //motion_dir is a variable for motion direction.\r
+ ///+ 3 Drawing loop\r
+ //// Draw each frames in a "while loop".\r
+ while (!Keyboard.esc.pushed())\r
+ { //exit a program when the escape key is pressed down.\r
+ window.clear(COLOR_BG); // Clear the window with a designated gray-scale level.\r
+\r
+ ///+ 3.1\r
+ //// Calculate object's position and size for each frame.\r
+\r
+ if (frame % Period_Size == 0)\r
+ { // a direction of size change will reverse at designated frames.\r
+ looming_direction = looming_direction * -1;\r
+ }\r
+\r
+ if (frame % Period_Position == 0)\r
+ { // motion direction will reverse at designated frames.\r
+ motion_dir *= -1;\r
+ }\r
+\r
+ ///- 3.1\r
+\r
+ ///+ 3.2 \r
+ //// Settting figure's properties\r
+ figure.resize(figure.getWidth() + looming_direction * 1, // Scaling the figure in a direction given by "looming_direction".\r
+ figure.getHeight() + looming_direction * 1);// Scaling the figure in a direction given by "looming_direction".\r
+ figure.shift(motion_dir * 1.0, motion_dir * Speed_VMotion);// Move the figure for 1 pixel in direction given by "motion_dir". \r
+ figure2.resize(figure.getWidth() + looming_direction * 1, // Scaling the figure in a direction given by "looming_direction".\r
+ figure.getHeight() + direction * Speed_VSize);// Scaling the figure in a direction given by "looming_direction".\r
+ figure2.shift(motion_dir * 1.0, motion_dir * Speed_VMotion);// Move the figure for 1 pixel in direction given by "motion_dir". \r
+ /*\r
+ figure.resize(figure.getWidth() + looming_direction * 1, // Scaling the figure in a direction given by "looming_direction".\r
+ figure.getHeight() + looming_direction * 1);// Scaling the figure in a direction given by "looming_direction".\r
+ figure.shift(motion_dir * 1.0, motion_dir * Speed_VMotion);// Move the figure for 1 pixel in direction given by "motion_dir". \r
+ figure2.resize(figure.getWidth() + looming_direction * 1, // Scaling the figure in a direction given by "looming_direction".\r
+ figure.getHeight() + direction * Speed_VSize);// Scaling the figure in a direction given by "looming_direction".\r
+ figure2.shift(motion_dir * 1.0, motion_dir * Speed_VMotion);// Move the figure for 1 pixel in direction given by "motion_dir". \r
+ * * /\r
+ ///- 3.2\r
+\r
+ ///+ 3.3 \r
+ ////Drawing\r
+ if ("Rectangle".Equals(FIGURE))\r
+ {\r
+ figure.draw(new Color(COLOR_R, COLOR_G, COLOR_B)); // Drawing the figure with a designated color at designated position.\r