SlideShare a Scribd company logo
1 of 16
NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE,
VADAPUTHUPATTI,THENI.
DEPARTEMENT OF COMPUTER SCIENCE
2D Graphics Animation –Bouncing Ball
PRESENTED BY:
S.AISHWARYA LAKSHMI I M.SC(CS)
What is Python?
 Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics.
 Its high-level built in data structures, combined with dynamic
typing and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or glue
language to connect existing components together.
 Python's simple, easy to learn syntax emphasizes readability and
therefore reduces the cost of program maintenance.
 Python supports modules and packages, which encourages program
modularity and code reuse.
What can Python do?
 Python can be used on a server to create web applications.
 Python can be used alongside software to create workflows.
 Python can connect to database systems. It can also read and
modify files.
 Python can be used to handle big data and perform complex
mathematics.
 Python can be used for rapid prototyping, or for production-ready
software development.
Why Python?
 Python works on different platforms (Windows, Mac, Linux,
Raspberry Pi, etc.)
 Python has a simple syntax similar to the English language.
 Python has syntax that allows developers to write programs with
fewer lines than some other programming languages.
 Python runs on an interpreter system, meaning that code can be
executed as soon as it is written. This means that prototyping can
be very quick.
 Python can be treated in a procedural way, an object-oriented way
or a functional way.
2D graphics animation
 2D computer graphics started in the 1950s, based on VECTOR
GRAPHICS DEVICES. These were largely supplanted by RASTER
BASED DEVICES in the following decades.
 The POST SCRIPT: post script is the programming language
optimized for printing graphics and text.
 The main purpose of postscript was to provide in which to describe
images in a device independent manner.
2D graphics animation
 And the X WINDOW SYSTEM protocol were landmark
developments in the field.
 X window provides the basic framework for a GUI environment:
drawing and moving windows on the display device and interacting
with a mouse and keyboard.
 X window does not mandate the user interface – this is handled by
individual programs.
 As such, the visual styling of X-based environments varies greatly;
different programs may present radically different interfaces.
2D graphics animation
 2D computer graphics are mainly used in applications that were
originally developed for
traditional printing and drawing technologies, such
as typography, cartography, technical drawing, advertising, etc.
2D graphic animation
 In those applications, the two-dimensional images is not just a
representation of a real-world object.
 two-dimensional models are therefore preferred, because they
give more direct control of the image than 3D Computer graphic.
GRAPHICS MODELS
 2D graphics models may combine :
 Geometric Model (also called Vector graphics),
 Digital images (also called Raster graphics),
 Text to be typeset (defined by content, font style and size, color,
position, and orientation),
 Mathematical functions and equations, and more.
 These components can be modified and manipulated by two
dimensional geometric transformations such as translation ,
rotation , scaling.
BOUNCING BALL
01 from visual import*
02 ground= box(size=(10,0.1,10), color = color. White , material=
03 =materials . wood)
04 ball=sphere(pos=(0,4,0),radius=1,color=color . yellow)
05
06 scene. Center = vector(0,5,5)
07 Velocity = 10
08 e = 0.9
09 dt =0.01
10 While True:
(cont…..)
BOUNCING BALL
11 rate(300)
12 prevPos = ball.Y
13 ball.y+= velocity * dt
14 If ball.y < ball . radius:
15 Velocity = -velocity * e
16 ball.y = ball . radius
17 if( prevpos –ball.y)==0:
18 Break
19 Velocity =velocity-9.81*dt.
ANIMATION-BOUNCING BALL
The animation is a continuous sequence of graphics ,
often termed as Frames , that are played back to back with respect
to time. We create an animation of a bouncing ball.
EXPLANATION:
02 ground= box(size=(10,0.1,10), color = color. White , material=
03 =materials . wood)
04 ball=sphere(pos=(0,4,0),radius=1,color=color . yellow)
In this we create a base ground using a box object and a
ball using sphere object and we have define their attributes .
ANIMATION-BOUNCING BALL
EXPLANATION:
06 scene. Center = vector(0,5,5)
The center point of thee visual display window is positioned
at(0,5,5).
07 Velocity = 10
08 e = 0.9
The ball is projected with an initial velocity
10 units/sec . In the direction of Y-axis, and the coefficient of restitution is
0.9.
09 dt =0.01
Change in time dt is set to 0.01sec.
10 While True:
The while loop produces a bouncing ball animation
ANIMATION-BOUNCING BALL
EXPLANATION:
11 rate(300)
Function rate defines a maximum number of loop per second.
12 prevPos = ball.Y
13 ball.y+= velocity * dt
The position of the bouncing ball in each iteration is updated using
current velocity and time.
14 If ball.y < ball . radius:
15 Velocity = -velocity * e
The current position of the is less than the radius of the ball, it
touches the floor. In this case , the velocity of the ball is negated changing the
direction of motion and its position is set to coordinates.
Velocity= u + a*t.
ANIMATION-BOUNCING BALL
EXPLANATION:
And we can set the visual display window to full screen by
using the following command .
scene.fullscreen = True
THANK YOU!!!

