2-18 动画练习

来源:2-18 编程练习

慕移动4506339

2021-11-25 20:56:46

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>2-9</title>
    <style type="text/css">
        div {
            font-family: Arial;
            font-size: 72px;
            font-weight: bold;
            position: fixed;
            right: 0;
            left: 0;
            width: 30px;
            height: 30px;
            margin: auto;
            transform: rotate(90deg);
            animation:translate 1s linear .5s infinite alternate;
        }
        
        @keyframes translate{
            from{
                transform:translate(0px,0px)
            }
            to{
                transform:translate(0px,5px);
            }
        }
    </style>
</head>
<body>
    <div>&gt;</div>
</body>
</html>

老师,麻烦看下,为什么效果实现不对,箭头为什么是朝右的

写回答

1回答

好帮手慕星星

2021-11-26

同学你好,代码问题如下:

1、箭头应该显示在最底部,可以在定位中添加bottom属性

https://img.mukewang.com/climg/61a03beb0945b46404130281.jpg

2、相同的transform属性,后面的会覆盖前面的。在动画中平移会覆盖旋转,所以旋转不生效了。可以在动画中写两个转换,并且旋转后坐标轴也会跟着转,那么应该是水平方向轴移动,参考

https://img.mukewang.com/climg/61a03c400912c23407940384.jpg

自己再测试下,祝学习愉快!

0

0 学习 · 15276 问题

查看课程