Wednesday 14 June 2017

Animation with rect (rectangle) and css property by top4ways


Animation with html and css coding. Take a look to animation first.



List of html tags used
  • rect used for creating a rectangle.
  • animate used for changing property of rectangle like x and y position ,color,width and height.

Lets start coding for creating above animation. Step first : Create an svg elements and define its height and width. Second step: insert rect tag between the opening and closing tag of svg and define its property:-
  1. x position of top-left corner of rectangle on x axis
  2. y position of top-left corner of rectangle on y axis
  3. width and height(You can leave if you want to animate it continues.)
  4. fill define color of rectangle

Step third: Write animate tag inside the opening and closing tag of rect(rectangle) and define its property:
  1. attributeName used to select attribute of rectangle,circle and other svg elements that can be changed with time
  2. from define initial value of attribute
  3. to define final value of attribute
  4. dur define time interval for change in value from initial value to final value .
  5. repeatCount define how many times the animation repeat.

After defining all appropriate value and attributes, the code looks like the below code :

Setp fourth: Now save this code text file with html extension and run it on any html supported browser.

No comments:

Post a Comment