Animations
(continuation of drawing tool)
- Define the
Timer
component presented in the course.
- By considering properties of a circle
[x,y,r]
as a standard vector, add in Circle
the operators plus(Circle):Circle
, minus(Circle):Circle
and mult(value):Circle
.
- Next, define an
Interpolator
having three attributes called start
, end
and current
that are Circle
, and three operations: next():Circle
, hasNext():boolean
and update
.
At each call of the next
operation, current
is updated with:
current=current + (end-start)/10
.
update
is simply if(hasNext()) next();
- Create an interface
Element
(Circle
and Interpolator
both implements this interface) and change in the application Circle
to Element
.
Adapt the code consequently (eg. add required operations into Element
).
For Interpolator
, delegate all the operations to current
circle.
Also add an update
operation into Element
.
- Add a
timer
to the application and add the application has listener.
The tic
event then simply update
all the elements and do a repaint
.
- By using
java.beans.XMLEncoder/Decoder
, define a way to easily edit application's configuration.
source
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented