当前位置:网站首页>day39 原型链及页面烟花效果 2021.10.13
day39 原型链及页面烟花效果 2021.10.13
2022-06-28 11:20:00 【即将成为大佬的小梦】
原型链:(Object是顶级的构造函数,在js中万物皆对象)
只要是对象就有一个属性__proto__,
原型对象也是对象,所以原型对象也有__proto__属性,这个属性指向的也是一个原型对象
实例对象的__proto__指向原型对象,原型对象的__proto__指向另外的一个原型对象,都是对象,都有__proto__属性,所以最后找到的原型都是Object.prototype

实例对象方法属性的访问规则:
实例对象访问属性的时候,先在实例对象本身查找,找到了就使用
如果找不到,则在__proto__指向的原型对象中查找,找到了就使用
如果找不到在去到原型对象的原型中找,找到了就是使用
找不到继续往原型的原型中找,最终找到Object.prototype原型,
还是没有属性或方法的话,则返回undefined

实现页面烟花效果:
步骤分析:
1. 出现一个夜空背景 1000*600

2. 给夜空一个点击事件,点击夜空div在底部出现一个方块烟花

--方块烟花出现的位置,和点击的水平位置是一样的
3. 方块烟花从底部升空,升到点击的位置,然后消失(消失后出现多个圆点烟花)

4. 圆点烟花爆炸效果,每一个圆点烟花运动到随机的位置,然后消失

需准备的函数:
运动函数,随机颜色函数,获取范围随机数的函数,给元素设置样式的函数





边栏推荐
- Remote connection of raspberry pie in VNC viewer mode without display
- 还在用 SimpleDateFormat 做时间格式化?小心项目崩掉!
- 《运营之光3.0》全新上市——跨越时代,自我颠覆的诚意之作!
- 毕业季,给初入社会的你一些建议
- 李宏毅《机器学习》丨7. Conclusion(总结)
- Does flink1.15 support MySQL views? I configured the view name at the table name to save, but the table could not be found. Think
- Convert the file URL in the browser to a file stream
- Mysql使用max函数查询不到最大值
- 数据库系列:有什么办法对数据库的业务表进行无缝升级
- JS foundation 5
猜你喜欢

Threads and thread pools

【实战】1364- 实现一个完美的移动端瀑布流组件(附源码)

获取系统当前日期

太阳能无线LED显示屏的特点

Oracle 日期格式化异常:无效数字

How to use output in katalon

JS基础1-JS引入与运算符

行业分析| 快对讲,楼宇对讲

Remote connection of raspberry pie in VNC viewer mode without display
![[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)](/img/e8/21d8d81a3d7b544687d6adc06ad4b1.png)
[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)
随机推荐
[cloud resident co creation] detailed introduction to DWS alarm service DMS and cluster connection mode
[QT] connect syntax reference implementation
获取系统当前日期
如临现场的视觉感染力,NBA决赛直播还能这样看?
Calculate time using calendar
MySQL (I)
Redis6 1: what problems can be solved by the introduction of NoSQL and redis?
利用soapUI获取freemarker的ftl文件模板
JS foundation 4
[practice] appium settings app is not running after 5000ms
功能真花哨,价格真便宜!长安全新SUV真实力到底怎样?
太阳能无线LED显示屏的特点
JS foundation 3
It is safer for individuals to choose which securities company to open an account for buying floor funds
个人买场内基金选择什么证券公司开户好,更安全
李宏毅《机器学习》丨7. Conclusion(总结)
Zero foundation self-study SQL course | if function
毕业季 新的开始
[monkey] Introduction to monkey test
远程登录sshd服务