CSS3实现围绕任何点来旋转-京东推荐动画_html/css_WEB-ITnose
之前在京东首页看到一个推荐动画
觉得还是可以试试使用.其实整个效果还是比较简单的.主要还是控制动画的运作原点.
在这个动画里,我觉得比较有意思的就是这个黑点的旋转.我们这次就来实现这个效果.以为其他效果都是没难度的
我们先来看完整代码
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>动画</title> <style> body>div{ width:100px; height:100px; margin: 20px auto 0; color:orange; font-size:100px; line-height:1; animation: circle 5s linear 0s infinite; transform-origin: 0% 300%; } div>div{ animation: inner-circle 5s linear 0s infinite; } @keyframes circle { from { transform:rotate(0deg); } to { transform:rotate(360deg); } } @keyframes inner-circle{ from{ transform: rotate(360deg); } } </style></head><body> <div> <div>☺</div> </div></body></html>
重点的代码讲解
1. 设置移动外层的样式,其实外观主要是这个div
body>div
2. 重点主要在下面CSS里,设置运动的原点坐标,改变这里就可以
transform-origin: 0% 300%;
3. div>div 的CSS动画主要是保证笑脸摆正.如果不需要,当然是可以不用设置其样式的.
其实整个代码是非常简单的.要实现整个京东的那个推荐动画.大家可以尝试做一下,理解下动画.
本文属于吴统威的博客, 微信公众号:bianchengderen,QQ群:186659233 的原创文章,转载时请注明出处及相应链接:http://www.wutongwei.com/front/infor_showone.tweb?id=176 ,欢迎大家传播与分享.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex
