exam3-programmingpartillustration.xlsx
50 points total Design and implement an application that displays an animation of an image of choice (not smiling face) moving across the screen from left to right following a sinusoidal path (see sin curve) driven by the Timer. The middle (y=0) of the sine curve should be located at canvasHeight / 2. 15 points Draw a sine curve (one period) that stretches across the width of the canvas with vertical min and max “touching” the the top and bottom of the canvas. The sine curve should be adjusted as the canvas size changes. 20 points Have the image of choice travel along the sinusoidal path at a constant speed. When the image disappears on the right hand side, it should re-appear on the left side. 15 points Adjust the speed of the moving image based on its y-position. Note that when at the peak (top of the canvas as shown below), the timer should tick at its fastest rate (smaller delay) and when at the bottom, the timer should tick at the slowest rate (larger delay). Max and min delay values should be passed to the constructor along with canvas size, foreground/drawing and background color. Note, you do not have to draw red arrows or maxSpeed, y=0, and minSpeed. See the Excel file for information on calculation of y-values
>Sheet > 0
00
0
07 y 6
6
9
.1 2
01
. 00
. .4 2
. .10 .41 .7 . 5
. 10
7
. 0
5
.8 .0 .21 . 25
.5722
.8 9
9
.1 5
1
.31 2
8
. 4
.3 8
8
. 61
.6 .4 .1 8
.9 9
.6821
.38 89
. 3
.9447
.5 .0609
.5 0
.0646
.5 .9527
.3525
.7 .0621
1
.64 .8960
. 3
. 7
.4460
.5648
.6510
.7041
.7 .6632
.5819
.4665
.3 .1 .65 . 0
.0441
. 5
. 5
. 1
. 3
.0941
3
.0000
149.9815 149.8335 148.8172 146.8834 145.2875 140. 6 9
8
90.0630 86.2508 5
80.3740 78.3748 2
61.7272 46.3525 8
-149.9815 -149.9260 -149.7040 -149.5376 -149.3343 -149.0941 -148.8172 -148.5035 -148.1533 -147.7664 -146.8834 -146.3875 -145.8555 -144.6836 -143.3690 -142.6585 -141.1321 -140.3166 -139.4665 -138.5819 -137.6632 -136.7105 -135.7241 -134.7041 -133.6510 -132.5648 -131.4460 -130.2947 -126.6492 -125.3711 -124.0621 -122.7225 -121.3525 -119.9527 -118.5233 -115.5770 -112.5167 -110.9447 -109.3453 -107.7189 -106.0660 -104.3869 -99.1968 -97.4172 -93.7864 -91.9361 -90.0630 -88.1678 -84.3125 -82.3534 -80.3740 -78.3748 -76.3562 -72.2631 -68.0986 -63.8669 -61.7272 -57.4025 -53.0212 -50.8107 -48.5876 -46.3525 -44.1060 -41.8487 -39.5810 -37.3035 -35.0168 -28.1072 -25.7894 -23.4652 -21.1352 -18.8000 -16.4601 -14.1162 -11.7689 -9.4186 -7.0660 -4.7116 -2.3561 0.0000 y 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 120.0 121.0 122.0 123.0 124.0 125.0 126.0 127.0 128.0 129.0 130.0 131.0 132.0 133.0 134.0 135.0 136.0 137.0 138.0 139.0 140.0 141.0 142.0 143.0 144.0 145.0 146.0 147.0 148.0 149.0 150.0 151.0 152.0 153.0 154.0 155.0 156.0 157.0 158.0 159.0 160.0 161.0 162.0 163.0 164.0 165.0 166.0 167.0 168.0 169.0 170.0 171.0 172.0 173.0 174.0 175.0 176.0 177.0 178.0 179.0 180.0 181.0 182.0 183.0 184.0 185.0 186.0 187.0 188.0 189.0 190.0 191.0 192.0 193.0 194.0 195.0 196.0 197.0 198.0 199.0 200.0 201.0 202.0 203.0 204.0 205.0 206.0 207.0 208.0 209.0 210.0 211.0 212.0 213.0 214.0 215.0 216.0 217.0 218.0 219.0 220.0 221.0 222.0 223.0 224.0 225.0 226.0 227.0 228.0 229.0 230.0 231.0 232.0 233.0 234.0 235.0 236.0 237.0 238.0 239.0 240.0 241.0 242.0 243.0 244.0 245.0 246.0 247.0 248.0 249.0 250.0 251.0 252.0 253.0 254.0 255.0 256.0 257.0 258.0 259.0 260.0 261.0 262.0 263.0 264.0 265.0 266.0 267.0 268.0 269.0 270.0 271.0 272.0 273.0 274.0 275.0 276.0 277.0 278.0 279.0 280.0 281.0 282.0 283.0 284.0 285.0 286.0 287.0 288.0 289.0 290.0 291.0 292.0 293.0 294.0 295.0 296.0 297.0 298.0 299.0 300.0 301.0 302.0 303.0 304.0 305.0 306.0 307.0 308.0 309.0 310.0 311.0 312.0 313.0 314.0 315.0 316.0 317.0 318.0 319.0 320.0 321.0 322.0 323.0 324.0 325.0 326.0 327.0 328.0 329.0 330.0 331.0 332.0 333.0 334.0 335.0 336.0 337.0 338.0 339.0 340.0 341.0 342.0 343.0 344.0 345.0 346.0 347.0 348.0 349.0 350.0 351.0 352.0 353.0 354.0 355.0 356.0 357.0 358.0 359.0 360.0 361.0 362.0 363.0 364.0 365.0 366.0 367.0 368.0 369.0 370.0 371.0 372.0 373.0 374.0 375.0 376.0 377.0 378.0 379.0 380.0 381.0 382.0 383.0 384.0 385.0 386.0 387.0 388.0 389.0 390.0 391.0 392.0 393.0 394.0 395.0 396.0 397.0 398.0 399.0 400.0 0.0 2.356097596773101 4.711613861719243 7.065967606446399 9.418577929397006 11.76886435917674 14.11624699777715 16.46014666365679 18.79998503464564 21.1351847906374 23.46516975603463 25.78936504191143 28.1071971878587 30.41809430347687 32.72148620948138 35.01680457838582 37.30348307472822 39.58095749480594 41.84866590588439 44.1060487848456 46.35254915624211 48.58761272972241 50.81068803679371 53.02122656688857 55.2186829027017 57.40251485476347 59.57218359521709 61.72715379076632 63.86689373476091 65.99087547838726 68.09857496093202 70.18947213908601 72.2630511152573 74.31880026486114 76.35621236255569 78.37478470739232 80.374 0192468495 82.35342269971977 84.31250667781958 86.25078780649179 88.16778784387097 90.0630337988826 91.93605804794647 93.78639845035578 95.61359846230345 97.41720724952756 99.19677979854778 100.951877026466 102.6820658893033 104.3869194888472 106.0660171779821 107.7189446644783 109.3452941132117 110.9446642467914 112.5166604445689 114.0608948400047 115.5769864163684 117.0645611007495 118.5232518563536 119.9526987730636 121.3525491562421 122.7224576137535 124.0620861411843 125.3711042052405 126.6491888253023 127.8960246531138 129.1113040505915 130.2947271657287 131.4460020065796 132.564844513304 133.6509786282552 134.7041363640923 135.7240578699029 136.7104914953168 137.6631938525972 138.581929876693 139.4664728832377 140.31660 46244801 141.1321153431338 141.9128038241318 142.658477444273 143.3689522197495 144.0440528515415 144.6836127686697 145.2874741692947 145.8554880596515 146.3875142908121 146.8834215932649 147.3430876093033 147.7663989232161 148.1532510892707 148.5035486574836 148.8172051971717 149.094143318277 149.334294690462 149.5376000599692 149.7040092642407 149.8334812442955 149.9259840548598 149.9814948722491 150.0 149.9814948722491 149.9259840548598 149.8334812442955 149.7040092642407 149.5376000599692 149.334294690462 149.094143318277 148.8172051971717 148.5035486574836 148.1532510892706 147.7663989232161 147.3430876093033 146.8834215932649 146.3875142908121 145.8554880596515 145.2874741692947 144.6836127686697 144.0 440528515415 143.3689522197495 142.658477444273 141.9128038241318 141.1321153431338 140.3166046244801 139.4664728832377 138.581929876693 137.6631938525972 136.7104914953168 135.7240578699029 134.7041363640923 133.6509786282552 132.564844513304 131.4460020065795 130.2947271657287 129.1113040505915 127.8960246531138 126.6491888253022 125.3711042052405 124.0620861411843 122.7224576137535 121.3525491562421 119.9526987730636 118.5232518563535 117.0645611007495 115.5769864163684 114.0608948400047 112.5166604445689 110.9446642467914 109.3452941132117 107.7189446644783 106.0660171779821 104.3869194888471 102.6820658893033 100.951877026466 99.19677979854778 97.41720724952756 95.61359846230343 93.78639845035576 91.93605804794646 90.0630337988826 88.16778784387098 86.25078780649176 84.31250667781957 82.35342269971975 80.3740192468495 78.37478470739228 76.35621236255567 74.31880026486111 72.26305111525728 70.18947213908601 68.09857496093197 65.99087547838723 63.86689373476087 61.72715379076631 59.57218359521709 57.40251485476342 55.21868290270167 53.02122656688854 50.8106880367937 48.58761272972242 46.35254915624207 44.10604878484556 41.84866590588437 39.58095749480592 37.30348307472822 35.01680457838576 32.72148620948135 30.41809430347685 28.10719718785868 25.78936504191144 23.46516975603458 21.13518479063736 18.79998503464561 16.46014666365678 14.11624699777715 11.76886435917669 9.418577929396971 7.065967606446377 4.711613861719235 2.356097596773107 -4.82361546538801E-14 -2.356097596773136 -4.711613861719265 -7.065967606446407 -9.418577929397001 -11.76886435917679 -14.11624699777718 -16.46014666365681 -18.79998503464564 -21.13518479063739 -23.46516975603468 -25.78936504191147 -28.10719718785871 -30.41809430347688 -32.72148620948138 -35.01680457838586 -37.30348307472826 -39.58095749480596 -41.84866590588439 -44.10604878484558 -46.35254915624216 -48.58761272972244 -50.81068803679372 -53.02122656688857 -55.21868290270174 -57.40251485476351 -59.57218359521712 -61.72715379076633 -63.8668937347609 -65.99087547838732 -68.09857496093206 -70.18947213908604 -72.26305111525731 -74.31880026486114 -76.35621236255575 -78.37478470739237 -80.37401924684951 -82.35342269971977 -84.31250667781958 -86.25078780649183 -88.167787843871 -90.06303379888264 -91.93605804794648 -93.78639845035578 -95.6135984623035 -97.41720724952757 -99.19677979854781 -100.951877026466 -102.6820658893033 -104.3869194888472 -106.0660171779821 -107.7189446644783 -109.3452941132117 -110.9446642467914 -112.516660444569 -114.0608948400047 -115.5769864163684 -117.0645611007495 -118.5232518563536 -119.9526987730636 -121.3525491562421 -122.7224576137536 -124.0620861411843 -125.3711042052406 -126.6491888253023 -127.8960246531139 -129.1113040505916 -130.2947271657287 -131.4460020065795 -132.564844513304 -133.6509786282552 -134.7041363640924 -135.724057869903 -136.7104914953168 -137.6631938525972 -138.581929876693 -139.4664728832377 -140.3166046244801 -141.1321153431338 -141.9128038241318 -142.658477444273 -143.3689522197496 -144.0440528515415 -144.6836127686697 -145.2874741692947 -145.8554880596515 -146.3875142908121 -146.8834215932649 -147.3430876093033 -147.7663989232161 -148.1532510892706 -148.5035486574836 -148.8172051971717 -149.094143318277 -149.334294690462 -149.5376000599692 -149.7040092642407 -149.8334812442955 -149.9259840548598 -149.9814948722491 -150.0 -149.9814948722491 -149.9259840548597 -149.8334812442955 -149.7040092642407 -149.5376000599692 -149.334294690462 -149.094143318277 -148.8172051971717 -148.5035486574836 -148.1532510892707 -147.7663989232161 -147.3430876093033 -146.8834215932649 -146.3875142908121 -145.8554880596515 -145.2874741692947 -144. 6836127686697 -144.0440528515415 -143.3689522197495 -142.658477444273 -141.9128038241318 -141.1321153431338 -140.3166046244801 -139.4664728832377 -138.581929876693 -137.6631938525971 -136.7104914953168 -135.7240578699029 -134.7041363640923 -133.6509786282551 -132.564844513304 -131.4460020065795 -130.2947271657287 -129.1113040505915 -127.8960246531138 -126.6491888253022 -125.3711042052405 -124.0620861411843 -122.7224576137535 -121.352549156242 -119.9526987730635 -118.5232518563535 -117.0645611007494 -115.5769864163684 -114.0608948400046 -112.5166604445689 -110.9446642467914 -109.3452941132117 -107.7189446644783 -106.066017177982 -104.3869194888471 -102.6820658893032 -100.951877026466 -99.19677979854774 -97.4172072495275 -95.61359846230344 -93.78639845035576 -91.93605804794647 -90.06303379888261 -88.16778784387088 -86.25078780649172 -84.31250667781954 -82.35342269971971 -80.37401924684944 -78.37478470739231 -76.35621236255568 -74.31880026486112 -72.2630511152573 -70.18947213908602 -68.09857496093193 -65.9908754783872 -63.86689373476083 -61.72715379076627 -59.57218359521705 -57.40251485476343 -55.21868290270168 -53.02122656688856 -50.81068803679371 -48.58761272972244 -46.35254915624202 -44.10604878484551 -41.84866590588432 -39.58095749480588 -37.30348307472817 -35.01680457838578 -32.72148620948136 -30.41809430347687 -28.1071971878587 -25.78936504191132 -23.46516975603453 -21.13518479063732 -18.79998503464557 -16.46014666365673 -14.11624699777711 -11.76886435917671 -9. 418577929396988 -7.065967606446396 -4.711613861719254 -2.356097596772992 9.64723093077602E-14 1
Canvas width
4
0
This is the amplitude of the sin curve (a.k.a., 2 * PI)
Canvas height
3
Canvas height / 2
1
5
step
0.0
15
7
9
6
33
x
0
0.0000
1
2.
35
61
2
4.7
11
3
7.06
60
4
9.
41
8
5
11.7
68
6
14
16
7
16.
46
8
18
80
9
21
13
52
10
23
65
11
25
78
94
12
28
72
13
30
81
14
32
215
15
35.0
168
16
37
303
17
39
58
18
41.8
48
19
44
106
20
46.
352
21
48.58
76
22
50
107
23
53
212
24
55
87
25
57
40
26
59
27
61.7
272
28
63
66
29
65.9
90
30
68.09
86
31
70
89
32
72.
263
33
74
88
34
76.3
56
35
78.
374
36
80.3740
37
82
353
38
84
125
39
86.
250
40
88.1
67
41
90.0630
42
91
93
43
93.78
64
44
95
136
45
97
172
46
99
96
47
100
51
48
102
49
104
69
50
106.0660
51
107.
71
52
109
345
53
110
54
112
167
55
114
56
115
77
57
117
58
118
233
59
119
60
121
61
122
225
62
124
63
125.
371
64
126
92
65
127
66
129
111
67
130
294
68
131
69
132
70
133
71
134
72
135
241
73
136.7
105
74
137
75
138
76
139
77
140
166
78
141
321
79
141.9
128
80
142
85
81
143
369
82
144
83
144.6836
84
145
287
85
145.8555
86
146
387
87
146.8834
88
147
343
89
147.7664
90
148
153
91
148.5035
92
148.8172
93
149
94
149.
334
95
149.5
376
96
149.7040
97
149.8
335
98
149.9
260
99
149.9815
100
150
101
102 149.9260
103
104 149.7040
105 149.5376
106 149.3343
107 149.0941
108
109 148.5035
110 148.1533
111 147.7664
112 147.3431
113
114 146.3875
115 145.8555
116
117 144.6836
118 144.0441
119 143.3690
120
142.6585
121 141.9128
122 141.1321
123
316
124 139.4665
125 138.5819
126 137.6632
127
136.7105
128 135.7241
129 134.7041
130 133.6510
131 132.5648
132
131.4460
133
130.2947
134
129.1113
135
127.8960
136
126.6492
137 125.3711
138
124.0621
139
122.7225
140
121.3525
141
119.9527
142
118.5233
143
117.0646
144
115.5770
145
114.0609
146
112.5167
147
110.9447
148
109.3453
149
107.7
189
150 106.0660
151
104.
386
152
102.6821
153
100.9519
154
99.
196
155
97.4172
156
95.6136
157
93.7864
158
91.9
361
159
160
88.1678
161
162
84.
312
163
82.3534
164
165
166
76.
356
167
74.3
188
168 72.2631
169
70.1895
170
68.0986
171
65.9909
172
63.8669
173
174
59.5722
175
57.4025
176
55.2
187
177
53.0212
178
50.8107
179
48.5876
180
181
44.1060
182
41.8487
183
39.5810
184
37.3035
185
35.0168
186
32.7215
187
30.4181
188
28.1072
189
25.7894
190
23.4652
191
21.1352
192
18.8000
193
16.4601
194
14.1162
195
11.7689
196
9.4186
197
7.0660
198
4.7116
199
2.3561
200
-0.0000
201
-2.3561
202
-4.7116
203
-7.0660
204
-9.4186
205
-11.7689
206
-14.1162
207
-16.4601
208
-18.8000
209
-21.1352
210
-23.4652
211
-25.7894
212
-28.1072
213
-30.4181
214
-32.7215
215
-35.0168
216
-37.3035
217
-39.5810
218
-41.8487
219
-44.1060
220
-46.3525
221
-48.5876
222
-50.8107
223
-53.0212
224
-55.2187
225
-57.4025
226
-59.5722
227
-61.7272
228
-63.8669
229
-65.9909
230
-68.0986
231
-70.1895
232
-72.2631
233
-74.
318
234
-76.3562
235
-78.3748
236
-80.3740
237
-82.3534
238
-84.3125
239
-86.2508
240
-88.1678
241
-90.0630
242
-91.9361
243
-93.7864
244
-95.6136
245
-97.4172
246
-99.1968
247
-100.9519
248
-102.6821
249
-104.3869
250
-106.0660
251
-107.7189
252
-109.3453
253
-110.9447
254
-112.5167
255
-114.0609
256
-115.5770
257
-117.0646
258
-118.5233
259
-119.9527
260
-121.3525
261
-122.7225
262
-124.0621
263
-125.3711
264
-126.6492
265
-127.8960
266
-129.1113
267
-130.2947
268
-131.4460
269
-132.5648
270
-133.6510
271
-134.7041
272
-135.7241
273
-136.7105
274
-137.6632
275
-138.5819
276
-139.4665
277
-140.3166
278
-141.1321
279
-141.9128
280
-142.6585
281
-143.3690
282
-144.0441
283
-144.6836
284
-145.2875
285
-145.8555
286
-146.3875
287
-146.8834
288
-147.3431
289
-147.7664
290
-148.1533
291
-148.5035
292
-148.8172
293
-149.0941
294
-149.3343
295
-149.5376
296
-149.7040
297
-149.8335
298
-149.9260
299
-149.9815
300
-150.0000
301
302
303 -149.8335
304
305
306
307
308
309
310
311
312 -147.3431
313
314
315
316 -145.2875
317
318 -144.0441
319
320
321 -141.9128
322
323
324
325
326
327
328
329
330
331
332
333
334 -129.1113
335 -127.8960
336
337
338
339
340
341
342
343 -117.0646
344
345 -114.0609
346
347
348
349
350
351
352 -102.6821
353 -100.9519
354
355
356 -95.6136
357
358
359
360
361 -86.2508
362
363
364
365
366
367
-74.3188
368
369 -70.1895
370
371 -65.9909
372
373
374 -59.5722
375
376 -55.2187
377
378
379
380
381
382
383
384
385
386 -32.7215
387 -30.4181
388
389
390
391
392
393
394
395
396
397
398
399
400