Lab #5 - jQuery Animate
In lab #5, I used jQuery to animate a div and manipulate it to move, change the shape, size, and opacity of it. Each button you click does the action that it says. The buttons consist of move, size, opacity, cascade, shape and reset. Clicking on the move button will move the div square to the right a certain amount. Clicking it multiple times with make it keep going to the right until it goes off the page. The size button makes the div square become smaller. The opacity button randomly sets the opacity of the div square between 0 and 1. The cascade button combines the first 3 buttons and does all of them. The shape button changes the shape of the div square to make it more circular, like an oval. The reset button undoes all of the applied actions done with the previous buttons.
First of all, every single button on this page is animated with jQuery, so its easiest to make an onclick function, which runs whenever the button is clicked. So when any of the buttons are clicked, they select the div (white box) as a selector. Then, whatever modification takes place to the selector will be placed inside of the onclick function. The move button increases the option "left" by 100 each time it is clicked. When the size button is clicked, the height and width of the div is altered. The height is changed to 100px and the width is changed to 80px. The opacity button uses a random number generator between 0 and 1 to decide what value to input for the visibility of the div. The shape button increases the border radius of the div which is why it is changed into an oval type shape. Cascade is, once again, a combination of all 3 of the beginning actions which is changing the left, height, width, and opacity. The reset button took me a while to actually figure out. I needed to find a way to revert all of the modifications back to the beginning. I ended up setting the left, back to its original position, same for the width and height, changing the opacity to 1 and making the border-radius 0 so that it becomes a square again.
These skills are important for a web designer so that they can make their webpages more appealing to others via animations that you can create using jQuery. You could make appealing animations that can make your webpages stand out and make your clients buy your pages. You could also explore with these animations to further develop animation in jQuery to make more visually stunning pages.
Comments
Post a Comment