Étape 6: Dessiner des cercles sur l’écran
Dans cette section, nous avons ajouté 4 cercles sur la toile à l’aide de la fonction de l’ellipse.
Paper.ellipse (x, y, rx, ry)
http://RaphaelJS.com/Reference.html#Paper.Ellipse Paramètres
- x - abscisse du centre
- y - ordonnée du centre
- RX - rayon horizontal
- Ry - rayon vertical
Nous tirons le premier cercle avec en son centre un cm du bord gauche de la toile. avec un rayon de 1 cm.
paper.ellipse( ONE_CM_IN_PX, ONE_CM_IN_PX, ONE_CM_IN_PX, ONE_CM_IN_PX).attr( BRUSH_CUT_FIRST );
Centre du cercle suivant commence 2cm sur le cordon de x et sur les mêmes cordes de y. Ces deux lignes produira deux cercles qui se chevauchent.
paper.ellipse( ONE_CM_IN_PX*2, ONE_CM_IN_PX, ONE_CM_IN_PX, ONE_CM_IN_PX).attr( BRUSH_CUT_FIRST );
Nous ajoutons deux autres cercles en utilisant la même méthode.
paper.ellipse( ONE_CM_IN_PX, ONE_CM_IN_PX*2, ONE_CM_IN_PX, ONE_CM_IN_PX).attr( BRUSH_CUT_FIRST ); paper.ellipse( ONE_CM_IN_PX*2, ONE_CM_IN_PX*2, ONE_CM_IN_PX, ONE_CM_IN_PX).attr( BRUSH_CUT_FIRST );
Le code source de cette étape se trouvent sur mon essentiel
https://GIST.github.com/funvill/11351377