Hot File

The steps create Bouncy Ball Effect With CSS3 former easy

View: 713    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: References   Fields: Other

9 point/3 review File has been tested

Dear friends, today we will together learn more about CSS3 Gradient and Animation offline. In this article, I will share with you every step of the pick-up effect, this is a simple effect, but it will help you have more experience in the use and the ability to master CSS3.

Introduction

Dear friends, today we will together learn more about CSS3 Gradient and Animation offline. In this article, I will share with you every step of the pick-up effect, this is a simple effect, but it will help you have more experience in the use and the ability to master CSS3.

Step 1: HTML

First, we need basic html paragraph as follows:

1
2
3
4
<div id="ballWrapper">
    <div id="ball"></div>
    <div id="ballShadow"></div>
</div>

In html snippet above, we have three div tags, each card will contain a separate ID, "#ballWrapper" will contain the entire ball. Div tag will determine the location of the balls on the screen. Next is the div tag with id "#ball" is where we will shape the ball. Final div id card contains "#ballShadow" is where we create a shadow effect to the ball.

Step 2: Format CSS

First we will format the height and width of the frame containing the ball, and always attribute declared transition, this attribute will help us create the effect in steps.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
#ballWrapper {
    width: 140px;
    height: 300px;
    position: fixed;
    left: 50%;
    top: 35%;
    margin-left: -70px;
    z-index: 100;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -ms-transform: scale(1);
    -o-transform: scale(1);
    transform: scale(1);
    -webkit-transition: all 5s linear 0s;
    -moz-transition: all 5s linear 0s;
    transition: all 5s linear 0s;
    cursor: pointer;
}

Next is that we decorate for the ball, in this step, we also declare always for the animation (animation).

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ball {
    width: 140px;
    height: 140px;
    border-radius: 70px;
    background: rgb(187,187,187);
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2JiYmJiYiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9Ijk5JSIgc3RvcC1jb2xvcj0iIzc3Nzc3NyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
    background: -moz-linear-gradient(top,  rgba(187,187,187,1) 0%, rgba(119,119,119,1) 99%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(187,187,187,1)), color-stop(99%,rgba(119,119,119,1)));
    background: -webkit-linear-gradient(top,  rgba(187,187,187,1) 0%,rgba(119,119,119,1) 99%);
    background: -o-linear-gradient(top,  rgba(187,187,187,1) 0%,rgba(119,119,119,1) 99%);
    background: -ms-linear-gradient(top,  rgba(187,187,187,1) 0%,rgba(119,119,119,1) 99%);
    background: linear-gradient(top,  rgba(187,187,187,1) 0%,rgba(119,119,119,1) 99%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bbbbbb', endColorstr='#777777',GradientType=0 );
    box-shadow: inset 0 -5px 15px rgba(255,255,255,0.4),
                inset -2px -1px 40px rgba(0,0,0,0.4),
                0 0 1px #000;
    position: absolute;
    top: 0;
    z-index: 11;
    -webkit-animation: jump 1s infinite;
    -moz-animation: jump 1s infinite;
    -o-animation: jump 1s infinite;
    -ms-animation: jump 1s infinite;
    animation: jump 1s infinite;
    cursor: pointer;
}

To add beautiful ball, we will create more polished effect at the beginning of the ball.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
#ball::after {
    content: "";
    width: 80px;
    height: 40px;
    position: absolute;
    left: 30px;
    top: 10px;
    z-index: 10;
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2U4ZThlOCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjElIiBzdG9wLWNvbG9yPSIjZThlOGU4IiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
    background: -moz-linear-gradient(top,  rgba(232,232,232,1) 0%, rgba(232,232,232,1) 1%, rgba(255,255,255,0) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(232,232,232,1)), color-stop(1%,rgba(232,232,232,1)), color-stop(100%,rgba(255,255,255,0)));
    background: -webkit-linear-gradient(top,  rgba(232,232,232,1) 0%,rgba(232,232,232,1) 1%,rgba(255,255,255,0) 100%);
    background: -o-linear-gradient(top,  rgba(232,232,232,1) 0%,rgba(232,232,232,1) 1%,rgba(255,255,255,0) 100%);
    background: -ms-linear-gradient(top,  rgba(232,232,232,1) 0%,rgba(232,232,232,1) 1%,rgba(255,255,255,0) 100%);
    background: linear-gradient(top,  rgba(232,232,232,1) 0%,rgba(232,232,232,1) 1%,rgba(255,255,255,0) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e8e8e8', endColorstr='#00ffffff',GradientType=0 );
    border-radius: 40px / 20px;
}

Finally, we will decorate the shadows of the ball.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
#ballShadow {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 10;
    margin-left: -30px;
    width: 60px;
    height: 75px;
    background: rgba(20, 20, 20, .1);
    box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
    border-radius: 30px / 40px;
    -webkit-transform: scaleY(.3);
    -moz-transform: scaleY(.3);
    -ms-transform: scaleY(.3);
    -o-transform: scaleY(.3);
    transform: scaleY(.3);
    -webkit-animation: shrink 1s infinite;
    -moz-animation: shrink 1s infinite;
    -o-animation: shrink 1s infinite;
    -ms-animation: shrink 1s infinite;
    animation: shrink 1s infinite;
}

