码迷,mamicode.com
首页 > 其他好文 > 详细

炫彩字and鼠标爱心

时间:2019-10-12 22:53:32      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:die   tno   java   width   interval   背景   infinite   direction   fun   

<!DOCTYPE html>



    <style type="text/css">
    body{
        background-color: black;
    }
     #zx {
             font-weight: 600;
            font-size: 28px;
            font-family: "黑体";
            color: #8c888b;
            background: -webkit-linear-gradient(45deg, #70f7fe, #fbd7c6, #fdefac, #bfb5dd, #bed5f5);
           
            color: transparent;
            /*设置字体颜色透明*/
            -webkit-background-clip: text;
            /*背景裁剪为文本形式*/
            animation: ran 10s linear infinite;
            /*动态10s展示*/
        }

        @keyframes ran {
            from {
                backgroud-position: 0 0;
            }
            to {
                background-position: 2000px 0;
            }
        }

    </style>


    <script type="text/javascript"> 
function changeColor(){ 
//var color="#f00|#0f0|#00f|#880|#808|#088|#bcc8ed|#|#|#|#234|#534";//定义一条变换颜色的字符串
var color="#fce1bb|#fce9b2|#e3d7c1|#cdc2d3|#c6bbd8|#bcc7ec|#b2e8e2|#b3e7e2|#e4dacc|#fcd9c4|#fbe1bb";
    color=color.split("|"); //然后通过split方法进行分割
var xuan = document.getElementsByTagName("h1");//获得元素
for(var i=0;i<xuan.length;i++){
xuan[i].style.color=color[parseInt(Math.random() * color.length)];

}
} 
setInterval("changeColor()",100);//死循环,每0.1秒变换一种颜色
//爱心特效

!function(e, t, a) {
function r() {
for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
requestAnimationFrame(r)
}
function n() {
var t = "function" == typeof e.onclick && e.onclick;
e.onclick = function(e) {
t && t(),
o(e)
}
}
function o(e) {
var a = t.createElement("div");
a.className = "heart",
s.push({
el: a,
x: e.clientX - 5,
y: e.clientY - 5,
scale: 1,
alpha: 1,
color: c()
}),
t.body.appendChild(a)
}
function i(e) {
var a = t.createElement("style");
a.type = "text/css";
try {
a.appendChild(t.createTextNode(e))
} catch(t) {
a.styleSheet.cssText = e
}
t.getElementsByTagName("head")[0].appendChild(a)
}
function c() {
return "rgb(" + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + ")"
}
var s = [];
e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame ||
function(e) {
setTimeout(e, 1e3 / 60)
},
i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: ‘‘;width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),
n(),
r()
} (window, document);

</head>

<body>

<marquee direction="left">
    <a id="zx">
    <br>??嘀嘀哞哞</br>
    <br>&nbsp;&nbsp;&nbsp;星星上的张优秀??</br>
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;星星上的张优秀??</br>
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;星星上的张优秀??</br>
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;星星上的张优秀</br>
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;星星上的张优秀</br>
    
    </a>
    </marquee>
    
    
   <scrollamount=#> <marquee scrollamount=20><h1>?嘻嘻?</h1></marquee>


</body>

炫彩字and鼠标爱心

标签:die   tno   java   width   interval   背景   infinite   direction   fun   

原文地址:https://www.cnblogs.com/1112zx/p/11664110.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!