1
1
* {
2
- padding : 0 ;
3
- margin : 0 ;
4
- box-sizing : border-box;
5
- }
6
-
7
- body {
8
- display : flex;
9
- justify-content : center;
10
- align-items : center;
11
- background : # 333 ;
12
- min-height : 100vh ;
13
- overflow : hidden;
14
- }
15
-
16
- .box {
17
- position : relative;
18
- width : 500px ;
19
- height : 500px ;
20
- }
21
-
22
- .box span {
23
- position : absolute;
24
- inset : 0 ;
25
- }
26
-
27
- .box span ::before {
28
- content : "" ;
29
- position : absolute;
30
- width : 350px ;
31
- height : 400px ;
32
- left : 15% ;
2
+ padding : 0 ;
3
+ margin : 0 ;
4
+ box-sizing : border-box;
5
+ }
6
+
7
+ body {
8
+ display : flex;
9
+ flex-direction : column;
10
+ justify-content : center;
11
+ align-items : center;
12
+ background : # 333 ;
13
+ min-height : 100vh ;
14
+ overflow : hidden;
15
+ }
16
+
17
+ .box {
18
+ position : relative;
19
+ width : 500px ;
20
+ height : 500px ;
21
+ margin-bottom : 20px ;
22
+ }
23
+
24
+ .box span {
25
+ position : absolute;
26
+ inset : 0 ;
27
+ }
28
+
29
+ .box span ::before {
30
+ content : "" ;
31
+ position : absolute;
32
+ width : 350px ;
33
+ height : 400px ;
34
+ left : 15% ;
35
+ background : url ("https://i.ibb.co/C1S9Vwn/bulb-off.jpg" );
36
+ background-size : cover;
37
+ background-position : center;
38
+ transform : scale (0.8 );
39
+ animation : animate 2s linear infinite, dimmer 4s linear infinite; /* Dimmer effect */
40
+ border-bottom : 10px ridge # fff ;
41
+ }
42
+
43
+ @keyframes animate {
44
+ 0% ,
45
+ 100% {
33
46
background : url ("https://i.ibb.co/C1S9Vwn/bulb-off.jpg" );
34
- background-size : cover;
35
- background-position : center;
36
- transform : scale (0.8 );
37
- animation : animate 2s linear infinite;
38
- border-bottom : 10px ridge # fff ;
39
- }
40
-
41
- @keyframes animate {
42
- 0% ,
43
- 100% {
44
- background : url ("https://i.ibb.co/C1S9Vwn/bulb-off.jpg" );
45
- }
46
- 50% {
47
- background : url ("https://i.ibb.co/SXmm4cd/bulb-on.jpg" );
48
- }
49
- }
50
-
47
+ }
48
+ 50% {
49
+ background : url ("https://i.ibb.co/SXmm4cd/bulb-on.jpg" );
50
+ }
51
+ }
52
+
53
+ @keyframes dimmer {
54
+ 0% {
55
+ filter : brightness (1 );
56
+ }
57
+ 50% {
58
+ filter : brightness (0.5 ); /* Dims the bulb */
59
+ }
60
+ 100% {
61
+ filter : brightness (1 ); /* Brightens the bulb */
62
+ }
63
+ }
64
+
65
+ .light-beam {
66
+ position : absolute;
67
+ top : 50% ;
68
+ left : 50% ;
69
+ width : 200% ;
70
+ height : 200% ;
71
+ background : radial-gradient (circle, rgba (255 , 255 , 0 , 0.2 ) 0% , rgba (255 , 255 , 0 , 0 ) 80% );
72
+ transform : translate (-50% , -50% ) scale (0 ); /* Initially hidden */
73
+ animation : lightBeam 2s linear infinite; /* Light beam effect */
74
+ }
75
+
76
+ @keyframes lightBeam {
77
+ 0% {
78
+ transform : translate (-50% , -50% ) scale (0 );
79
+ opacity : 0 ; /* Hidden at start */
80
+ }
81
+ 50% {
82
+ transform : translate (-50% , -50% ) scale (1 );
83
+ opacity : 1 ; /* Fully visible */
84
+ }
85
+ 100% {
86
+ transform : translate (-50% , -50% ) scale (0 );
87
+ opacity : 0 ; /* Hidden at end */
88
+ }
89
+ }
0 commit comments