Step 3: Create an animation

First, we will create the effect of spare balls.

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@-webkit-keyframes jump {
    0% {top: 0;
        -webkit-animation-timing-function: ease-in;
    }
    40% {}
    50% {top: 140px;
        height: 140px;
        -webkit-animation-timing-function: ease-out;
    }
    55% {top: 160px; height: 120px; border-radius: 70px / 60px;
        -webkit-animation-timing-function: ease-in;}
    65% {top: 120px; height: 140px; border-radius: 70px;
        -webkit-animation-timing-function: ease-out;}
    95% {
        top: 0;
        -webkit-animation-timing-function: ease-in;
    }
    100% {top: 0;
        -webkit-animation-timing-function: ease-in;
    }
}
 
@-moz-keyframes jump {
    0% {top: 0;
        -moz-animation-timing-function: ease-in;
    }
    40% {}
    50% {top: 140px;
        height: 140px;
        -moz-animation-timing-function: ease-out;
    }
    55% {top: 160px; height: 120px; border-radius: 70px / 60px;
        -moz-animation-timing-function: ease-in;}
    65% {top: 120px; height: 140px; border-radius: 70px;
        -moz-animation-timing-function: ease-out;}
    95% {
        top: 0;
        -moz-animation-timing-function: ease-in;
    }
    100% {top: 0;
        -moz-animation-timing-function: ease-in;
    }
}
 
@-o-keyframes jump {
    0% {top: 0;
        -o-animation-timing-function: ease-in;
    }
    40% {}
    50% {top: 140px;
        height: 140px;
        -o-animation-timing-function: ease-out;
    }
    55% {top: 160px; height: 120px; border-radius: 70px / 60px;
        -o-animation-timing-function: ease-in;}
    65% {top: 120px; height: 140px; border-radius: 70px;
        -o-animation-timing-function: ease-out;}
    95% {
        top: 0;
        -o-animation-timing-function: ease-in;
    }
    100% {top: 0;
        -o-animation-timing-function: ease-in;
    }
}
 
@-ms-keyframes jump {
    0% {top: 0;
        -ms-animation-timing-function: ease-in;
    }
    40% {}
    50% {top: 140px;
        height: 140px;
        -ms-animation-timing-function: ease-out;
    }
    55% {top: 160px; height: 120px; border-radius: 70px / 60px;
        -ms-animation-timing-function: ease-in;}
    65% {top: 120px; height: 140px; border-radius: 70px;
        -ms-animation-timing-function: ease-out;}
    95% {
        top: 0;
        -ms-animation-timing-function: ease-in;
    }
    100% {top: 0;
        -ms-animation-timing-function: ease-in;
    }
}
 
@keyframes jump {
    0% {
        top: 0;
        animation-timing-function: ease-in;
    }
    50% {
        top: 140px;
        height: 140px;
        animation-timing-function: ease-out;
    }
    55% {
        top: 160px;
        height: 120px;
        border-radius: 70px / 60px;
        animation-timing-function: ease-in;
    }
    65% {
        top: 120px;
        height: 140px;
        border-radius: 70px;
        animation-timing-function: ease-out;
    }
    95% {
        top: 0;
        animation-timing-function: ease-in;
    }
    100% {
        top: 0;
        animation-timing-function: ease-in;
    }
}

Next is the effect of shadows shrink ball.

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
@-webkit-keyframes shrink {
    0% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -webkit-animation-timing-function: ease-in;
    }
    50% {
        bottom: 30px;
        margin-left: -10px;
        width: 20px;
        height: 5px;
        background: rgba(20, 20, 20, .3);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.3);
        border-radius: 20px / 20px;
        -webkit-animation-timing-function: ease-out;
    }
    100% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -webkit-animation-timing-function: ease-in;
    }
}
 
@-moz-keyframes shrink {
    0% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -moz-animation-timing-function: ease-in;
    }
    50% {
        bottom: 30px;
        margin-left: -10px;
        width: 20px;
        height: 5px;
        background: rgba(20, 20, 20, .3);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.3);
        border-radius: 20px / 20px;
        -moz-animation-timing-function: ease-out;
    }
    100% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -moz-animation-timing-function: ease-in;
    }
}
 
@-o-keyframes shrink {
    0% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -o-animation-timing-function: ease-in;
    }
    50% {
        bottom: 30px;
        margin-left: -10px;
        width: 20px;
        height: 5px;
        background: rgba(20, 20, 20, .3);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.3);
        border-radius: 20px / 20px;
        -o-animation-timing-function: ease-out;
    }
    100% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -o-animation-timing-function: ease-in;
    }
}
 
