当前位置:网站首页>Day39 prototype chain and page fireworks effect 2021.10.13
Day39 prototype chain and page fireworks effect 2021.10.13
2022-06-28 11:23:00 【Little dream of becoming a big man】
Prototype chain :(Object Is a top-level constructor , stay js Everything is an object )
As long as an object has a property __proto__,
Prototype objects are also objects , So the prototype object also has __proto__ attribute , This attribute also points to a prototype object
Of instance objects __proto__ Point to the prototype object , Of a prototype object __proto__ Point to another prototype object , Are all objects , There are __proto__ attribute , So all the prototypes we finally found were Object.prototype

Access rules for instance object method properties :
When an instance object accesses properties , First, find the instance object itself , Use it when you find it
If you can't find it , It's in __proto__ Point to the prototype object , Use it when you find it
If not, find it in the prototype that goes to the prototype object , Find it and use it
Can't find. Continue to find in the prototype of the prototype , Finally find Object.prototype Prototype ,
If there are no properties or methods , Then return to undefined

Realize the fireworks effect on the page :
Step analysis :
1. A night sky background appears 1000*600

2. Give the night sky a click event , Click on the night sky div A square fireworks appears at the bottom

-- Where the square fireworks appear , It is the same as the horizontal position of the click
3. Square fireworks lifted off from the bottom , Rise to the click position , And then disappear ( After disappearing, multiple dot fireworks appear )

4. Dot fireworks explosion effect , Each dot moves to a random position , And then disappear

Functions to be prepared :
Motion function , Random color function , A function that gets a range of random numbers , Functions that style elements





边栏推荐
- 合约量化交易系统开发 | 合约量化APP开发(现成案例)
- 利用soapUI获取freemarker的ftl文件模板
- 【实战】1364- 实现一个完美的移动端瀑布流组件(附源码)
- NFT卡牌链游系统开发dapp搭建技术详情
- [QT] connect syntax reference implementation
- Recommended practice sharing of Zhilian recruitment based on Nebula graph
- Using loops for, while, and if in katalon else、break、continue
- Katalon global variable is referenced in testobject
- Docker modifies the user name and password of MySQL
- MytipartFile与File的相互转换
猜你喜欢

Industry analysis - quick intercom, building intercom

JS基础8

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

智联招聘基于 Nebula Graph 的推荐实践分享

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

JS foundation 1-js introduction and operator

Spatial-Temporal时间序列预测建模方法汇总

Making and using of dynamic library (shared library)

Remote connection of raspberry pie in VNC viewer mode without display

阿里三面:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别
随机推荐
JS foundation 2
个人买场内基金选择什么证券公司开户好,更安全
Makefile简介
Xshell and xftp tutorial
MySql5.7添加新用户
JS基础3
实体转JSON时,值为null的字段的丢失问题
Makefile introduction
2022 开源软件安全状况报告:超41%的企业对开源安全没有足够的信心
太阳能无线LED显示屏的特点
动态库(共享库)的制作和使用
SQL中的DQL、DML、DDL和DCL是怎么区分和定义的
Tidb v6.0.0 (DMR): initial test of cache table - tidb Book rush
File的io流与base64
Redis6 一:Nosql引入、Redis可以解决什么问题?
行业分析| 快对讲,楼宇对讲
[sword finger offer] 49 Ugly number
This Exception was thrown from a job compiled with Burst, which has limited exception support. 报错
Excel导入导出便捷工具类
setInterval、setTimeout和requestAnimationFrame