More Related Content

What's hot

Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Graphics & Animation with HTML5
Graphics & Animation with HTML5Graphics & Animation with HTML5
Graphics & Animation with HTML5Knoldus Inc.
 
Introduction to MERN Stack
Introduction to MERN StackIntroduction to MERN Stack
Introduction to MERN StackSurya937648
 
Introduction to flutter's basic concepts
Introduction to flutter's basic conceptsIntroduction to flutter's basic concepts
Introduction to flutter's basic conceptsKumaresh Chandra Baruri
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and responseSahil Agarwal
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginnersSingsys Pte Ltd
 
Introduction to HTTP protocol
Introduction to HTTP protocolIntroduction to HTTP protocol
Introduction to HTTP protocolAviran Mordo
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentalsGopal Ji Singh
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.netDeep Patel
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side ProgrammingMilan Thapa
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introductionshaojung
 
Html events with javascript
Html events with javascriptHtml events with javascript
Html events with javascriptYounusS2
 

What's hot (20)

Pygame presentation
Pygame presentationPygame presentation
Pygame presentation
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
HTML5 Web storage
HTML5 Web storageHTML5 Web storage
HTML5 Web storage
 
Graphics & Animation with HTML5
Graphics & Animation with HTML5Graphics & Animation with HTML5
Graphics & Animation with HTML5
 
Introduction to MERN Stack
Introduction to MERN StackIntroduction to MERN Stack
Introduction to MERN Stack
 
Introduction to flutter's basic concepts
Introduction to flutter's basic conceptsIntroduction to flutter's basic concepts
Introduction to flutter's basic concepts
 
Vb.net tutorial
Vb.net tutorialVb.net tutorial
Vb.net tutorial
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction to HTTP protocol
Introduction to HTTP protocolIntroduction to HTTP protocol
Introduction to HTTP protocol
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
Deploying a website
Deploying a websiteDeploying a website
Deploying a website
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.net
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side Programming
 
Intro to html 5
Intro to html 5Intro to html 5
Intro to html 5
 
Atom and rss
Atom and rssAtom and rss
Atom and rss
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introduction
 
Html events with javascript
Html events with javascriptHtml events with javascript
Html events with javascript
 

Similar to 2D Graphics animation - Bouncing ball(Python).pptx

Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notessmruti sarangi
 
Computer Graphics Power Point using Open GL and C Programming
Computer Graphics Power Point using Open GL and C ProgrammingComputer Graphics Power Point using Open GL and C Programming
Computer Graphics Power Point using Open GL and C Programmingkemal678348
 
Graphics pdf
Graphics pdfGraphics pdf
Graphics pdfaa11bb11
 
Multimedia communication
Multimedia communicationMultimedia communication
Multimedia communicationBUDNET
 
A Gesture Based Digital Art with Colour Coherence Vector Algorithm
A Gesture Based Digital Art with Colour Coherence Vector AlgorithmA Gesture Based Digital Art with Colour Coherence Vector Algorithm
A Gesture Based Digital Art with Colour Coherence Vector AlgorithmIRJET Journal
 
Specialized Application.pdf
Specialized Application.pdfSpecialized Application.pdf
Specialized Application.pdfkhalid khan
 
computer graphics unit 1.ppt
computer graphics unit 1.pptcomputer graphics unit 1.ppt
computer graphics unit 1.pptoumiarashid
 
Ball Collecting game report
Ball Collecting game report Ball Collecting game report
Ball Collecting game report Dileep Maurya
 
Rana Usama Hussien last
Rana Usama Hussien last Rana Usama Hussien last
Rana Usama Hussien last Rana Usama
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodeBhavya Chawla
 
