当前位置:网站首页>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>
边栏推荐
- 磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
- Usage of JOIN in MySQL
- Redis简单学习笔记
- Redis simple study notes
- 【面试】失败的一次面试
- 啃瓜记录第一天
- IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
- URL URL
- ModuleNotFoundError No module named 'xxx' possible solutions
- DSPE-PEG-DBCO Phospholipid-Polyethylene Glycol-Dibenzocyclooctyne A Linear Heterobifunctional Pegylation Reagent
猜你喜欢

骨架效果 之高级渐变,适用图片等待时

Phospholipid-polyethylene glycol-hydrazide, DSPE-PEG-Hydrazide, DSPE-PEG-HZ, MW: 5000

最新,每天填坑,Jeston TX1 精卫填坑,第一步:刷机

npm--package.json---require

Debian 10 NTP Service Configuration

亚马逊卖家怎么提升转化率

DOM manipulation---magnifying glass case

第一篇博客

Chemical reagent Phospholipid-polyethylene glycol-hydroxyl, DSPE-PEG-OH, DSPE-PEG-Hydroxyl, MW: 5000

Cut out web icons through PS 2021
随机推荐
Deveco studio Hongmeng app access network detailed process (js)
磷脂-聚乙二醇-醛基 DSPE-PEG-Aldehyde DSPE-PEG-CHO MW:5000
区间问题 : 今年暑假不AC
The @autowired distinguished from @ the Resource
最新,每天填坑,Jeston TX1 精卫填坑,第一步:刷机
Phospholipid-polyethylene glycol-azide, DSPE-PEG-Azide, DSPE-PEG-N3, MW: 5000
js 取字符串中某位置某特征的值,如华为(Huawei)=>华为
String comparison size in MySQL (date string comparison problem)
querystring模块
Redis简单学习笔记
Cloud server installation and deployment of Nacos 2.0.4 version
化学试剂磷脂-聚乙二醇-羟基,DSPE-PEG-OH,DSPE-PEG-Hydroxyl,MW:5000
Error: with open(txt_path,'r') as f: FileNotFoundError: [Errno 2] No such file or directory:
Scientific research reagent DMPE-PEG-Mal dimyristoylphosphatidylethanolamine-polyethylene glycol-maleimide
环形链表---------约瑟夫问题
配置mmdet来训练Swin-Transformer之一配置环境
subprocess.CalledProcessError: Command ‘pip install ‘thop‘‘ returned non-zero exit status 1.
猴子选大王
kettle 安装与配置
基本运算符