当前位置:首页 » 操作系统 » HTML转盘源码

HTML转盘源码

发布时间: 2022-06-27 17:52:49

❶ html下怎么实现转盘式抽奖(每个奖品块按顺序亮灭,频率越来越慢,最后停在最终奖品)而不是突然停,

思路:1.用h5技术,将每个奖品块的颜色默认颜色为暗色;2.指针到达的奖品块,将颜色调明,指针离开奖品块,则回复默认颜色;3.用自定义动画控制频率。

❷ HTML源代码

<style type="text/css">
#demo{height:120px;overflow:hidden;}
#demo1{float:left;}#demo2{float:left;}
#indemo{float:left; width:1000%}
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">这里放你要循环的图片</div>
<div id="demo2"></div>
</div>
</div>
<script>
<!--
var speed=20; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab.scrollLeft<=0)
tab.scrollLeft+=tab2.offsetWidth
else{
tab.scrollLeft--;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>

可以的啊,把上面代码复制到一个新建的html中,把<img src="你的图片" />放到代码中就行了啊

❸ 用html5+js 做一个转盘抽奖怎么做,求源码

5分给你个程序。。。
自己参考改吧

<input type="button" value="开始旋转" onclick="spin();" style="float: left;" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<canvas id="wheelcanvas" width="500" height="500"></canvas>
<script type="application/javascript">
var colors = ["#B8D430", "#3AB745", "#029990", "#3501CB",
"#2E2C75", "#673A7E", "#CC0071", "#F80120",
"#F35B20", "#FB9A00", "#FFCC00", "#FEF200"];
var restaraunts = ["北京", "上海", "天津", "南京",
"杭州", "深圳", "武汉", "济南",
"重庆", "大连", "合肥", "郑洲"];

var startAngle = 0;
var arc = Math.PI / 6;
var spinTimeout = null;

var spinArcStart = 10;
var spinTime = 0;
var spinTimeTotal = 0;

var ctx;

function draw() {
drawRouletteWheel();
}

function drawRouletteWheel() {
var canvas = document.getElementById("wheelcanvas");
if (canvas.getContext) {
var outsideRadius = 200;
var textRadius = 160;
var insideRadius = 125;

ctx = canvas.getContext("2d");
ctx.clearRect(0,0,500,500);

ctx.strokeStyle = "black";
ctx.lineWidth = 2;

ctx.font = 'bold 12px sans-serif';

for(var i = 0; i < 12; i++) {
var angle = startAngle + i * arc;
ctx.fillStyle = colors[i];

ctx.beginPath();
ctx.arc(250, 250, outsideRadius, angle, angle + arc, false);
ctx.arc(250, 250, insideRadius, angle + arc, angle, true);
ctx.stroke();
ctx.fill();

ctx.save();
ctx.shadowOffsetX = -1;
ctx.shadowOffsetY = -1;
ctx.shadowBlur = 0;
ctx.shadowColor = "rgb(220,220,220)";
ctx.fillStyle = "black";
ctx.translate(250 + Math.cos(angle + arc / 2) * textRadius, 250 + Math.sin(angle + arc / 2) * textRadius);
ctx.rotate(angle + arc / 2 + Math.PI / 2);
var text = restaraunts[i];
ctx.fillText(text, -ctx.measureText(text).width / 2, 0);
ctx.restore();
}

//Arrow
ctx.fillStyle = "black";
ctx.beginPath();
ctx.moveTo(250 - 4, 250 - (outsideRadius + 5));
ctx.lineTo(250 + 4, 250 - (outsideRadius + 5));
ctx.lineTo(250 + 4, 250 - (outsideRadius - 5));
ctx.lineTo(250 + 9, 250 - (outsideRadius - 5));
ctx.lineTo(250 + 0, 250 - (outsideRadius - 13));
ctx.lineTo(250 - 9, 250 - (outsideRadius - 5));
ctx.lineTo(250 - 4, 250 - (outsideRadius - 5));
ctx.lineTo(250 - 4, 250 - (outsideRadius + 5));
ctx.fill();
}
}

function spin() {
spinAngleStart = Math.random() * 10 + 10;
spinTime = 0;
spinTimeTotal = Math.random() * 3 + 4 * 1000;
rotateWheel();
}

function rotateWheel() {
spinTime += 30;
if(spinTime >= spinTimeTotal) {
stopRotateWheel();
return;
}
var spinAngle = spinAngleStart - easeOut(spinTime, 0, spinAngleStart, spinTimeTotal);
startAngle += (spinAngle * Math.PI / 180);
drawRouletteWheel();
spinTimeout = setTimeout('rotateWheel()', 30);
}

function stopRotateWheel() {
clearTimeout(spinTimeout);
var degrees = startAngle * 180 / Math.PI + 90;
var arcd = arc * 180 / Math.PI;
var index = Math.floor((360 - degrees % 360) / arcd);
ctx.save();
ctx.font = 'bold 30px sans-serif';
var text = restaraunts[index]
ctx.fillText(text, 250 - ctx.measureText(text).width / 2, 250 + 10);
ctx.restore();
}

function easeOut(t, b, c, d) {
var ts = (t/=d)*t;
var tc = ts*t;
return b+c*(tc + -3*ts + 3*t);
}

draw();
</script>

❹ 为什么要解析html响应的源代码

因为通过HTML源码解析,能够看到当前HTML界面的JavaScript执行情况,能够跟踪给函数执行情况。

❺ 求html静态网页源码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>溅</title>
<style>
<!--
body {
background:url(img/bg9.gif);
margin:0px;
padding:0px;
}
.pic{
border:1px solid #00406c;
}
p {
padding-top:30px;
color:#001671;
}
p.con{
padding-left:4px;
padding-right:4px;
}
p.title {
paddin-top;0px;
}
.chara1 {
font-size:12px;
background-color:#90bcff;
}
.chara1 td{
text-align:center;
}
.chara2 {
background-color:#d2e7ff;
text-align:center;
font-size:12px;
vertical-align:top;
}
.chara3 {
background:#e9fbff url(img/self.jpg) no-repeat bottom right;
vertical-align:top;
padding-top:15px;
padding-left:30px;
font-size:12px;padding-right:15px;
}

-->
</style>
</head>
<body>
<table align="center" cellpadding="1" cellspacing="0">
<tr><td><img src="img/banner3.jpg" border="0" /></td></tr>
</table>
<table width="600px" cellpadding="2" cellspacing="2" class="chara1" align="center">
<tr><td>首面</td><td>心情日记</td><td>Free</td><td>一起走到</td><td>从明天起</td><td>纸飞机</td><td>下一站</td></tr>
</table>
<table width="600px" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="150px" class="chara2"> <p><img src="img/selfpic.jpg" class="pic"/><br />我的日记本</p>
<p class="con">他们彼此深信,是瞬间并发的热情让他们相遇。这样的确定是美丽的,但变幻无常更为美丽。</p>
<p> <img src="img/selfpic2.jpg" class="pic"/><br/>心情轨迹</p>
<p class="con">董事长的一切都让人既羡慕又忌妒,但更让人受不了的是,有一天,上苍忽然赐给他一个神奇的礼物</p> </td>
<td class="chara3">
<h4>介绍</h4>
<p>我努力的抓紧世界,最后却仍被世界淘汰,如果一开始就松手,我会不那么伤心吗?你说,亲爱的孩子,世事难料,随它去吧!</p>
<h4>照相本子</h4>
<p>关于童年,你记住了什么? <br>
两岁时,我拥有一只巨大的粉红猪,它总在我嚎啕大哭时逗我笑。<br>
三岁时,我骑着小木马一路摇到外婆家,它不喝水也不吃草。<br>
四岁时,我离家出走,在公车上睡着了,最后是太空超人送我回家。<br>
我真的没骗你,我通通都记得,还有照片为证。
</p>
<h4>地下铁</h4>
<p>天使在地下铁的入口,<br>
和我说再见的那一年,<br>
我渐渐看不见了。<br>
十五岁生日的那年秋天早晨,<br>
窗外下着毛毛雨,<br>
我喂好我的猫。<br>
六点零五分,<br>
我走进地下铁。</p>
<h4>向左走向右走</h4>
<p>They're both convinced<br>
that a sudden passion joined them.<br>
Such certainth is beautiful,<br>
but uncertainty is more beautiful still.</p>
<br>
</td>
</tr>
</table>
</body>
</html>

❻ HTML源代码是什么

网页空白处点击右键
查看源文件
那就是HTML代码
用处就是以浏览器认识的格式
来布局网页
这里包括图片加载
文字样式等等信息
你看到的东西应该在HTML里都能找到

❼ html网页制作、跪求源代码


❽ 怎么样用html做转盘抽奖软件

自己参考改吧

<input type="button" value="开始旋转" onclick="spin();" style="float: left;" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<canvas id="wheelcanvas" width="500" height="500"></canvas>
<script type="application/javascript">
var colors = ["#B8D430", "#3AB745", "#029990", "#3501CB",
"#2E2C75", "#673A7E", "#CC0071", "#F80120",
"#F35B20", "#FB9A00", "#FFCC00", "#FEF200"];
var restaraunts = ["北京", "上海", "天津", "南京",
"杭州", "深圳", "武汉", "济南",
"重庆", "大连", "合肥", "郑洲"];

var startAngle = 0;
var arc = Math.PI / 6;
var spinTimeout = null;

var spinArcStart = 10;
var spinTime = 0;
var spinTimeTotal = 0;

var ctx;

function draw() {
drawRouletteWheel();
}

function drawRouletteWheel() {
var canvas = document.getElementById("wheelcanvas");
if (canvas.getContext) {
var outsideRadius = 200;
var textRadius = 160;
var insideRadius = 125;

ctx = canvas.getContext("2d");
ctx.clearRect(0,0,500,500);

ctx.strokeStyle = "black";
ctx.lineWidth = 2;

ctx.font = 'bold 12px sans-serif';

for(var i = 0; i < 12; i++) {
var angle = startAngle + i * arc;
ctx.fillStyle = colors[i];

ctx.beginPath();
ctx.arc(250, 250, outsideRadius, angle, angle + arc, false);
ctx.arc(250, 250, insideRadius, angle + arc, angle, true);
ctx.stroke();
ctx.fill();

ctx.save();
ctx.shadowOffsetX = -1;
ctx.shadowOffsetY = -1;
ctx.shadowBlur = 0;
ctx.shadowColor = "rgb(220,220,220)";
ctx.fillStyle = "black";
ctx.translate(250 + Math.cos(angle + arc / 2) * textRadius, 250 + Math.sin(angle + arc / 2) * textRadius);
ctx.rotate(angle + arc / 2 + Math.PI / 2);
var text = restaraunts[i];
ctx.fillText(text, -ctx.measureText(text).width / 2, 0);
ctx.restore();
}

//Arrow
ctx.fillStyle = "black";
ctx.beginPath();
ctx.moveTo(250 - 4, 250 - (outsideRadius + 5));
ctx.lineTo(250 + 4, 250 - (outsideRadius + 5));
ctx.lineTo(250 + 4, 250 - (outsideRadius - 5));
ctx.lineTo(250 + 9, 250 - (outsideRadius - 5));
ctx.lineTo(250 + 0, 250 - (outsideRadius - 13));
ctx.lineTo(250 - 9, 250 - (outsideRadius - 5));
ctx.lineTo(250 - 4, 250 - (outsideRadius - 5));
ctx.lineTo(250 - 4, 250 - (outsideRadius + 5));
ctx.fill();
}
}

function spin() {
spinAngleStart = Math.random() * 10 + 10;
spinTime = 0;
spinTimeTotal = Math.random() * 3 + 4 * 1000;
rotateWheel();
}

function rotateWheel() {
spinTime += 30;
if(spinTime >= spinTimeTotal) {
stopRotateWheel();
return;
}
var spinAngle = spinAngleStart - easeOut(spinTime, 0, spinAngleStart, spinTimeTotal);
startAngle += (spinAngle * Math.PI / 180);
drawRouletteWheel();
spinTimeout = setTimeout('rotateWheel()', 30);
}

function stopRotateWheel() {
clearTimeout(spinTimeout);
var degrees = startAngle * 180 / Math.PI + 90;
var arcd = arc * 180 / Math.PI;
var index = Math.floor((360 - degrees % 360) / arcd);
ctx.save();
ctx.font = 'bold 30px sans-serif';
var text = restaraunts[index]
ctx.fillText(text, 250 - ctx.measureText(text).width / 2, 250 + 10);
ctx.restore();
}

function easeOut(t, b, c, d) {
var ts = (t/=d)*t;
var tc = ts*t;
return b+c*(tc + -3*ts + 3*t);
}

draw();
</script>

❾ 如何查看HTML源码

在浏览器看到的HTML网页,是浏览器解释HTML源代码后产生的结果。
要查看这个HTML的源代码,有两种方法。一是点击鼠标右键,点击View Source(查看源文件)命令;二是选择浏览器菜单View(查看)中的Source(源文件)命令。
利用View Source得到网页的源代码,你可以由此借鉴一下别人写得好的地方。不过在你对HTML知识尚少的情况下,看别人复杂的HTML源代码,只会让你头晕。建议你还是再等等,先掌握一些基础再说。

❿ 网页制作源码HTML,简单不复杂,给分谢谢

你可以看一下这个

热点内容
rc4android 发布:2024-11-15 15:27:25 浏览:741
电脑服务器机箱图片 发布:2024-11-15 15:27:18 浏览:114
网页缓存文件提取 发布:2024-11-15 15:24:42 浏览:144
sqlserver提高 发布:2024-11-15 15:24:40 浏览:659
太空工程师编程模块 发布:2024-11-15 15:15:27 浏览:68
apache压缩 发布:2024-11-15 15:11:54 浏览:245
java比较三个数 发布:2024-11-15 15:08:39 浏览:835
fml加密 发布:2024-11-15 15:05:56 浏览:883
存储上市龙头 发布:2024-11-15 14:52:14 浏览:38
我的世界服务器怎么重置教学 发布:2024-11-15 14:52:13 浏览:124