@-ms-keyframes shrink {
    0% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -ms-animation-timing-function: ease-in;
    }
    50% {
        bottom: 30px;
        margin-left: -10px;
        width: 20px;
        height: 5px;
        background: rgba(20, 20, 20, .3);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.3);
        border-radius: 20px / 20px;
        -ms-animation-timing-function: ease-out;
    }
    100% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        -ms-animation-timing-function: ease-in;
    }
}
 
@keyframes shrink {
    0% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        animation-timing-function: ease-in;
    }
    50% {
        bottom: 30px;
        margin-left: -10px;
        width: 20px;
        height: 5px;
        background: rgba(20, 20, 20, .3);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.3);
        border-radius: 20px / 20px;
        animation-timing-function: ease-out;
    }
    100% {
        bottom: 0;
        margin-left: -30px;
        width: 60px;
        height: 75px;
        background: rgba(20, 20, 20, .1);
        box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
        border-radius: 30px / 40px;
        animation-timing-function: ease-in;
    }
}

Finally the effect when we click on the ball

1
2
3
4
5
6
7
8
#ballWrapper:active {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    -ms-transform: scale(0);
    -o-transform: scale(0);
    transform: scale(0);
    cursor: pointer;
}

That's it then that you, very simple and easy to implement, is not it. I hope you will be able to apply what I write in this article to the effect on your website or your blog. Remember to share the article to a friend of yourselves.

Good luck!

The steps create Bouncy Ball Effect With CSS3 former easy

The steps create Bouncy Ball Effect With CSS3 former easy Posted on 14-08-2015  Dear friends, today we will together learn more about CSS3 Gradient and Animation offline. In this article, I will share with you every step of the pick-up effect, this is a simple effect, but it will help you have more experience in the use and the ability to master CSS3. 3/10 713

Comment:

To comment you must be logged in members.

Files with category

  • Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    View: 2688    Download: 0   Comment: 0   Author: none  

    Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    Category: References
    Fields: Other

    0/3 review
    Windows 10 pre-installed Mail application for managing personal email on the device. The latest version of this application but improved a lot and support other email accounts such as Gmail or Yahoo Mail but users almost no "salty" really with this...

  • Step by step instructions to create social networking buttons with CSS3

    View: 1876    Download: 0   Comment: 0   Author: none  

    Step by step instructions to create social networking buttons with CSS3

    Category: References
    Fields: Other

    0.75/6 review
    CSS3 help web designers have the ability to create buttons (buttons) very nice, today I will share with you two tips decoration for button in your web becomes radiant beauty that no need to use photoshop.

  • You should understand the CSS Box Shadow

    View: 2029    Download: 0   Comment: 0   Author: none  

    You should understand the CSS Box Shadow

    Category: References
    Fields: Other

    1.3181818181818/11 review
    Effects his shadow was introduced in the previous article, however, in this article, I will guide more specific about shadow attributes, you try it with anything. First we try to learn css following paragraph:

  • How to do button movement with beautiful CSS3

    View: 1716    Download: 0   Comment: 0   Author: none  

    How to do button movement with beautiful CSS3

    Category: References
    Fields: Other

    0/4 review
    Previously to create motion effects button, you must draw the button in photoshop, then switched to flash to make it possible to move. But now you need not spend too much time doing it, all because of the emergence of CSS3.

  • Create a dropdown menu with CSS3 effects with beautiful transtions

    View: 1991    Download: 0   Comment: 0   Author: none  

    Create a dropdown menu with CSS3 effects with beautiful transtions

    Category: References
    Fields: Other

    0.45/10 review
    More of the dropdown menu you want to introduce to you, this will have the effect menu transitions (converted background of menu background from pale to dark). This menu works well on browsers like FF, Chrome, Safary, but unfortunately did not work...

  • How to hack css for all browsers you should know

    View: 1625    Download: 0   Comment: 0   Author: none  

    How to hack css for all browsers you should know

    Category: References
    Fields: Other

    1.6875/8 review
    In the process of web design, which makes it the most headaches is how to design web pages that you can run on the browser. Especially when clients use the old as IE6 browser such. However, with this article, you will easily edit interface runs well...

  • Create Accordion with extremely beautiful CSS3

    View: 2025    Download: 0   Comment: 0   Author: none  

    Create Accordion with extremely beautiful CSS3

    Category: References
    Fields: Other

    0.9/5 review
    Accordion is a technique that helps you shortened the content that you want displayed on the website. It is often used for the display of submenus. In addition you can also use it for content, images. Before applying this procedure, you have to use...

  • Create the effect Hovercho images with Webkit and CSS3 is great

    View: 1722    Download: 0   Comment: 0   Author: none  

    Create the effect Hovercho images with Webkit and CSS3 is great

    Category: References
    Fields: Other

    1.125/4 review
    WebKit is one open source application framework provides the necessary components built one for your web browser. Along with CSS3, cả have contributed to very nice effect những previously only using JavaScript or JQuery thực beige.​

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd