当前位置:网站首页>Customer Rating Control
Customer Rating Control
2022-08-02 03:39:00 【cjx177187】
Pentagram rating control
<body>
<style>
#box {
border: 1px solid black;
margin: 100px 0 0 100px;
width: 510px;
height: 100px;
position: absolute;
}
</style>
<h1>点亮小星星:</h1>
<div id="box"></div>
<script>
//画五角星
//1.Draw a five-pointed star using a circle,Find five evenly spaced points on the circle
//2.Use trigonometric functions to calculate the coordinates of each point,as the coordinates of the line
//3.Connect the five dots in two intervals,form a five-pointed star.
Object.prototype.start = function (x, y, r, color = "gray", ancolor = "yellow") {
this.beginPath()
var arr = []
var deg = Math.PI / 180
for (let i = 0; i < 5; i++) {
//1.Draw a five-pointed star using a circle,Find five evenly spaced points on the circle
//2.Use trigonometric functions to calculate the coordinates of each point,as the coordinates of the line
var x1 = x + Math.cos((72 * i - 90) * deg) * r
var y1 = y + Math.sin((72 * i - 90) * deg) * r
arr.push(x1, y1)
}
//3.Connect the five dots in two intervals,form a five-pointed star.
this.moveTo(arr[0], arr[1])
this.lineTo(arr[4], arr[5])
this.lineTo(arr[8], arr[9])
this.lineTo(arr[2], arr[3])
this.lineTo(arr[6], arr[7])
this.lineTo(arr[0], arr[1])
this.fillStyle = color
this.fill()
// this.stroke()
}
//封装一个canvas函数,Add a person to the boxcanvasDetermine the size of the five-pointed star according to the width and height of the box
Object.prototype.canvas = function (n, color) {
var canvas = document.createElement("canvas")
var pen = canvas.getContext("2d")
var r = this.offsetHeight / 2
canvas.heigth = r * 2
canvas.width = (this.offsetHeight + 4) * 5
this.appendChild(canvas)
//Determine the number of lit five-pointed stars,Fill the pentagram to be changed with yellow
for (let i = 0; i < 5; i++) {
if (i < n) {
pen.start(r + r * 2 * i, r, r, "yellow")
} else {
pen.start(r + r * 2 * i, r, r, color)
}
}
}
</script>
<script>
var box = document.querySelector("#box")
box.canvas()
//给box绑定移动事件,Calculate which pentagram the mouse moves to through the properties of the event and the properties of the elastic box,Change the fill color of all the previous pentagrams to yellow
box.onmousemove = function (el) {
var n = Math.ceil((el.clientX - this.offsetLeft) / (this.offsetHeight + 4))
this.innerHTML = " "
this.canvas(n)
}
</script>
边栏推荐
- cross-domain problem solving
- ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- SSM整合
- 函数提升和变量提升
- SOCKS5
- Chemical reagent Phospholipid-polyethylene glycol-hydroxyl, DSPE-PEG-OH, DSPE-PEG-Hydroxyl, MW: 5000
- C语言 十六进制整数字符串转十进制整数
- Redis simple study notes
- 磷脂-聚乙二醇-巯基,DSPE-PEG-Thiol,DSPE-PEG-SH,MW:5000
猜你喜欢
C语言 十六进制整数字符串转十进制整数
Phospholipid-polyethylene glycol-targeted neovascularization targeting peptide APRPG, DSPE-PEG-APRPG
我的小笔记 =》其他东东
yolov5调用ip摄像头时出现的问题
Advanced gradient of skeleton effect, suitable for waiting for pictures
亚马逊卖家怎么提升转化率
【手把手带你学nRF52832/nRF52840 · (1)开发环境搭建】
Problems when yolov5 calls ip camera
The @autowired distinguished from @ the Resource
C语言入门小游戏—三子棋
随机推荐
亚马逊卖家怎么提升转化率
subprocess.CalledProcessError: Command 'pip install 'thop'' returned non-zero exit status 1.
Debian 10 NTP 服务配置
SSM整合
js 取字符串中某位置某特征的值,如华为(Huawei)=>华为
基本运算符
STM32 map文件解析
Redis简单学习笔记
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/yolov5-5.0/models/commo
pyppeteer使用样例脚本
C语言中关于2的n次方求值问题(移位运算)
语义分割标签即像素值的巨坑,transforms.ToTensor()的错误使用
Knowledge Engineering Assignment 2: Introduction to Knowledge Engineering Related Fields
DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine supply, MW: 5000
Phospholipid-Polyethylene Glycol-Aldehyde DSPE-PEG-Aldehyde DSPE-PEG-CHO MW: 5000
Phospholipid-polyethylene glycol-thiol, DSPE-PEG-Thiol, DSPE-PEG-SH, MW: 5000
__dirname
骨架效果 之高级渐变,适用图片等待时
每天填坑,精卫填坑第二集,TX1 配置从固态启动,安装Pytorch