整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

Dust Generator-逼真粒子粉尘漂浮生成器Blender插件

ust Generator专为Blender打造的插件,可以帮助用户生成逼真的粒子粉尘漂浮颗粒,从而让你的3D建模环境更加的真实。使用这个插件可以让你制造这些漂浮的颗粒更加的方便,支持对颗粒大小进行设置,小的时候可以模拟烟雾粉尘效果,大的时候也可以用来模拟花瓣和落叶飘动的效果。支持Cycles和EEVEE渲染器。

来源:http://www.3h3.com/soft/282294.html

版本支持

支持软件 Blender 3.1、3.2

使用说明

1.打开软件,顶部菜单点击 编辑(Edit) → 首选项(3.0之后版本为偏好设置) → 插件(AAdd-ons) → 安装(Install) ,在弹出的窗口里选择插件.zip文件安装

2.重启Blender,在 文件 → 用户设置 →勾选启用 插件即可

刀PPT提供免费PPT模板,清新水彩树叶背景的读书分享会PPT模板,模板是设计好的PPT模板直接打开编辑即可。

页数:25页

编号:PPT11983

大小:6.54MB

软件:PowerPoint

格式:PPTX

比例:16:9

复制下载:ppt.101dao.com/ppt/ppt-PPT11983.html

习一门新语言涉及一系列步骤,而掌握一门新语言则是耐心、实践、错误和经验的产物。

有些开发人员将拥有足够的知识来根据客户的需求来提供特性,但是要做一个好开发人员,它需要的不仅仅是它。

一个优秀的开发人员是一个需要时间回来并能很好地掌握语言的基础/核心概念的人。

今天我们深入研究javascript闭包,希望您所学习的知识对于您的项目有好处。

什么是javascript闭包?

JavaScript闭包当内部函数可以访问外部函数成员时(词汇范围即使在外部函数的范围外执行时也可以。

因此,我们不能谈论关闭问题,同时也不履行职能和范围。

javascript中的范围

范围指程序中定义的变量的可见性程度。在javascript中创建范围的方法包括:try-catch blocks, functionslet keyword还有花括号里的其他。我们主要有两种不同的范围:全球范围和局部范围.

var initialBalance = 0 // Global Scopefunction deposit (amount) {
 /**
 * Local Scope
 * Code here has access to anything declared in the global scope
 */
 var newBalance = parseInt(initialBalance) + parseInt(amount)
 return newBalance}

JavaScript中的每个函数在声明时都会创建自己的本地作用域。

这意味着,在函数的本地范围内声明的任何东西都不能从外部访问。请考虑以下说明:

var initialBalance = 300 // Variable declared in the Global Scopefunction withdraw (amount) {
 var balance // Variable declared in function scope
 balance = parseInt(initialBalance) - parseInt(amount)
 return balance}console.log(initialBalance) // Will output initialBalance value as it is declared in the global scopeconsole.log(balance) // ReferenceError: Can't find variable: balance

词法范围

JavaScript的词法范围在编译阶段。它设置变量的范围,以便它只能从定义它的代码块中调用/引用它。

在周围函数块中声明的函数可以访问周围函数的词法范围内的变量。

var initialBalance = 300 // Global Scopefunction withdraw (amount) {
 /**
 * Local Scope
 * Code here has access to anything declared in the global scope
 */
 var balance = parseInt(initialBalance) - parseInt(amount)
 const actualBalance = (function () {
 const TRANSACTIONCOST = 35
 return balance - TRANSACTIONCOST /**
 * Accesses balance variable from the lexical scope
 */
 })() // Immediately Invoked Function expression. IIFE
 // console.log(TRANSACTIONCOST) // ReferenceError: Can't find variable: TRANSACTIONCOST
 return actualBalance}

调用其封闭函数之外的内部函数,但仍然维护对其封闭函数(词法范围)中变量的访问,从而创建一个javascript闭包。

function person () {
 var name = 'Paul' // Local variable
 var actions = {
 speak: function () {
 // new function scope
 console.log('My name is ', name) /**
 * Accessing the name variable from the outer function scope (lexical scope)
 */
 }
 } // actions object with a function
 return actions /**
 * We return the actions object
 * We then can invoke the speak function outside this scope
 */}person().speak() // Inner function invoked outside its lexical Scope

闭包允许我们公开接口,同时隐藏和保存外部范围内的执行上下文。

一些javascript设计模式使用闭包。

模块模式

其中一个很好实现的模式就是模块模式,这个模式允许您模仿:私有、公共和特权成员。

var Module = (function () {
 var foo = 'foo' // Private Property
 function addToFoo (bam) { // Private Method
 foo = bam return foo }
 var publicInterface = {
 bar: function () { // Public Method
 return 'bar'
 },
 bam: function () { // Public Method
 return addToFoo('bam') // Invoking the private method
 }
 }
 return publicInterface // Object will contain public methods})()Module.bar() // barModule.bam() // bam

根据上面的模块模式说明,只有返回对象中的公共方法和属性可以在闭包的执行上下文之外使用。

所有私有成员仍然存在,因为它们的执行上下文保存但隐藏在外部范围内。

关于闭包的更多插图

当我们将函数传递到setTimeout或者任何类型的回调。由于闭包函数的作用,函数仍然记住词法范围。

function foo () {
 var bar = 'bar'
 setTimeout(function () {
 console.log(bar)
 }, 1000)}foo() // bar

闭包和循环

for (var i = 1; i <= 5; i++) {
 (function (i) {
 setTimeout(function () {
 console.log(i)
 }, i * 1000)
 })(i)}/**
* Prints 1 thorugh 5 after each second
* Closure enables us to remember the variable i
* An IIFE to pass in a new value of the variable i for each iteration
* IIFE (Immediately Invoked Function expression)
*/
for (let i = 1; i <= 5; i++) {
 (function (i) {
 setTimeout(function () {
 console.log(i)
 }, i * 1000)
 })(i)}/**
* Prints 1 through 5 after each second
* Closure enabling us to remember the variable i
* The let keyword rebinds the value of i for each iteration
*/

我打赌我们现在已经了解闭包了,并且可以做以下操作:

  • 演示它的使用例或识别它在我们从未知道我们使用它的上下文中。
  • 按照我们希望的情况维护执行上下文
  • 在javascript模块模式中实现代码
  • 使用闭包在我们的代码中,清楚地理解

关注小编了解更多精彩内容,还可私信小编,领取精品的前端免费学习课程视频,同时我将为您分享精品资料。