atomic-bohr-model开源项目

我要开发同款
匿名用户2021年12月17日
76阅读
开发技术JavaScript
所属分类Atom插件、插件和扩展、Atom 插件
授权协议MIT License

作品详情

atomic-bohr-model

Thisd3poweredvisualizationpackageprovidesatomicanimationswhicharehighlycustomizable.Anexampleappusingthispackagecanbefoundhere:https://acollectionofatoms.github.io/atomic-bohr-model-examples/index.html

FeaturesResponsiveBuiltwithd3.jsinES6Easilymodifiednucleus,orbital,andelectronradii,colorAnimatedinitializationOrbitalrotationalpatterns:linearPositivelinearNegativecubedPositivecubedNegativeparabolaUpparabolaDownrandomuniformOrbitalpatternscanbeentirelyclockwise,counter-clockwise,oralternatingDynamic"address"systemprovidesdistinctID'sforeachcomponentoftheAtom(Helpfulforanimationandstyling.See:Properties)WikipediasummaryandlinksprovidedforeachAtomobject(See:Properties)Electronconfigurationsprovidedbyhttps://en.wikipedia.org/wiki/Electron_shellInstallation

npminstallatomic-bohr-model--save

Usage

Includethisscriptelementinyourmark-up:

<scripttype="text/javascript"src="./node_modules/atomic-bohr-model/dist/atomicBohrModel.min.js"charset="utf-8"></script>

alongwithadivtocontainyouratom.

<divid="bohr-model-container"></div>`

YouMUSTensureyourdivhasawidthandheight

Theatomsprovidedarerestrictedtothosewhichexistandhavebeendiscovered,therefore:

1<=numElectrons<=118

(passinganything<1or>118willresultineitherHydrogenorUnunoctium)

AtminimumnumElectrons,containerId,andauniqueidNumbermustbeprovided.

varatomicConfig={containerId:"#bohr-model-container",numElectrons:88,idNumber:1}varmyAtom=newAtom(atomicConfig)OptionsvarmyAtom=newAtom({containerId:'#my-container',numElectrons:1,//Anintegerbetween1and118nucleusRadius:30,//Ifnotsuppliedwillbe1/12ofthecontainerswidthnucleusColor:'rgba(124,240,10,0.5)',//Hex,stringorrbgaelectronRadius:3,//Defaultvalueis3electronColor:'blue',//SeenucleusColororbitalSpacing:10,//Ifnotspecifiedwillbea1/3rdofthenucleusRadiusorbitalWidth:1,//widthoforbitalpaths,defaultis0.1orbitalColor:'black',//seeelectronColoridNumber:1,//RequiredinttoprovideuniqueAtomsanimationTime:1300,//TimeinmillisecondsforinitialelectronanimationrotateConfig:{speed:50,clockwise:true},//RotatesentireAtomwithgivenparamsorbitalRotationConfig:{//Invokesorbitalrotationsatinitializationpattern:{alternating:false,//Alternateorbitaldirectionclockwise:false,//Directionforallorbitalspreset:'cubedPositive',//Stringtosetpattern(seeFeaturessection)}},symbolOffset:8,//WhenmodifyingnucleusradiusthismayneedadjustingdrawSymbol:true//Renderatomicsymbolornot})MethodsmyAtom.removeElectrons(2)

Removesagivennumberofelectrons

myAtom.addElectrons(7)

Addsagivennumberofelectrons

myAtom.setNumElectrons(33)

Setsthenumberofelectrons

varorbitalRotationConfig={pattern:{alternating:true,clockwise:false,preset:'parabolaUp',}}myAtom.rotateOrbitals(orbitalRotationConfig)

Rotatesorbitalswithgivenconfiguration

myAtom.destroy()

Destroysthe<g>elementhousingtheAtombut,NOTtheparent<svg>

varrotateConfig={speed:50,clockwise:true}myAtom.rotate(rotateConfig)

Rotatesentireatomwithgivenconfiguration

Properties//WikipediadatamyAtom.elementNamemyAtom.wikiSummarymyAtom.wikiUrlmyAtom.electronConfigmyAtom.atomicSymbol//IdentifyingAtomsandtheircomponentsmyAtom.atomId//ex:atom-0varfirstOrb=myAtom.orbitals[0]//d3selectionfirstOrb.orbitalId//ex:atom-0-orbital-0firstOrb.electrons[0].eId//ex:atom-0-oribital-0-electron-0
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论