昨天是三八女神節,本文主要和大家分享html5開發表白神器實作程式碼,大家也可以在這一天用來表白哦。開發三八女王節表白神器運用到的知識點:css33D場景、3D變換、愛心製作技巧、3D立方體製作技巧、自訂動畫,原生js DOM節點操作、循環等。
效果圖如下:
:point_down:html程式碼:
# #519bb4d928f39f008300ef25b8f7f502 94b3e26ee717c64999d7867364b1b4a3 a7aad2613fff6eca142bdb5ab19ce7cd bd4603c3497cf39e3f899d535ba5460a94b3e26ee717c64999d7867364b1b4a3 ad9b261122aacec7a67a655c8f1da74194b3e26ee717c64999d7867364b1b4a3 dea19be7018cbde714326b6f8dfea24894b3e26ee717c64999d7867364b1b4a3 9899fa6995e36ea7277ab64529d91c9794b3e26ee717c64999d7867364b1b4a3 9025375af3dfa26a96f9701388776e4194b3e26ee717c64999d7867364b1b4a3 3078f236d3a2f143213d9cc62f6a690294b3e26ee717c64999d7867364b1b4a3 8ae462508050c1f7943d9e475ed9437d94b3e26ee717c64999d7867364b1b4a3 9e8de99c08d811b7edc010c2b0db557594b3e26ee717c64999d7867364b1b4a3 d52809964aa8c53f567dd6a3d67406e594b3e26ee717c64999d7867364b1b4a3 c83adea3d121708f1dd6da046100000494b3e26ee717c64999d7867364b1b4a3 cc40116d221507b6e524e5820c816b6294b3e26ee717c64999d7867364b1b4a3 4f9eebeaa0362e164653e6ca5c5effd894b3e26ee717c64999d7867364b1b4a3 4a196a9eed4e8a8b7ba2bba467d2e94694b3e26ee717c64999d7867364b1b4a3 7666c40655da8f29e6ea663be5a7b4a394b3e26ee717c64999d7867364b1b4a3 03a43eddea449ae36663a141c552212994b3e26ee717c64999d7867364b1b4a3 e4fff4ce928aeb12acf46020d117ceac94b3e26ee717c64999d7867364b1b4a3 70baf93ffa59d58e6d0de8b11cbb6ed194b3e26ee717c64999d7867364b1b4a3 019d65097e9a49b97792c618c1793bce94b3e26ee717c64999d7867364b1b4a3 805bfaa6704ded6c1e63ac274d0a8e8694b3e26ee717c64999d7867364b1b4a3 dd9af47aa81c11505fbb6d0c3341dbf294b3e26ee717c64999d7867364b1b4a3 26d8e523f7705982a024e7ff640a38f694b3e26ee717c64999d7867364b1b4a3 6f6d0dccd2f6baf6a20b066e48f6375194b3e26ee717c64999d7867364b1b4a3 b5155fee0e7004c7d3de88493b50bdcc94b3e26ee717c64999d7867364b1b4a3 b37c3542b983ee95bb5965aa420d35b594b3e26ee717c64999d7867364b1b4a3 8c60b92344b378aff569b99dae34a2a894b3e26ee717c64999d7867364b1b4a3 51db76e9fae8bb7d5e72be03f95458e794b3e26ee717c64999d7867364b1b4a3 e42072b60e68afad5c2a0551c41930d294b3e26ee717c64999d7867364b1b4a3 aaf348c1c3901896b5c38b9ddf95327f94b3e26ee717c64999d7867364b1b4a3 042c9e48c813d711e003d9bb3189ff7d94b3e26ee717c64999d7867364b1b4a3 d617863df58cd6006afeedb348cd858c94b3e26ee717c64999d7867364b1b4a3 83f3f59dd1b53b3f9006a3dd59f93a1294b3e26ee717c64999d7867364b1b4a3 07c58392a47a8af304295badc8fdfef694b3e26ee717c64999d7867364b1b4a3 8a0558d7965a4ca05323c5245dbcc1ac94b3e26ee717c64999d7867364b1b4a3 5b11af038e21262d5841167fd77922ab94b3e26ee717c64999d7867364b1b4a3 7dc639955f14c087ceb50947b3e4cf9e94b3e26ee717c64999d7867364b1b4a3 b2fddce3c047d762dbf2cc98d39d144794b3e26ee717c64999d7867364b1b4a3 ed0bc77fee33f995aec5eeca344ae1be 97c03d7baa227223c24e03c1b14364c4fbef6caca13e74b2f94cc7bdab29411b94b3e26ee717c64999d7867364b1b4a3 97c03d7baa227223c24e03c1b14364c4d78ca2ae4a50326188e89fd3f823eb9694b3e26ee717c64999d7867364b1b4a3 97c03d7baa227223c24e03c1b14364c477731f04849051ce5743f867b7c5160994b3e26ee717c64999d7867364b1b4a3 97c03d7baa227223c24e03c1b14364c4dcc50d669cf1499b0d4d37d0b62038f694b3e26ee717c64999d7867364b1b4a3 97c03d7baa227223c24e03c1b14364c41890c0a0924b87a17ab540b44a4e2b4894b3e26ee717c64999d7867364b1b4a3 97c03d7baa227223c24e03c1b14364c4826a7549c4987e2930c0dca96ca2783194b3e26ee717c64999d7867364b1b4a3 94b3e26ee717c64999d7867364b1b4a3 94b3e26ee717c64999d7867364b1b4a3
:point_down:css程式碼:
<style>/*css样式表的衣柜*/ *{margin:0px;padding:0px;}/*去除默认外边距、内边距*/ body{background:#000;} .heart3d { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 100px; height: 160px; transform-origin:center center center; transform-style: preserve-3d; animation: spin 15s infinite linear; } #display{width:200px;color:white;font-size:24px;white-space:normal;text-indent:55px;position:absolute;left:100px;top:100px;} .heart3d [class^="rib"] { position: absolute; width: 100px; height: 160px; border: solid #f22613; border-width: 1px 1px 0 0; border-radius: 50% 50% 0 / 40% 50% 0; } .heart3d [class$="1"] { transform: rotateY(10deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="2"] { transform: rotateY(20deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="3"] { transform: rotateY(30deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="4"] { transform: rotateY(40deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="5"] { transform: rotateY(50deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="6"] { transform: rotateY(60deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="7"] { transform: rotateY(70deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="8"] { transform: rotateY(80deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="9"] { transform: rotateY(90deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="10"] { transform: rotateY(100deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="11"] { transform: rotateY(110deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="12"] { transform: rotateY(120deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="13"] { transform: rotateY(130deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="14"] { transform: rotateY(140deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="15"] { transform: rotateY(150deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="16"] { transform: rotateY(160deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="17"] { transform: rotateY(170deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="18"] { transform: rotateY(180deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="19"] { transform: rotateY(190deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="20"] { transform: rotateY(200deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="21"] { transform: rotateY(210deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="22"] { transform: rotateY(220deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="23"] { -webkit-transform: rotateY(230deg) rotateZ(45deg) translateX(30px); transform: rotateY(230deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="24"] { transform: rotateY(240deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="25"] { transform: rotateY(250deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="26"] { transform: rotateY(260deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="27"] { transform: rotateY(270deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="28"] { transform: rotateY(280deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="29"] { transform: rotateY(290deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="30"] { transform: rotateY(300deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="31"] { transform: rotateY(310deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="32"] { transform: rotateY(320deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="33"] { transform: rotateY(330deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="34"] { transform: rotateY(340deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="35"] { transform: rotateY(350deg) rotateZ(45deg) translateX(30px); } .heart3d [class$="36"] { transform: rotateY(360deg) rotateZ(45deg) translateX(30px); } @keyframes spin { to { transform: rotateY(360deg) rotateX(360deg); } } .per{ width:50px;height:50px;position:absolute;top:0;left:0;right:0;bottom:0; margin:auto;transform-style: preserve-3d;perspective:800px; } .img{width:50px;height:50px;position:absolute;backface-visibility:hidden; } .img:nth-child(1){top:-50px;left:0;transform-origin:bottom; transform:translateZ(30px) rotateX(90deg);} .img:nth-child(2){top:50px;left:0;transform-origin:top; transform:translateZ(30px) rotateX(-90deg);} .img:nth-child(3){top:0px;left:-50px;transform-origin:right; transform:translateZ(30px) rotateY(-90deg);} .img:nth-child(4){top:0px;left:50px;transform-origin:left; transform:translateZ(30px) rotateY(90deg);} .img:nth-child(6){top:0px;left:0;transform:translateZ(30px);} .img:nth-child(5){top:0px;left:0;transform:translateZ(0px);} </style>
:point_down:javascript程式碼:
#3f1c4e4b6b16bbbd69b2ee476dc4f83a var i = 0; var str1 = "对于一个网页制作者来说,对HTML语言一定不会感到陌生,因为HTML语言是所有网页制作的基础。但是如果页面能够方便网友们的使用,友好而大方,甚至像桌面应用程序一样,那么仅仅依靠HTML语言是不够的,JavaScript在这其中扮演着重要的角色。"; var str ="如果,爱一个人,守一份爱情,可以在早春一起去踏青,可以在盛夏一起去赏荷,可以在浅秋一起去观月,可以在深冬一起去寻梅,不厌倦,却欢乐,不平凡,却平淡。那么,此生便无憾了。"; window.onload = function typing(){ var myp = document.getElementById("display"); myp.innerHTML += str.charAt(i); var oBtn = document.getElementById('btn'); i++; var id = setTimeout(typing,100); if(i==str.length){ clearTimeout(id); myp.value =""; myp.innerHTML +="" //alert("程序执行完毕!"); } } 2cacc6d41bbb37262a98f745aa00fbf0
以上是html5開發表白神器實作程式碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!