{"id":536,"date":"2019-09-16T12:48:37","date_gmt":"2019-09-16T02:48:37","guid":{"rendered":"https:\/\/x37v.com\/x37v\/?p=536"},"modified":"2019-09-17T15:49:42","modified_gmt":"2019-09-17T05:49:42","slug":"max-objects-in-css","status":"publish","type":"post","link":"https:\/\/x37v.com\/x37v\/max\/max-objects-in-css\/","title":{"rendered":"Max objects in HTML\/CSS"},"content":{"rendered":"<p>This is a post with no point other than to share some CSS styles I made for recreating the appearance of Max 8 objects in a web browser. I&#8217;ve been planning to post several short entries about Max ideas, and after using a square bracket notation to convey Max code in text\u00a0<code>[like this]<\/code> (when posting on the <a href=\"https:\/\/cycling74.com\/forums\" target=\"_blank\" rel=\"noopener\">Max forums<\/a>\u00a0for example), I tried recreating them in HTML and CSS to help make text-based description of Max code a little more intuitive.<\/p>\n<p>These styles reproduce the vanilla styling of Max 8 <em>objects<\/em>, <em>messages<\/em> and <em>comments<\/em>. With the exception of bubble comments, all elements are displayed in their unlocked state like this:<\/p>\n<section class=\"max patcher\">\n<div><code class=\"max object\" data-inlets=\"2\" data-outlets=\"1\">sah~<\/code> <code class=\"max object\" data-inlets=\"1\" data-outlets=\"2\">jit.pwindow @size 1280 720<\/code> <code class=\"max object\" data-inlets=\"2\" data-outlets=\"1\">qmetro 20 @active 1<\/code><\/div>\n<div><code class=\"max message\">replace drumloop.aif<\/code> <code class=\"max message\">read bounce.mov<\/code> <code class=\"max message\">startwindow<\/code><\/div>\n<div><code class=\"max number\">-40<\/code> <code class=\"max number\">2.71<\/code> <code class=\"max number\">C-2<\/code><\/div>\n<div><code class=\"max comment\">Load sample then hit spacebar<\/code> <code class=\"max comment\">Ensure dac~ is running<\/code> <code class=\"max comment\">Use localhost\/127.0.0.1 port 9000<\/code><\/div>\n<div><code class=\"max comment bubble\" data-arrow=\"left\">Click and drag in the multislider<\/code> <code class=\"max comment bubble\" data-arrow=\"left\">Switch between fullscreen and windowed<\/code> <code class=\"max comment bubble\" data-arrow=\"left\">Turn on metro<\/code><\/div>\n<\/section>\n<h3>Usage<\/h3>\n<p>Max objects can be created with any semantically appropriate inline\/inline-block element, eg. <code>&lt;code&gt;<\/code> or <code>&lt;span&gt;<\/code> \u2014\u00a0the rules in the stylesheet will set <code>display: inline-block;<\/code> on the element used.  As the elements are inline-blocks, they can be placed inline within <code class=\"max object\" data-inlets=\"1\" data-outlets=\"3\">text<\/code> <code class=\"max comment bubble\" data-arrow=\"left\">like this<\/code>.<\/p>\n<p>Give the element a class of <code>\"max object\"<\/code>, <code>\"max message\"<\/code>, <code>\"max number\"<\/code>, <code>\"max comment\"<\/code>, <code>\"max comment bubble\"<\/code>, (or <code>\"max comment bubble multiline\"<\/code>) to produce the desired object. (See Examples below).<\/p>\n<p>I&#8217;ve also sketched up a <a href=\"https:\/\/jquery.com\">jQuery<\/a> script that adds an adjustable number of inlets and outlets based on the elements&#8217; <code>data-inlets<\/code> and <code>data-outlets<\/code> attributes.\u00a0 By default, objects are given an inlet and an outlet, unless specified otherwise by adding <code>data-inlets=\"5\"<\/code> and <code>data-outlets=\"2\"<\/code> attributes. Messages, numbers, and comments are given their standard number of inlets and outlets without having to explicitly specify them. Inlets and outlets can be suppressed though by adding\u00a0<code>data-inlets=\"false\"<\/code> (or\u00a0<code>data-inlets=\"0\"<\/code>) and <code>data-outlets=\"false\"<\/code> (or <code>data-outlets=\"0\"<\/code>).<\/p>\n<h3>Examples<\/h3>\n<section class=\"max patcher\">\n<code class=\"max object\" data-inlets=\"2\" data-outlets=\"1\">metro 125<\/code><br \/>\n<code>&lt;code class=\"max object\" data-inlets=\"2\" data-outlets=\"1\"&gt;metro 125&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max object\" data-inlets=\"8\" data-outlets=\"14\">vst~ 8 8 VCV-Bridge.vst<\/code><br \/>\n<code>&lt;code class=\"max object\" data-inlets=\"8\" data-outlets=\"14\"&gt;vst~ 8 8 VCV-Bridge.vst&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max object\" data-inlets=\"1\" data-outlets=\"2\">jit.bfg<\/code><br \/>\n<code>&lt;code class=\"max object\" data-inlets=\"1\" data-outlets=\"2\"&gt;jit.bfg&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max object\">cpuclock<\/code><br \/>\n<code>&lt;code class=\"max object\"&gt;cpuclock&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max object\" data-inlets=\"0\" data-outlets=\"0\">p adstatus_settings<\/code><br \/>\n<code>&lt;code class=\"max object\" data-inlets=\"0\" data-outlets=\"0\"&gt;p adstatus_settings&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max message\">read ducks.mov, bang<\/code><br \/>\n<code>&lt;code class=\"max message\"&gt;read ducks.mov, bang&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max message\">replace drumLoop.aif<\/code><br \/>\n<code>&lt;code class=\"max message\"&gt;replace drumLoop.aif&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max message\">\"CC 4\" $1<\/code><br \/>\n<code>&lt;code class=\"max message\"&gt;\"CC 4\" $1&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max number\">74<\/code><br \/>\n<code>&lt;code class=\"max number\"&gt;74&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max number selected\">A#5<\/code><br \/>\n<code>&lt;code class=\"max number selected\"&gt;A#5&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max number\">0.98<\/code><br \/>\n<code>&lt;code class=\"max number\"&gt;0.98&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max number selected\">0.0016328<\/code><br \/>\n<code>&lt;code class=\"max number selected\"&gt;0.0016328&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment\">A regular comment<\/code><br \/>\n<code>&lt;code class=\"max comment\"&gt;A regular comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble\" data-arrow=\"left\">A 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble\" data-arrow=\"left\"&gt;A 'bubble' comment&lt;\/code&gt;<\/code><\/section>\n<p>For completeness, comments can also be forced to be multiline with the addition of the &#8216;multiline&#8217; class, like this:<\/p>\n<section class=\"max patcher\">\n<code class=\"max comment bubble multiline\" data-arrow=\"left\">A 'bubble' comment that<br \/>\nspans multiple lines.<\/code><br \/>\n<code>&lt;code class=\"max comment bubble multiline\" data-arrow=\"left\"&gt;A 'bubble' comment that&lt;br \/&gt;spans multiple lines&lt;\/code&gt;<\/code><br \/>\n<\/section>\n<p>(As bubble comments are displayed as &#8216;inline-block&#8217; elements, multiline bubble comments must have line breaks in them with &lt;br \/&gt; element as shown above, to force the text to wrap over multiple lines).<\/p>\n<h3>Bubble Comments<\/h3>\n<p>Changing the <code>data-arrow<\/code> attribute can also be used to change the side of the bubble comment&#8217;s arrow like this:<\/p>\n<section class=\"max patcher\">\n<code class=\"max comment bubble\" data-arrow=\"left\">A left arrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble\" data-arrow=\"left\"&gt;A left arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble\" data-arrow=\"top\">A top arrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble\" data-arrow=\"top\"&gt;A top arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble\" data-arrow=\"right\">A right arrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble\" data-arrow=\"right\"&gt;A right arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble\" data-arrow=\"bottom\">A bottom arrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble\" data-arrow=\"bottom\"&gt;A bottom arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble multiline\" data-arrow=\"left\">A multiline left<br \/>\narrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble multiline\" data-arrow=\"left\"&gt;A multiline&lt;br \/&gt;left arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble multiline\" data-arrow=\"top\">A multiline top<br \/>\narrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble multiline\" data-arrow=\"top\"&gt;A multiline&lt;br \/&gt;top arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble multiline\" data-arrow=\"right\">A multiline right<br \/>\narrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble multiline\" data-arrow=\"right\"&gt;A multiline&lt;br \/&gt;right arrow 'bubble' comment&lt;\/code&gt;<\/code><\/p>\n<p><code class=\"max comment bubble multiline\" data-arrow=\"bottom\">A multiline bottom<br \/>\narrow 'bubble' comment<\/code><br \/>\n<code>&lt;code class=\"max comment bubble multiline\" data-arrow=\"botton\"&gt;A multiline&lt;br \/&gt;bottom arrow 'bubble' comment&lt;\/code&gt;<\/code><br \/>\n<\/section>\n<h3>Unlocked Patcher<\/h3>\n<p>Lastly, if you want to add a <em>patcher<\/em> canvas to your page, use\u00a0a block element (eg. <code>&lt;section&gt;<\/code>) with a <code>\"max patcher\"<\/code> class like this:\u00a0<code>&lt;section class=\"max patcher\"&gt;&lt;\/section&gt;<\/code> \u2014 and nest your elements inside it, eg.<\/p>\n<section class=\"max patcher\"><code class=\"max object\">jit.hello<\/code><\/section>\n<p><code>&lt;section class=\"max patcher\"&gt;<br \/>\n&lt;code class=\"max object\"&gt;jit.hello&lt;\/code&gt;<br \/>\n&lt;\/section&gt;<\/code><\/section>\n<p>Patchers can also have a <code>data-zoom<\/code> attribute if you want to increase\/decrease zoom levels. Acceptable values are 25%, 50%, 75%, 100%, 125%, 150%, 200%, 300%, 400%.  Treat this as a bonus feature that may not work in some browsers (Firefox, Opera).<\/p>\n<section class=\"max patcher\" data-zoom=\"200%\"><code class=\"max object\">jit.bfg<\/code><\/section>\n<p><code>&lt;section class=\"max patcher\" data-zoom=\"200%\"&gt;<br \/>\n&lt;code class=\"max object\"&gt;jit.bfg&lt;\/code&gt;<br \/>\n&lt;\/section&gt;<\/code><\/section>\n<h3>Download<\/h3>\n<p>Download the CSS and JS files:<\/p>\n<ul>\n<li><a href=\"\/x37v\/maxobjects\/maxobjects.css\">maxobjects.css<\/a> [v190913]<\/li>\n<li><a href=\"\/x37v\/maxobjects\/maxobjects.js\">maxobjects.js<\/a> [v190913] (requires <a href=\"https:\/\/jquery.com\">jQuery<\/a>\u00a0to be included first)<\/li>\n<\/ul>\n<p>and add the following to the <code>&lt;head&gt;<\/code>:<\/p>\n<p><code>&lt;link href=\"path\/to\/maxobjects.css\" rel=\"stylesheet\"&gt;<br \/>\n&lt;script src=\"path\/to\/jquery.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"path\/to\/maxobjects.js\"&gt;&lt;\/script&gt;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a post with no point other than to share some CSS styles I made for recreating the appearance of Max 8 objects in a web browser. I&#8217;ve been planning to post several short entries about Max ideas, and after using a square bracket notation to convey Max code in text\u00a0[like this] (when posting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[13],"tags":[],"class_list":["post-536","post","type-post","status-publish","format-standard","hentry","category-max"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4SgL0-8E","_links":{"self":[{"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":49,"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":599,"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/posts\/536\/revisions\/599"}],"wp:attachment":[{"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/media?parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/categories?post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/x37v.com\/x37v\/wp-json\/wp\/v2\/tags?post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}