Rails:如何安装particle.js?(Rails: How do I install particles.js?)
我想在我的应用程序上实现这个,但我不知道如何安装它? 你可以一步一步地发布,以便我可以理解要放在哪里的文件,因为我试图按照github页面上的说明而没有成功。
http://vincentgarreau.com/particles.js/#default
index.html - >我把代码放在views / layouts / application.html中
<div id="particles-js"></div> <script src="particles.js"></script>
app.js - >我把它放在assets / javascript / application.js中
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ particlesJS.load('particles-js', 'assets/particles.json', function() { console.log('callback - particles.js config loaded'); });
particles.json - >我把它放在assets / javascript / application.js中
{ "particles": { "number": { "value": 80, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 10, "random": true, "anim": { "enable": false, "speed": 80, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 300, "color": "#ffffff", "opacity": 0.4, "width": 2 }, "move": { "enable": true, "speed": 12, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": false, "mode": "repulse" }, "onclick": { "enable": true, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 800, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 800, "size": 80, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 400, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }
I want to implement this on my app but I have no clue how I could install this? Can you post a step by step so that I may understand what files to put where as I've tried to follow the instructions on the github page and got not success.
http://vincentgarreau.com/particles.js/#default
index.html --> I put code it in views/layouts/application.html
<div id="particles-js"></div> <script src="particles.js"></script>
app.js --> I put it in assets/javascript/application.js
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ particlesJS.load('particles-js', 'assets/particles.json', function() { console.log('callback - particles.js config loaded'); });
particles.json --> I put it in assets/javascript/application.js
{ "particles": { "number": { "value": 80, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 10, "random": true, "anim": { "enable": false, "speed": 80, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 300, "color": "#ffffff", "opacity": 0.4, "width": 2 }, "move": { "enable": true, "speed": 12, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": false, "mode": "repulse" }, "onclick": { "enable": true, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 800, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 800, "size": 80, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 400, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }
原文:https://stackoverflow.com/questions/31339540
最满意答案
如果你真的很懒,并且不想将数据保存到它所属的用户应用程序数据目录中,则需要为该进程启用虚拟化,然后在Windows处理其余部分时可以写入Program Files。
- 使用OpenProcessToken获取进程令牌的句柄。
- 通过使用TokenVirtualizationEnabled调用SetTokenInformation,为令牌启用虚拟化。
If you're really that lazy and don't want to save the data to the user's application data directory where it belongs, you need to enable virtualization for the process, and then you can write to Program Files while Windows handles the rest.
- Get a handle to your process token using OpenProcessToken.
- Enable virtualization for the token by calling SetTokenInformation with TokenVirtualizationEnabled.
相关问答
更多-
您不需要提升权限即可从Program Files (x86)文件夹中读取文件。 检查如何打开文件以供阅读。 您应该在普通用户模式和高级模式下指定不同的FileAccess标志。 对于普通用户模式,应该用'FileAccess.Read`打开: using (FileStream settingsFile = new FileStream(@"C:\Program Files (x86)\xxx", FileMode.Open, FileAccess.Read)) { // Do the job } 要 ...
-
好吧,没有人回答,所以我会把它放在这里对未来的人有所帮助: - 清理Windows VirtualStore时,清理具有旧版本DLL的破碎系统,包括TeeChart,FastReport,Indy等,这些DLL往往会涉及混乱,因为它们既可以作为“delphi附带的开箱包”以及经常作为升级版本安装,如果您直接从供应商处购买并安装它们,或者第三,您可能会在公司的超级组件目录中拥有自己的编译副本。 - 当搜索重复或过期的BPL时,在Windows中进行文件搜索不会在虚拟存储中查找,您必须手动为您的流程或用户或程序 ...
-
你想要CSIDL_COMMON_STARTMENU 。 这似乎没有在Environment.SpecialFolders枚举中定义,但您可以通过P / Invoke使用Win32 API : [DllImport("shell32.dll")] static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate); int CSIDL_C ...
-
问题已经解决了。 事实证明,我不是一个x86问题,它不会只在Windows Vista上遇到。 在Windows XP上观察到相同的问题/错误,但是出现了错误签名。 在Windows Vista中,我必须检查事件处理程序中的错误。 显示的错误与此类似: 事件类型:clr20r3 P1:HelloWorld.exe P2:1.0.0.0 P3:515b6326 P4:system.data.sqlserverce P5:4.0.0.0 P6:4fcd17f1 P7:8f0 P8:25 P9:System.wi ...
-
启动进程监视器并观察它的作用: http : //technet.microsoft.com/en-us/sysinternals/bb896645.aspx Fire up Process Monitor and watch what it does: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
-
你的问题的答案是,你不能。 文件和注册表虚拟化是一种临时兼容性攻击,存在于当前版本的Windows中,因此错误的应用程序将暂时继续工作。 Microsoft没有提供处理重定向文件的功能。 执行此操作的应用程序处于错误状态,需要修复。 来自Developing for Windows博客 : 用户帐户控制数据重定向 今天,许多应用程序仍然设计为将文件写入Program Files,Windows目录或系统根目录(通常是C盘)文件夹。 虚拟化仅用于帮助应用程序与现有程序兼容。 为Microsoft Window ...
-
如何获取应用程序的AppData VirtualStore路径?(How to get the AppData VirtualStore path of an application?)[2023-11-16]
假设Example App是运行代码的应用Example App则使用该应用程序检索第一个目录 string strFilePath = Path.Combine(Application.ExecutablePath, "Data.ini"); 第二个看起来不像设置的位置,但为此,您可以尝试Application和Environment类。 尝试类似 string strFilePath = Path.Combine(Application.UserAppDataPath, "Data.ini"); 我 ... -
如果你真的很懒,并且不想将数据保存到它所属的用户应用程序数据目录中,则需要为该进程启用虚拟化,然后在Windows处理其余部分时可以写入Program Files。 使用OpenProcessToken获取进程令牌的句柄。 通过使用TokenVirtualizationEnabled调用SetTokenInformation,为令牌启用虚拟化。 If you're really that lazy and don't want to save the data to the user's applicati ...
-
可能性1: 您的程序在其清单中标记为需要管理员权限 可能性2: 您的程序名为setup.exe或install.exe - 此类程序名称始终导致需要管理员权限 有关这些和其他可能性的详细说明,请参阅“ 了解用户帐户控制Technet”一文 Possibility 1: Your program is marked as needing admin rights in its manifest Possibility 2: Your program is called setup.exe or install ...
-
签署代码后,生活在vista中会更容易。 你可以从verisign或godaddy获得代码签名证书。 一旦你有了,你可以在Windows sdk中运行signtool Life in vista is easier when you have your code signed. you can get a code signing cert from verisign or godaddy. Once you have that you can run signtool in the windows sdk ...