Testp5: Unterschied zwischen den Versionen
Aus exmediawiki
Karin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „=== how to work locally with p5 === setting up p5.js with an editor on your own computer To run p5.js in your computer you will need a text editor. You can u…“) |
Karin (Diskussion | Beiträge) |
||
Zeile 1: | Zeile 1: | ||
− | === | + | === How to work locally with p5 === |
− | + | If you want to work with p5.js on your computer, you need an editor. <br> | |
− | + | The most simple one being text editor. There are also several code editors you can choose from, e.g. [https://subethaedit.net/ subethaedit], [https://www.sublimetext.com/2 sublime text 2], [http://brackets.io/ brackets], https://atom.io/ atom], [https://notepad-plus-plus.org/ notepad++] just to name a few. | |
− | + | E.g. in subethaedit you can write, execute and manage different languages, for the purposes of p5.js it is javascript. It enables you to work with javascript locally on your computer. Furthermore you can use it to write your own html-code to execute your js-file and test it directly in your browser. Later on you can embed the html-page on a website. | |
− | |||
− | If you want to work with p5.js on your computer, you need an editor. | ||
− | E.g. in subethaedit you can manage different languages, for the purposes of p5.js it is javascript. It enables you to work with javascript locally on your computer. Furthermore you can use it to write your own html-code to execute your js-file and test it directly in your browser. Later on you can embed the html-page on a website. | ||
the html-page can look like this:<br> | the html-page can look like this:<br> | ||
Zeile 41: | Zeile 38: | ||
The line <script src="forexample.js"></script> refers to the file forexample.js, which you work on in the editor. | The line <script src="forexample.js"></script> refers to the file forexample.js, which you work on in the editor. | ||
+ | The necessary libraries can accessed directly by referencing to the online repositories. This also ensures that you always work with the most recent update. If you prefer to work with libraries downloaded directled from p5, you'll need to include these in the folder you are also storing your .js-file. | ||
+ | |||
+ | For more information: [https://p5js.org/get-started/#settingUp setup of p5 on your computer], [https://p5js.org/get-started/ get started]. |
Version vom 2. Februar 2021, 17:04 Uhr
How to work locally with p5
If you want to work with p5.js on your computer, you need an editor.
The most simple one being text editor. There are also several code editors you can choose from, e.g. subethaedit, sublime text 2, brackets, https://atom.io/ atom], notepad++ just to name a few.
E.g. in subethaedit you can write, execute and manage different languages, for the purposes of p5.js it is javascript. It enables you to work with javascript locally on your computer. Furthermore you can use it to write your own html-code to execute your js-file and test it directly in your browser. Later on you can embed the html-page on a website.
the html-page can look like this:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" Content-Type: text/javascript;charset=utf-8">
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<TITLE>for_example</TITLE>
<script src="https://cdn.jsdelivr.net/npm/p5@1.0.0/lib/p5.min.js"></script>
</HEAD>
<BODY BGCOLOR="#cdcdcd">
<script src="forexample.js"></script>
</BODY>
</HTML>
The line <script src="forexample.js"></script> refers to the file forexample.js, which you work on in the editor. The necessary libraries can accessed directly by referencing to the online repositories. This also ensures that you always work with the most recent update. If you prefer to work with libraries downloaded directled from p5, you'll need to include these in the folder you are also storing your .js-file.
For more information: setup of p5 on your computer, get started.