Dynamic Graph Plotting with WPF
Dynamic Graph Plotting with WPFDynamic Graph Plotting with WPF
Dynamic Graph Plotting with WPFIJERD Editor
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphicsAmol Gaikwad
 
A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...
A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...
A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...Pieter van der Hijden
 
Computer graphics lec 1
Computer graphics lec 1Computer graphics lec 1
Computer graphics lec 1abrar_khan123
 

Similar to 2D Graphics animation - Bouncing ball(Python).pptx (20)

Ud 8 presentación ud8
Ud 8  presentación ud8Ud 8  presentación ud8
Ud 8 presentación ud8
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
Computer Graphics Power Point using Open GL and C Programming
Computer Graphics Power Point using Open GL and C ProgrammingComputer Graphics Power Point using Open GL and C Programming
Computer Graphics Power Point using Open GL and C Programming
 
Graphics pdf
Graphics pdfGraphics pdf
Graphics pdf
 
Graphics file
Graphics fileGraphics file
Graphics file
 
Multimedia communication
Multimedia communicationMultimedia communication
Multimedia communication
 
A Gesture Based Digital Art with Colour Coherence Vector Algorithm
A Gesture Based Digital Art with Colour Coherence Vector AlgorithmA Gesture Based Digital Art with Colour Coherence Vector Algorithm
A Gesture Based Digital Art with Colour Coherence Vector Algorithm
 
Specialized Application.pdf
Specialized Application.pdfSpecialized Application.pdf
Specialized Application.pdf
 
computer graphics unit 1.ppt
computer graphics unit 1.pptcomputer graphics unit 1.ppt
computer graphics unit 1.ppt
 
Ball Collecting game report
Ball Collecting game report Ball Collecting game report
Ball Collecting game report
 
Rana Usama Hussien last
Rana Usama Hussien last Rana Usama Hussien last
Rana Usama Hussien last
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcode
 
Dynamic Graph Plotting with WPF
Dynamic Graph Plotting with WPFDynamic Graph Plotting with WPF
Dynamic Graph Plotting with WPF
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
 
Introduction , surveuy on cg
Introduction , surveuy on cgIntroduction , surveuy on cg
Introduction , surveuy on cg
 
A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...
A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...
A Mind Shift in Mind Mapping; Pieter van der Hijden; Sofos Consultancy, Amste...
 
ELAVARASAN.pdf
ELAVARASAN.pdfELAVARASAN.pdf
ELAVARASAN.pdf
 
Computer graphics lec 1
Computer graphics lec 1Computer graphics lec 1
Computer graphics lec 1
 
Beekman5 std ppt_07
Beekman5 std ppt_07Beekman5 std ppt_07
Beekman5 std ppt_07
 
lecture 4
 lecture 4 lecture 4
lecture 4
 

More from Aishwarya SenthilNathan (13)

cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
 
women empowerment.pptx
women empowerment.pptxwomen empowerment.pptx
women empowerment.pptx
 
Digital Image Processing.pptx
Digital Image Processing.pptxDigital Image Processing.pptx
Digital Image Processing.pptx
 
Artifical Intelligence And Machine Learning Algorithum.pptx
Artifical Intelligence And Machine Learning Algorithum.pptxArtifical Intelligence And Machine Learning Algorithum.pptx
Artifical Intelligence And Machine Learning Algorithum.pptx
 
Cloud Computing.pptx
Cloud Computing.pptxCloud Computing.pptx
Cloud Computing.pptx
 
SENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptx
SENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptxSENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptx
SENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptx
 
Growth Of IOT NETWORK.pptx
Growth Of IOT NETWORK.pptxGrowth Of IOT NETWORK.pptx
Growth Of IOT NETWORK.pptx
 
DATA MINING.pptx
DATA MINING.pptxDATA MINING.pptx
DATA MINING.pptx
 
Software Engineering.pptx
Software Engineering.pptxSoftware Engineering.pptx
Software Engineering.pptx
 
HUMANOID ROBOTS.pptx
HUMANOID ROBOTS.pptxHUMANOID ROBOTS.pptx
HUMANOID ROBOTS.pptx
 
LR PARSE.pptx
LR PARSE.pptxLR PARSE.pptx
LR PARSE.pptx
 
APPLET.pptx
APPLET.pptxAPPLET.pptx
APPLET.pptx
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

