Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the animation effect of panorama in CSS3

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to achieve the animation effect of panorama in CSS3". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn "how to achieve the animation effect of panorama in CSS3".

Html Code:

First define some basic styles and animations:

.panorama {

Width:300px

Height:300px

Background-image:url (http://7vilbi.com1.z0.glb.clouddn.com/blog/6608185829213862083.jpg);

Background-size:auto100%

Cursor:pointer

Animation:panorama10slinearinfinitealternate

}

@ keyframespanorama {

To {

Background-position:100%0

}

}

The background-size:auto100%; code means that the image is higher than the container, and the horizontal direction is automatic, that is, the leftmost side of the picture is attached to the left side of the container.

The process of performing animation is: cycle, alternation, linearity, and time period is 10s.

Manually control animation execution

Now we let the mouse move when it hovers over the picture, and let it rest when the mouse leaves.

You need to use this attribute animation-play-state:paused | running, which represents the two states of the animation: pause and run.

Complete CSS code:

.panorama {

Width:300px

Height:300px

Background-image:url (http://7vilbi.com1.z0.glb.clouddn.com/blog/6608185829213862083.jpg);

Background-size:auto100%

Cursor:pointer

Animation:panorama10slinearinfinitealternate

Animation-play-state:paused

}

.panorama: hover

.panorama: focus {

Animation-play-state:running

}

@ keyframespanorama {

To {

Background-position:100%0

}

}

The above is all the content of the article "how to achieve the animation effect of panorama in CSS3". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report