diff --git a/assets/index-cf946704.js b/assets/index-281307f5.js similarity index 99% rename from assets/index-cf946704.js rename to assets/index-281307f5.js index 2d6faca..bbafc75 100644 --- a/assets/index-cf946704.js +++ b/assets/index-281307f5.js @@ -866,6 +866,12 @@ ${t("Demonstrative filtering. Final list is [100, 200]",` mod(1)::snd('sine').sustain(0.1).freq([100,100,100,100,200].unique().beat()).out() `,!0)} +- add(): add a given amount to every list element. +- sub(): add a given amount to every list element. +- mult(): add a given amount to every list element. +- division(): add a given amount to every list element. The method is named division because obviously div is already taken. + +${t("Simple addition","[1, 2 ,3].add(2).beat()",!0)} ## Simple patterns @@ -994,18 +1000,26 @@ The code you enter in any of the scripts is evaluated in strict mode. This tells There are some techniques that Topos players are using to keep their JavaScript short and tidy. Don't try to write the shortest possible code but use shortcuts when it makes sense. It's sometimes very comforting to take time to write utilities and scripts that you will often reuse. Take a look at the following examples: -${t("Shortening your if conditions",`// The && symbol (overriden by :: in Topos) is very often used for conditions! -mod(.75) :: snd('zap').out() +${t("Shortening your if conditions",` +// The && symbol (overriden by :: in Topos) is very often used for conditions! +mod(.75) :: snd('linnhats').n([1,4,5].beat()).out() +mod(1) :: snd('bd').out() //if (true) && log('very true') +// These two lines are the same: +// mod(1) && snd('bd').out() +//// mod(1) :: snd('bd').out() + `,!0)} -${t("More complex conditions using ?",`// The ? symbol can be used to write a if/true/false condition +${t("More complex conditions using ?",` +// The ? symbol can be used to write a if/true/false condition mod(4) ? snd('kick').out() : mod(2)::snd('snare').out() // (true) ? log('very true') : log('very false') `,!1)} -${t("Using not and other short symbols",`// The ! symbol can be used to reverse a condition +${t("Using not and other short symbols",` +// The ! symbol can be used to reverse a condition mod(4) ? snd('kick').out() : mod(2)::snd('snare').out() !mod(2) :: mod(0.5)::snd('clap').out() `,!1)} diff --git a/index.html b/index.html index dc3cc7d..d531126 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Topos - +