Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft...
Transcript of Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft...
![Page 1: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/1.jpg)
CO453 Application Programming
Week 10 – animation.NET part 5
![Page 2: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/2.jpg)
How does an animation work?
![Page 3: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/3.jpg)
Simple Animation(using a
Timer control)
![Page 4: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/4.jpg)
Butterfly Animation
![Page 5: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/5.jpg)
There are 8 Butterfly Images
File Names: bfly0.gif, bfly1.gif up to bfly7.gif
![Page 6: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/6.jpg)
Using an Array to store the imagesconst int MAX = 8; // there are 8 imagesImage[ ] images = new Image[MAX]; // set up an image arrayconst int MAX = 8; // there are 8 imagesImage[ ] images = new Image[MAX]; // set up an image array
for(int i = 0; i < MAX; i++){
images[i] = Image.FromFile("bfly" + i +".gif");
}
for(int i = 0; i < MAX; i++){
images[i] = Image.FromFile("bfly" + i +".gif");
}
Put this codein the form’s
Load() method
images[ ] array
0
1
2
3
4
5
6
7
bfly0.gif
bfly1.gif
bfly2.gif
bfly3.gif
bfly4.gif
bfly5.gif
bfly6.gif
bfly7.gif
![Page 7: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/7.jpg)
Display images in the PictureBox
images[ ] array
0 bfly0.gif
1 bfly1.gif
2 bfly2.gif
3 bfly3.gif
4 bfly4.gif
5 bfly5.gif
6 bfly6.gif
7 bfly7.gif
pbxBFly.Image = images[count];count ++;pbxBFly.Image = images[count];count ++;
Put this code in thetimer’s Tick() method
![Page 8: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/8.jpg)
Activity
Code exercise 5.1 to make the butterfly animate when the timer is started
![Page 9: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/9.jpg)
Date and Time(using a Timer control)
![Page 10: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/10.jpg)
Using a Timer Control with a Time and Date Display
2 Labels in a Panel Container
2 Labels in a Panel Container
![Page 11: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/11.jpg)
Activity
Code exercise 5.2 to update the time display
![Page 12: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/12.jpg)
Moving an Image(using a Timer again)
![Page 13: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/13.jpg)
Move a PictureBox down screen
pbxSealpbxSeal
btnStartbtnStart
btnStopbtnStop
btnQuitbtnQuit
timer1timer1
![Page 14: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/14.jpg)
A note on Graphics Coordinates
this.Width
this.Height
pbxSeal.Top
pbxSeal.Height
pbxSeal.Width
pbxSeal.Bottom
pbxSeal.Left pbxSeal.Right
Note: Objects have a Top, Bottom, Left, Right, Width, HeightCoordinates start from 0,0 at the top left corner
Note: Objects have a Top, Bottom, Left, Right, Width, HeightCoordinates start from 0,0 at the top left corner
![Page 15: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/15.jpg)
Code for the Timer Project
![Page 16: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/16.jpg)
Activity
Code exercise 5.3 to make the helicopter animate
![Page 17: Week 10 NET part 5valerianweb.com/tutor/Assets/AyFd/CO453/Week 11 Unit 5 Animations.pdfMicrosoft PowerPoint - Week 10 NET part 5.pptx Author: derek Created Date: 3/22/2019 11:30:07](https://reader033.fdocuments.net/reader033/viewer/2022060919/60ab2b6895e0061a47744deb/html5/thumbnails/17.jpg)
The Last Slide