当前位置:网站首页>day39 原型鏈及頁面烟花效果 2021.10.13
day39 原型鏈及頁面烟花效果 2021.10.13
2022-06-28 11:23:00 【即將成為大佬的小夢】
原型鏈:(Object是頂級的構造函數,在js中萬物皆對象)
只要是對象就有一個屬性__proto__,
原型對象也是對象,所以原型對象也有__proto__屬性,這個屬性指向的也是一個原型對象
實例對象的__proto__指向原型對象,原型對象的__proto__指向另外的一個原型對象,都是對象,都有__proto__屬性,所以最後找到的原型都是Object.prototype

實例對象方法屬性的訪問規則:
實例對象訪問屬性的時候,先在實例對象本身查找,找到了就使用
如果找不到,則在__proto__指向的原型對象中查找,找到了就使用
如果找不到在去到原型對象的原型中找,找到了就是使用
找不到繼續往原型的原型中找,最終找到Object.prototype原型,
還是沒有屬性或方法的話,則返回undefined

實現頁面烟花效果:
步驟分析:
1. 出現一個夜空背景 1000*600

2. 給夜空一個點擊事件,點擊夜空div在底部出現一個方塊烟花

--方塊烟花出現的比特置,和點擊的水平比特置是一樣的
3. 方塊烟花從底部昇空,昇到點擊的比特置,然後消失(消失後出現多個圓點烟花)

4. 圓點烟花爆炸效果,每一個圓點烟花運動到隨機的比特置,然後消失

需准備的函數:
運動函數,隨機顏色函數,獲取範圍隨機數的函數,給元素設置樣式的函數





边栏推荐
- Metersphere uses JS to refresh the current page
- Yann Lecun's new paper: the road to building automatic agents
- Threads and thread pools
- windows 10下载安装mysql5.7
- 使用ssm项目对Mysql8进行访问的时候,出现连接失败和一些错误的解决办法
- 合约量化交易系统开发 | 合约量化APP开发(现成案例)
- 元宇宙系统的发展与原理介绍
- Katalon global variable is referenced in testobject
- QML控件类型:TabBar
- 使用 Calendar 计算时间
猜你喜欢

获取系统当前日期

AGCO AI frontier promotion (6.28)

JS foundation 1-js introduction and operator

Practice and Thinking on the architecture of a set of 100000 TPS im integrated message system

Tidb v6.0.0 (DMR): initial test of cache table - tidb Book rush

JS基础3
![[monkey] Introduction to monkey test](/img/70/5a7152d0b6b77df7f9d6ad0e09e000.png)
[monkey] Introduction to monkey test
This Exception was thrown from a job compiled with Burst, which has limited exception support. report errors

Redis6 一:Nosql引入、Redis可以解决什么问题?

Making and using of dynamic library (shared library)
随机推荐
windows 10下载安装mysql5.7
JS基础10
Recommended practice sharing of Zhilian recruitment based on Nebula graph
BigDecimal 类的 compareTo() 和 equals()方法
Redis6 1: what problems can be solved by the introduction of NoSQL and redis?
论文阅读 (59):Keyword-Based Diverse Image Retrieval with Variational Multiple Instance Graph
获取系统当前日期
JS foundation 2
Blackmail virus of industrial control security
Setinterval, setTimeout and requestanimationframe
一套十万级TPS的IM综合消息系统的架构实践与思考
Debug debugging in katalon
方法重写(Override)
For example, the visual appeal of the live broadcast of NBA Finals can be seen like this?
Industry analysis - quick intercom, building intercom
乌国家安全与国防委员会秘书:将对俄境内目标进行精确打击
JS foundation 3
无法重新声明块范围变量
Everyone can participate in open source! Here comes the most important developer activity in dragon lizard community
【sciter】: sciter-fs模块扫描文件API的使用及其注意细节