2D Graphics animation - Bouncing ball(Python).pptx

  • 1. NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE, VADAPUTHUPATTI,THENI. DEPARTEMENT OF COMPUTER SCIENCE 2D Graphics Animation –Bouncing Ball PRESENTED BY: S.AISHWARYA LAKSHMI I M.SC(CS)
  • 2. What is Python?  Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.  Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.  Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance.  Python supports modules and packages, which encourages program modularity and code reuse.
  • 3. What can Python do?  Python can be used on a server to create web applications.  Python can be used alongside software to create workflows.  Python can connect to database systems. It can also read and modify files.  Python can be used to handle big data and perform complex mathematics.  Python can be used for rapid prototyping, or for production-ready software development.
  • 4. Why Python?  Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)  Python has a simple syntax similar to the English language.  Python has syntax that allows developers to write programs with fewer lines than some other programming languages.  Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.  Python can be treated in a procedural way, an object-oriented way or a functional way.
  • 5. 2D graphics animation  2D computer graphics started in the 1950s, based on VECTOR GRAPHICS DEVICES. These were largely supplanted by RASTER BASED DEVICES in the following decades.  The POST SCRIPT: post script is the programming language optimized for printing graphics and text.  The main purpose of postscript was to provide in which to describe images in a device independent manner.
  • 6. 2D graphics animation  And the X WINDOW SYSTEM protocol were landmark developments in the field.  X window provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard.  X window does not mandate the user interface – this is handled by individual programs.  As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces.
  • 7. 2D graphics animation  2D computer graphics are mainly used in applications that were originally developed for traditional printing and drawing technologies, such as typography, cartography, technical drawing, advertising, etc.
  • 8. 2D graphic animation  In those applications, the two-dimensional images is not just a representation of a real-world object.  two-dimensional models are therefore preferred, because they give more direct control of the image than 3D Computer graphic.
  • 9. GRAPHICS MODELS  2D graphics models may combine :  Geometric Model (also called Vector graphics),  Digital images (also called Raster graphics),  Text to be typeset (defined by content, font style and size, color, position, and orientation),  Mathematical functions and equations, and more.  These components can be modified and manipulated by two dimensional geometric transformations such as translation , rotation , scaling.
  • 10. BOUNCING BALL 01 from visual import* 02 ground= box(size=(10,0.1,10), color = color. White , material= 03 =materials . wood) 04 ball=sphere(pos=(0,4,0),radius=1,color=color . yellow) 05 06 scene. Center = vector(0,5,5) 07 Velocity = 10 08 e = 0.9 09 dt =0.01 10 While True: (cont…..)
  • 11. BOUNCING BALL 11 rate(300) 12 prevPos = ball.Y 13 ball.y+= velocity * dt 14 If ball.y < ball . radius: 15 Velocity = -velocity * e 16 ball.y = ball . radius 17 if( prevpos –ball.y)==0: 18 Break 19 Velocity =velocity-9.81*dt.
  • 12. ANIMATION-BOUNCING BALL The animation is a continuous sequence of graphics , often termed as Frames , that are played back to back with respect to time. We create an animation of a bouncing ball. EXPLANATION: 02 ground= box(size=(10,0.1,10), color = color. White , material= 03 =materials . wood) 04 ball=sphere(pos=(0,4,0),radius=1,color=color . yellow) In this we create a base ground using a box object and a ball using sphere object and we have define their attributes .
  • 13. ANIMATION-BOUNCING BALL EXPLANATION: 06 scene. Center = vector(0,5,5) The center point of thee visual display window is positioned at(0,5,5). 07 Velocity = 10 08 e = 0.9 The ball is projected with an initial velocity 10 units/sec . In the direction of Y-axis, and the coefficient of restitution is 0.9. 09 dt =0.01 Change in time dt is set to 0.01sec. 10 While True: The while loop produces a bouncing ball animation
  • 14. ANIMATION-BOUNCING BALL EXPLANATION: 11 rate(300) Function rate defines a maximum number of loop per second. 12 prevPos = ball.Y 13 ball.y+= velocity * dt The position of the bouncing ball in each iteration is updated using current velocity and time. 14 If ball.y < ball . radius: 15 Velocity = -velocity * e The current position of the is less than the radius of the ball, it touches the floor. In this case , the velocity of the ball is negated changing the direction of motion and its position is set to coordinates. Velocity= u + a*t.
  • 15. ANIMATION-BOUNCING BALL EXPLANATION: And we can set the visual display window to full screen by using the following command . scene.fullscreen = True