JavaScript animation engine
Import documeantion from gh-pages
Julian Garnier4bf49b6928c2
diff --git a/documentation/assets/css/anime-theme.css b/documentation/assets/css/anime-theme.cssnew file mode 100644index 00000000..18397af0--- /dev/null+++ b/documentation/assets/css/anime-theme.css@@ -0,0 +1,72 @@+.hljs {+ display: block;+ color: #C5C2CB;+}++.hljs-comment,+.hljs-quote {+ color: #5c6370;+ font-style: italic;+}++.hljs-doctag,+.hljs-keyword,+.hljs-formula {+ color: #B08CFF;+}++.hljs-section,+.hljs-name,+.hljs-selector-tag,+.hljs-deletion,+.hljs-subst {+ color: #FF7C72;+}++.hljs-literal {+ color: #1CE2B2;+}++.hljs-string,+.hljs-regexp,+.hljs-addition,+.hljs-attribute,+.hljs-meta-string {+ color: #A6FF8F;+}++.hljs-built_in,+.hljs-class .hljs-title {+ color: #FBF38C;+}++.hljs-variable,+.hljs-template-variable,+.hljs-type,+.hljs-selector-class,+.hljs-selector-attr,+.hljs-selector-pseudo,+.hljs-number {+ color: #FF7C72;+}++.hljs-symbol,+.hljs-bullet,+.hljs-link,+.hljs-meta,+.hljs-selector-id,+.hljs-title {+ color: #61C3FF;+}++.hljs-emphasis {+ font-style: italic;+}++.hljs-strong {+ font-weight: bold;+}++.hljs-link {+ text-decoration: underline;+}diff --git a/examples/assets/css/styles.css b/documentation/assets/css/anime.csssimilarity index 78%rename from examples/assets/css/styles.cssrename to documentation/assets/css/anime.cssindex f5cee714..29f14ea6 100644--- a/examples/assets/css/styles.css+++ b/documentation/assets/css/anime.css@@ -7,8 +7,9 @@ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abb}html,-body {- background-color: #111016;+body,+header {+ background-color: #111116; /* Black */}body {@@ -17,9 +18,8 @@ body {height: 100%;color: white;font-family: sans-serif;- text-transform: uppercase;- letter-spacing: 1px;-webkit-font-smoothing: antialiased;+ overflow-x: hidden;}.color-01 { color: #FF1461; } /* Red */@@ -27,10 +27,10 @@ body {.color-03 { color: #FBF38C; } /* Yellow */.color-04 { color: #A6FF8F; } /* Citrus */.color-05 { color: #18FF92; } /* Green */-.color-06 { color: #1CE2B2; }-.color-07 { color: #5EF3FB; }-.color-08 { color: #61C3FF; }+.color-06 { color: #1CE2B2; } /* Darkgreen */+.color-07 { color: #5EF3FB; } /* Turquoise */+.color-08 { color: #61C3FF; } /* Lightblue */.color-09 { color: #5A87FF; } /* Blue */-.color-10 { color: #B08CFF; }-.color-11 { color: #FB89FB; }-.color-12 { color: #FF48AB; }+.color-10 { color: #8453E3; } /* Purple */+.color-11 { color: #C26EFF; } /* Lavender */+.color-12 { color: #FB89FB; } /* Pink */diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.cssnew file mode 100644index 00000000..3cd19cad--- /dev/null+++ b/documentation/assets/css/documentation.css@@ -0,0 +1,542 @@+.content {+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-orient: horizontal;+ -webkit-box-direction: normal;+ -ms-flex-direction: row;+ flex-direction: row;+ width: 100%;+ height: 100%;+}++/* Headers */++.header {+ position: absolute;+ z-index: 1;+ top: 0;+ width: 239px;+ padding: 0;+}++.logo {+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-align: center;+ -ms-flex-align: center;+ align-items: center;+ width: 240px;+ height: 60px;+ padding: 10px 0 10px 55px;+ color: white;+ text-decoration: none;+ background-image: url(../img/anime-js-v2-logo-white.png);+ background-size: 32px;+ background-position: 12px 13px;+ background-repeat: no-repeat;+}++header {+ position: -webkit-sticky;+ position: -moz-sticky;+ position: -o-sticky;+ position: -ms-sticky;+ position: sticky;+ top: 0;+ z-index: 2;+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-align: center;+ -ms-flex-align: center;+ align-items: center;+ -webkit-box-pack: justify;+ -ms-flex-pack: justify;+ justify-content: space-between;+ width: 100%;+ height: 60px;+ padding-left: 20px;+ padding-right: 20px;+ border-bottom: 1px solid #000;+}++h1, h2 {+ opacity: .6;+ font-size: 22px;+ letter-spacing: 2px;+ text-transform: uppercase;+ font-weight: 200;+}++h1:hover {+ opacity: 1;+}++/* Panes */++.pane {+ position: relative;+ height: 100%;+}++/* Sidebar */++.sidebar {+ width: 240px;+ padding-top: 60px;+ border-right: 1px solid #000;+}++.navigation {+ overflow-y: scroll;+ width: 100%;+ height: 100%;+ padding: 10px 0 20px 20px;+}++.navigation ul {+ height: 30px;+ overflow-y: hidden;+ -webkit-transition:opacity .4s ease;+ transition: opacity .4s ease;+}++.navigation ul li {+ position: relative;+}++.navigation ul li:before {+ content: "";+ display: block;+ position: absolute;+ top: 3px;+ left: 2px;+ width: 1px;+ height: 14px;+ background-color: white;+}++.navigation ul li:first-child:before {+ display: none;+}++.navigation a {+ display: block;+ padding-left: 15px;+ color: #FFF;+ text-decoration: none;+ font-size: 12px;+ line-height: 20px;+ text-transform: uppercase;+}++.navigation ul li:first-child a {+ padding-left: 0;+ padding-top: 10px;+ padding-bottom: 10px;+}++.navigation ul li a,+.navigation ul li:before {+ opacity: .4;+ -webkit-transition:opacity .4s ease, color .4s ease;+ transition: opacity .4s ease, color .4s ease;+}++.navigation ul.active a {+ opacity: .7;+}++.navigation ul li:hover a,+.navigation ul li:hover:before {+ -webkit-transition:none;+ transition: none;+ opacity: 1;+}++.navigation ul li.active a,+.navigation ul li.active:before {+ opacity: 1;+ color: currentColor;+}++.navigation ul li.active:before {+ background-color: currentColor;+}++.navigation ul.active li:first-child a,+.navigation ul.active li:first-child a:hover {+ opacity: 1;+ color: currentColor;+}++/* Code */++.code-examples {+ width: 50%;+ -webkit-box-orient: vertical;+ -webkit-box-direction: normal;+ -ms-flex-direction: column;+ flex-direction: column;+ border-left: 1px solid #000;+}++.code-pane {+ position: relative;+ border-bottom: 1px solid #000;+}++.code-pane-js {+ height: 66%;+}++.code-pane-html {+ height: 34%;+}++.code-header {+ position: absolute;+ top: 0;+}++pre {+ overflow: auto;+ font-family: 'Space Mono', monospace;+ line-height: 22px;+}++.code-output {+ width: 100%;+ height: 100%;+ padding: 80px 20px 20px 20px;+}++/* Demos */++.demos {+ overflow-y: scroll;+ width: calc(50% - 240px);+ min-width: 330px;+}++article {+ width: 100%;+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-orient: vertical;+ -webkit-box-direction: normal;+ -ms-flex-direction: column;+ flex-direction: column;+ -ms-flex-wrap: wrap;+ flex-wrap: wrap;+ -webkit-box-align: start;+ -ms-flex-align: start;+ align-items: flex-start;+ -webkit-box-pack: start;+ -ms-flex-pack: start;+ justify-content: flex-start;+}++.demos-title {+ opacity: 1;+}++.demo {+ position: relative;+ z-index: 1;+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-align: center;+ -ms-flex-align: center;+ align-items: center;+ -webkit-box-pack: center;+ -ms-flex-pack: center;+ justify-content: center;+ width: 100%;+ min-height: 200px;+ padding-top: 35px;+ border-bottom: 1px solid #000;+ cursor: pointer;+}++.demo.controls {+ padding-top: 50px;+}++.demo.active.controls {+ cursor: default;+}++.demo:before {+ content: "";+ position: absolute;+ z-index: 0;+ top: 0;+ left: 0;+ opacity: 0;+ display: block;+ width: 100%;+ height: 100%;+ background-color: currentColor;+}++.demo.active:before {+ opacity: .05;+}++.demo-content {+ position: relative;+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-orient: vertical;+ -webkit-box-direction: normal;+ -ms-flex-direction: column;+ flex-direction: column;+ -webkit-box-pack: center;+ -ms-flex-pack: center;+ justify-content: center;+ text-align: center;+ width: 290px;+ height: 100%;+}++#penner .demo-content {+ padding: 25px 0;+}++#timeline .demo-content,+#motionpath .demo-content {+ padding: 40px 0;+}++.demo-title {+ position: absolute;+ top: 0;+ left: 20px;+ width: calc(100% - 40px);+ padding: 23px 0;+ font-size: 12px;+ letter-spacing: 2px;+ text-transform: uppercase;+ color: #FFF;+ opacity: .7;+}++.active .demo-title {+ color: currentColor;+ opacity: 1;+}++.line {+ width: 100%;+ padding: 1px 0px;+}++.player {+ opacity: .4;+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-align: center;+ -ms-flex-align: center;+ align-items: center;+ -webkit-box-pack: center;+ -ms-flex-pack: center;+ justify-content: center;+ padding-top: 20px;+ padding-bottom: 10px;+}++.player button {+ position: relative;+ display: block;+ margin: 0 0 0 -1px;+ padding: 5px 10px;+ font-size: 12px;+ text-transform: uppercase;+ border: 1px solid currentColor;+ background-color: transparent;+ color: currentColor;+}++.player button:focus {+ outline: none;+}++.active .player {+ opacity: 1;+}++.active .player button:hover:after {+ content: '';+ opacity: .3;+ position: absolute;+ left: 0;+ top: 0;+ display: block;+ width: 100%;+ height: 100%;+ background-color: currentColor;+}++.player button:first-child {+ margin-left: 0;+}++.player input {+ margin-left: 10px;+}++.text-output {+ padding-top: 10px;+ padding-bottom: 10px;+ font-size: 16px;+ color: currentColor;+ text-align: center;+ background-color: transparent;+ border: 1px solid currentColor;+}++.log {+ width: 100%;+ height: 22px;+ background: transparent;+ color: currentColor;+ border: none;+ font-size: 16px;+ text-align: center;+}++.logs {+ pointer-events: none;+ display: -webkit-box;+ display: -ms-flexbox;+ display: flex;+ -webkit-box-orient: vertical;+ -webkit-box-direction: normal;+ -ms-flex-direction: column;+ flex-direction: column;+ -webkit-box-align: center;+ -ms-flex-align: center;+ align-items: center;+ position: absolute;+ width: 100%;+ height: 100%;+}++.log:focus {+ outline: none;+}++input.progress {+ cursor: ew-resize;+}++.square,+.circle {+ pointer-events: none;+ position: relative;+ width: 28px;+ height: 28px;+ margin: 1px;+ background-color: currentColor;+ font-size: 12px;+}++.circle {+ border-radius: 50%;+}++.triangle {+ pointer-events: none;+ position: relative;+ width: 0;+ height: 0;+ border-style: solid;+ border-width: 0 14px 24px 14px;+ border-color: transparent transparent currentColor transparent;+}++.small {+ width: 18px;+ height: 18px;+}++.large {+ width: 48px;+ height: 48px;+}++.stretched {+ height: 2px;+}++.shadow {+ position: absolute;+ opacity: .2;+}++.motion-path {+ position: relative;+ width: 256px;+ margin: auto;+}++.follow-path {+ position: absolute;+ top: -9px;+ left: -9px;+}++.align-center {+ -webkit-box-align: center;+ -ms-flex-align: center;+ align-items: center;+}++/* Responsive */++.header {+ width: 100%;+}++.sidebar,+.code-examples {+ display: none;+}++.demos {+ top: 60px;+ width: 100%;+ min-width: auto;+ height: calc(100% - 60px);+ -webkit-overflow-scrolling: touch;+}++@media (min-width: 600px) {+ .header {+ width: 239px;+ }+ .sidebar {+ display: inherit;+ }+ .demos {+ top: 0;+ width: calc(100% - 240px);+ height: 100%;+ }+}++@media (min-width: 1100px) {+ .code-examples {+ display: inherit;+ }+ .demos {+ width: calc(50% - 240px);+ }+}diff --git a/documentation/assets/img/anime-js-v2-logo-white.png b/documentation/assets/img/anime-js-v2-logo-white.pngnew file mode 100644index 00000000..01901778Binary files /dev/null and b/documentation/assets/img/anime-js-v2-logo-white.png differdiff --git a/documentation/assets/img/apple-touch-icon.png b/documentation/assets/img/apple-touch-icon.pngnew file mode 100644index 00000000..ccbf06d3Binary files /dev/null and b/documentation/assets/img/apple-touch-icon.png differdiff --git a/documentation/assets/img/documentation/anim-parameters.gif b/documentation/assets/img/documentation/anim-parameters.gifnew file mode 100644index 00000000..67098e53Binary files /dev/null and b/documentation/assets/img/documentation/anim-parameters.gif differdiff --git a/documentation/assets/img/documentation/animejs-logo.gif b/documentation/assets/img/documentation/animejs-logo.gifnew file mode 100644index 00000000..796a40d7Binary files /dev/null and b/documentation/assets/img/documentation/animejs-logo.gif differdiff --git a/documentation/assets/img/documentation/callbacks-all.gif b/documentation/assets/img/documentation/callbacks-all.gifnew file mode 100644index 00000000..1e211a2fBinary files /dev/null and b/documentation/assets/img/documentation/callbacks-all.gif differdiff --git a/documentation/assets/img/documentation/callbacks-begin.gif b/documentation/assets/img/documentation/callbacks-begin.gifnew file mode 100644index 00000000..e2070ea0Binary files /dev/null and b/documentation/assets/img/documentation/callbacks-begin.gif differdiff --git a/documentation/assets/img/documentation/callbacks-complete.gif b/documentation/assets/img/documentation/callbacks-complete.gifnew file mode 100644index 00000000..eb8f1363Binary files /dev/null and b/documentation/assets/img/documentation/callbacks-complete.gif differdiff --git a/documentation/assets/img/documentation/callbacks-update.gif b/documentation/assets/img/documentation/callbacks-update.gifnew file mode 100644index 00000000..8d57ee7eBinary files /dev/null and b/documentation/assets/img/documentation/callbacks-update.gif differdiff --git a/documentation/assets/img/documentation/fb-parameters.gif b/documentation/assets/img/documentation/fb-parameters.gifnew file mode 100644index 00000000..f73ebfe5Binary files /dev/null and b/documentation/assets/img/documentation/fb-parameters.gif differdiff --git a/documentation/assets/img/documentation/keyframes-advanced.gif b/documentation/assets/img/documentation/keyframes-advanced.gifnew file mode 100644index 00000000..36e59ce8Binary files /dev/null and b/documentation/assets/img/documentation/keyframes-advanced.gif differdiff --git a/documentation/assets/img/documentation/keyframes-basic.gif b/documentation/assets/img/documentation/keyframes-basic.gifnew file mode 100644index 00000000..82192095Binary files /dev/null and b/documentation/assets/img/documentation/keyframes-basic.gif differdiff --git a/documentation/assets/img/documentation/playback-play-pause.gif b/documentation/assets/img/documentation/playback-play-pause.gifnew file mode 100644index 00000000..20b907d4Binary files /dev/null and b/documentation/assets/img/documentation/playback-play-pause.gif differdiff --git a/documentation/assets/img/documentation/playback-restart.gif b/documentation/assets/img/documentation/playback-restart.gifnew file mode 100644index 00000000..047b5282Binary files /dev/null and b/documentation/assets/img/documentation/playback-restart.gif differdiff --git a/documentation/assets/img/documentation/playback-seek.gif b/documentation/assets/img/documentation/playback-seek.gifnew file mode 100644index 00000000..e131652cBinary files /dev/null and b/documentation/assets/img/documentation/playback-seek.gif differdiff --git a/documentation/assets/img/documentation/playback-timeline.gif b/documentation/assets/img/documentation/playback-timeline.gifnew file mode 100644index 00000000..7ad66f42Binary files /dev/null and b/documentation/assets/img/documentation/playback-timeline.gif differdiff --git a/documentation/assets/img/documentation/prop-css.gif b/documentation/assets/img/documentation/prop-css.gifnew file mode 100644index 00000000..024127e0Binary files /dev/null and b/documentation/assets/img/documentation/prop-css.gif differdiff --git a/documentation/assets/img/documentation/prop-dom-attr.gif b/documentation/assets/img/documentation/prop-dom-attr.gifnew file mode 100644index 00000000..2987333aBinary files /dev/null and b/documentation/assets/img/documentation/prop-dom-attr.gif differdiff --git a/documentation/assets/img/documentation/prop-js-obj.gif b/documentation/assets/img/documentation/prop-js-obj.gifnew file mode 100644index 00000000..07a9658fBinary files /dev/null and b/documentation/assets/img/documentation/prop-js-obj.gif differdiff --git a/documentation/assets/img/documentation/prop-parameters.gif b/documentation/assets/img/documentation/prop-parameters.gifnew file mode 100644index 00000000..e9d11a75Binary files /dev/null and b/documentation/assets/img/documentation/prop-parameters.gif differdiff --git a/documentation/assets/img/documentation/prop-svg-attr.gif b/documentation/assets/img/documentation/prop-svg-attr.gifnew file mode 100644index 00000000..8e5ab20dBinary files /dev/null and b/documentation/assets/img/documentation/prop-svg-attr.gif differdiff --git a/documentation/assets/img/documentation/prop-transforms.gif b/documentation/assets/img/documentation/prop-transforms.gifnew file mode 100644index 00000000..c873dc2dBinary files /dev/null and b/documentation/assets/img/documentation/prop-transforms.gif differdiff --git a/documentation/assets/img/documentation/svg-line-drawing.gif b/documentation/assets/img/documentation/svg-line-drawing.gifnew file mode 100644index 00000000..91ac7cb7Binary files /dev/null and b/documentation/assets/img/documentation/svg-line-drawing.gif differdiff --git a/documentation/assets/img/documentation/svg-morphing.gif b/documentation/assets/img/documentation/svg-morphing.gifnew file mode 100644index 00000000..c7913489Binary files /dev/null and b/documentation/assets/img/documentation/svg-morphing.gif differdiff --git a/documentation/assets/img/documentation/svg-motion-path.gif b/documentation/assets/img/documentation/svg-motion-path.gifnew file mode 100644index 00000000..6d91de8cBinary files /dev/null and b/documentation/assets/img/documentation/svg-motion-path.gif differdiff --git a/documentation/assets/img/documentation/timeline.gif b/documentation/assets/img/documentation/timeline.gifnew file mode 100644index 00000000..db32d799Binary files /dev/null and b/documentation/assets/img/documentation/timeline.gif differdiff --git a/documentation/assets/img/documentation/value-fb.gif b/documentation/assets/img/documentation/value-fb.gifnew file mode 100644index 00000000..bba275d0Binary files /dev/null and b/documentation/assets/img/documentation/value-fb.gif differdiff --git a/documentation/assets/img/documentation/value-from-to.gif b/documentation/assets/img/documentation/value-from-to.gifnew file mode 100644index 00000000..867b50e2Binary files /dev/null and b/documentation/assets/img/documentation/value-from-to.gif differdiff --git a/examples/assets/img/favicon.png b/documentation/assets/img/favicon.pngsimilarity index 100%rename from examples/assets/img/favicon.pngrename to documentation/assets/img/favicon.pngdiff --git a/documentation/assets/img/og-image.png b/documentation/assets/img/og-image.pngnew file mode 100644index 00000000..625a596cBinary files /dev/null and b/documentation/assets/img/og-image.png differdiff --git a/documentation/assets/js/beautify-html.js b/documentation/assets/js/beautify-html.jsnew file mode 100644index 00000000..c814ccc5--- /dev/null+++ b/documentation/assets/js/beautify-html.js@@ -0,0 +1,1125 @@+/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */+/*++ The MIT License (MIT)++ Copyright (c) 2007-2017 Einar Lielmanis, Liam Newman, and contributors.++ Permission is hereby granted, free of charge, to any person+ obtaining a copy of this software and associated documentation files+ (the "Software"), to deal in the Software without restriction,+ including without limitation the rights to use, copy, modify, merge,+ publish, distribute, sublicense, and/or sell copies of the Software,+ and to permit persons to whom the Software is furnished to do so,+ subject to the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.+++ Style HTML+---------------++ Written by Nochum Sossonko, ([email protected])++ Based on code initially developed by: Einar Lielmanis, <[email protected]>+ http://jsbeautifier.org/++ Usage:+ style_html(html_source);++ style_html(html_source, options);++ The options are:+ indent_inner_html (default false) — indent <head> and <body> sections,+ indent_size (default 4) — indentation size,+ indent_char (default space) — character to indent with,+ wrap_line_length (default 250) - maximum amount of characters per line (0 = disable)+ brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none"+ put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.+ unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted+ content_unformatted (defaults to pre tag) - list of tags, that its content shouldn't be reformatted+ indent_scripts (default normal) - "keep"|"separate"|"normal"+ preserve_newlines (default true) - whether existing line breaks before elements should be preserved+ Only works before elements, not inside tags or for text.+ max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk+ indent_handlebars (default false) - format and indent {{#foo}} and {{/foo}}+ end_with_newline (false) - end with a newline+ extra_liners (default [head,body,/html]) -List of tags that should have an extra newline before them.++ e.g.++ style_html(html_source, {+ 'indent_inner_html': false,+ 'indent_size': 2,+ 'indent_char': ' ',+ 'wrap_line_length': 78,+ 'brace_style': 'expand',+ 'preserve_newlines': true,+ 'max_preserve_newlines': 5,+ 'indent_handlebars': false,+ 'extra_liners': ['/html']+ });+*/++(function() {++ // function trim(s) {+ // return s.replace(/^\s+|\s+$/g, '');+ // }++ function ltrim(s) {+ return s.replace(/^\s+/g, '');+ }++ function rtrim(s) {+ return s.replace(/\s+$/g, '');+ }++ function mergeOpts(allOptions, targetType) {+ var finalOpts = {};+ var name;++ for (name in allOptions) {+ if (name !== targetType) {+ finalOpts[name] = allOptions[name];+ }+ }++ //merge in the per type settings for the targetType+ if (targetType in allOptions) {+ for (name in allOptions[targetType]) {+ finalOpts[name] = allOptions[targetType][name];+ }+ }+ return finalOpts;+ }++ var lineBreak = /\r\n|[\n\r\u2028\u2029]/;+ var allLineBreaks = new RegExp(lineBreak.source, 'g');++ function style_html(html_source, options, js_beautify, css_beautify) {+ //Wrapper function to invoke all the necessary constructors and deal with the output.++ var multi_parser,+ indent_inner_html,+ indent_body_inner_html,+ indent_head_inner_html,+ indent_size,+ indent_character,+ wrap_line_length,+ brace_style,+ unformatted,+ content_unformatted,+ preserve_newlines,+ max_preserve_newlines,+ indent_handlebars,+ wrap_attributes,+ wrap_attributes_indent_size,+ is_wrap_attributes_force,+ is_wrap_attributes_force_expand_multiline,+ is_wrap_attributes_force_aligned,+ end_with_newline,+ extra_liners,+ eol;++ options = options || {};++ // Allow the setting of language/file-type specific options+ // with inheritance of overall settings+ options = mergeOpts(options, 'html');++ // backwards compatibility to 1.3.4+ if ((options.wrap_line_length === undefined || parseInt(options.wrap_line_length, 10) === 0) &&+ (options.max_char !== undefined && parseInt(options.max_char, 10) !== 0)) {+ options.wrap_line_length = options.max_char;+ }++ indent_inner_html = (options.indent_inner_html === undefined) ? false : options.indent_inner_html;+ indent_body_inner_html = (options.indent_body_inner_html === undefined) ? true : options.indent_body_inner_html;+ indent_head_inner_html = (options.indent_head_inner_html === undefined) ? true : options.indent_head_inner_html;+ indent_size = (options.indent_size === undefined) ? 4 : parseInt(options.indent_size, 10);+ indent_character = (options.indent_char === undefined) ? ' ' : options.indent_char;+ brace_style = (options.brace_style === undefined) ? 'collapse' : options.brace_style;+ wrap_line_length = parseInt(options.wrap_line_length, 10) === 0 ? 32786 : parseInt(options.wrap_line_length || 250, 10);+ unformatted = options.unformatted || [+ // https://www.w3.org/TR/html5/dom.html#phrasing-content+ 'a', 'abbr', 'area', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas', 'cite',+ 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img',+ 'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', 'math', 'meter', 'noscript',+ 'object', 'output', 'progress', 'q', 'ruby', 's', 'samp', /* 'script', */ 'select', 'small',+ 'span', 'strong', 'sub', 'sup', 'svg', 'template', 'textarea', 'time', 'u', 'var',+ 'video', 'wbr', 'text',+ // prexisting - not sure of full effect of removing, leaving in+ 'acronym', 'address', 'big', 'dt', 'ins', 'strike', 'tt',+ ];+ content_unformatted = options.content_unformatted || [+ 'pre',+ ];+ preserve_newlines = (options.preserve_newlines === undefined) ? true : options.preserve_newlines;+ max_preserve_newlines = preserve_newlines ?+ (isNaN(parseInt(options.max_preserve_newlines, 10)) ? 32786 : parseInt(options.max_preserve_newlines, 10)) :+ 0;+ indent_handlebars = (options.indent_handlebars === undefined) ? false : options.indent_handlebars;+ wrap_attributes = (options.wrap_attributes === undefined) ? 'auto' : options.wrap_attributes;+ wrap_attributes_indent_size = (isNaN(parseInt(options.wrap_attributes_indent_size, 10))) ? indent_size : parseInt(options.wrap_attributes_indent_size, 10);+ is_wrap_attributes_force = wrap_attributes.substr(0, 'force'.length) === 'force';+ is_wrap_attributes_force_expand_multiline = (wrap_attributes === 'force-expand-multiline');+ is_wrap_attributes_force_aligned = (wrap_attributes === 'force-aligned');+ end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;+ extra_liners = (typeof options.extra_liners === 'object') && options.extra_liners ?+ options.extra_liners.concat() : (typeof options.extra_liners === 'string') ?+ options.extra_liners.split(',') : 'head,body,/html'.split(',');+ eol = options.eol ? options.eol : 'auto';++ if (options.indent_with_tabs) {+ indent_character = '\t';+ indent_size = 1;+ }++ if (eol === 'auto') {+ eol = '\n';+ if (html_source && lineBreak.test(html_source || '')) {+ eol = html_source.match(lineBreak)[0];+ }+ }++ eol = eol.replace(/\\r/, '\r').replace(/\\n/, '\n');++ // HACK: newline parsing inconsistent. This brute force normalizes the input.+ html_source = html_source.replace(allLineBreaks, '\n');++ function Parser() {++ this.pos = 0; //Parser position+ this.token = '';+ this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT+ this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values+ parent: 'parent1',+ parentcount: 1,+ parent1: ''+ };+ this.tag_type = '';+ this.token_text = this.last_token = this.last_text = this.token_type = '';+ this.newlines = 0;+ this.indent_content = indent_inner_html;+ this.indent_body_inner_html = indent_body_inner_html;+ this.indent_head_inner_html = indent_head_inner_html;++ this.Utils = { //Uilities made available to the various functions+ whitespace: "\n\r\t ".split(''),++ single_token: [+ // HTLM void elements - aka self-closing tags - aka singletons+ // https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements+ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',+ 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr',+ // NOTE: Optional tags - are not understood.+ // https://www.w3.org/TR/html5/syntax.html#optional-tags+ // The rules for optional tags are too complex for a simple list+ // Also, the content of these tags should still be indented in many cases.+ // 'li' is a good exmple.++ // Doctype and xml elements+ '!doctype', '?xml',+ // ?php tag+ '?php',+ // other tags that were in this list, keeping just in case+ 'basefont', 'isindex'+ ],+ extra_liners: extra_liners, //for tags that need a line of whitespace before them+ in_array: function(what, arr) {+ for (var i = 0; i < arr.length; i++) {+ if (what === arr[i]) {+ return true;+ }+ }+ return false;+ }+ };++ // Return true if the given text is composed entirely of whitespace.+ this.is_whitespace = function(text) {+ for (var n = 0; n < text.length; n++) {+ if (!this.Utils.in_array(text.charAt(n), this.Utils.whitespace)) {+ return false;+ }+ }+ return true;+ };++ this.traverse_whitespace = function() {+ var input_char = '';++ input_char = this.input.charAt(this.pos);+ if (this.Utils.in_array(input_char, this.Utils.whitespace)) {+ this.newlines = 0;+ while (this.Utils.in_array(input_char, this.Utils.whitespace)) {+ if (preserve_newlines && input_char === '\n' && this.newlines <= max_preserve_newlines) {+ this.newlines += 1;+ }++ this.pos++;+ input_char = this.input.charAt(this.pos);+ }+ return true;+ }+ return false;+ };++ // Append a space to the given content (string array) or, if we are+ // at the wrap_line_length, append a newline/indentation.+ // return true if a newline was added, false if a space was added+ this.space_or_wrap = function(content) {+ if (this.line_char_count >= this.wrap_line_length) { //insert a line when the wrap_line_length is reached+ this.print_newline(false, content);+ this.print_indentation(content);+ return true;+ } else {+ this.line_char_count++;+ content.push(' ');+ return false;+ }+ };++ this.get_content = function() { //function to capture regular content between tags+ var input_char = '',+ content = [],+ handlebarsStarted = 0;++ while (this.input.charAt(this.pos) !== '<' || handlebarsStarted === 2) {+ if (this.pos >= this.input.length) {+ return content.length ? content.join('') : ['', 'TK_EOF'];+ }++ if (this.traverse_whitespace()) {+ this.space_or_wrap(content);+ continue;+ }++ input_char = this.input.charAt(this.pos);++ if (indent_handlebars) {+ if (input_char === '{') {+ handlebarsStarted += 1;+ } else if (handlebarsStarted < 2) {+ handlebarsStarted = 0;+ }++ if (input_char === '}' && handlebarsStarted > 0) {+ if (handlebarsStarted-- === 0) {+ break;+ }+ }+ // Handlebars parsing is complicated.+ // {{#foo}} and {{/foo}} are formatted tags.+ // {{something}} should get treated as content, except:+ // {{else}} specifically behaves like {{#if}} and {{/if}}+ var peek3 = this.input.substr(this.pos, 3);+ if (peek3 === '{{#' || peek3 === '{{/') {+ // These are tags and not content.+ break;+ } else if (peek3 === '{{!') {+ return [this.get_tag(), 'TK_TAG_HANDLEBARS_COMMENT'];+ } else if (this.input.substr(this.pos, 2) === '{{') {+ if (this.get_tag(true) === '{{else}}') {+ break;+ }+ }+ }++ this.pos++;+ this.line_char_count++;+ content.push(input_char); //letter at-a-time (or string) inserted to an array+ }+ return content.length ? content.join('') : '';+ };++ this.get_contents_to = function(name) { //get the full content of a script or style to pass to js_beautify+ if (this.pos === this.input.length) {+ return ['', 'TK_EOF'];+ }+ var content = '';+ var reg_match = new RegExp('</' + name + '\\s*>', 'igm');+ reg_match.lastIndex = this.pos;+ var reg_array = reg_match.exec(this.input);+ var end_script = reg_array ? reg_array.index : this.input.length; //absolute end of script+ if (this.pos < end_script) { //get everything in between the script tags+ content = this.input.substring(this.pos, end_script);+ this.pos = end_script;+ }+ return content;+ };++ this.record_tag = function(tag) { //function to record a tag and its parent in this.tags Object+ if (this.tags[tag + 'count']) { //check for the existence of this tag type+ this.tags[tag + 'count']++;+ this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level+ } else { //otherwise initialize this tag type+ this.tags[tag + 'count'] = 1;+ this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level+ }+ this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)+ this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')+ };++ this.retrieve_tag = function(tag) { //function to retrieve the opening tag to the corresponding closer+ if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it+ var temp_parent = this.tags.parent; //check to see if it's a closable tag.+ while (temp_parent) { //till we reach '' (the initial value);+ if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it+ break;+ }+ temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree+ }+ if (temp_parent) { //if we caught something+ this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly+ this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent+ }+ delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...+ delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself+ if (this.tags[tag + 'count'] === 1) {+ delete this.tags[tag + 'count'];+ } else {+ this.tags[tag + 'count']--;+ }+ }+ };++ this.indent_to_tag = function(tag) {+ // Match the indentation level to the last use of this tag, but don't remove it.+ if (!this.tags[tag + 'count']) {+ return;+ }+ var temp_parent = this.tags.parent;+ while (temp_parent) {+ if (tag + this.tags[tag + 'count'] === temp_parent) {+ break;+ }+ temp_parent = this.tags[temp_parent + 'parent'];+ }+ if (temp_parent) {+ this.indent_level = this.tags[tag + this.tags[tag + 'count']];+ }+ };++ this.get_tag = function(peek) { //function to get a full tag and parse its type+ var input_char = '',+ content = [],+ comment = '',+ space = false,+ first_attr = true,+ has_wrapped_attrs = false,+ tag_start, tag_end,+ tag_start_char,+ orig_pos = this.pos,+ orig_line_char_count = this.line_char_count,+ is_tag_closed = false,+ tail;++ peek = peek !== undefined ? peek : false;++ do {+ if (this.pos >= this.input.length) {+ if (peek) {+ this.pos = orig_pos;+ this.line_char_count = orig_line_char_count;+ }+ return content.length ? content.join('') : ['', 'TK_EOF'];+ }++ input_char = this.input.charAt(this.pos);+ this.pos++;++ if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space+ space = true;+ continue;+ }++ if (input_char === "'" || input_char === '"') {+ input_char += this.get_unformatted(input_char);+ space = true;+ }++ if (input_char === '=') { //no space before =+ space = false;+ }+ tail = this.input.substr(this.pos - 1);+ if (is_wrap_attributes_force_expand_multiline && has_wrapped_attrs && !is_tag_closed && (input_char === '>' || input_char === '/')) {+ if (tail.match(/^\/?\s*>/)) {+ space = false;+ is_tag_closed = true;+ this.print_newline(false, content);+ this.print_indentation(content);+ }+ }+ if (content.length && content[content.length - 1] !== '=' && input_char !== '>' && space) {+ //no space after = or before >+ var wrapped = this.space_or_wrap(content);+ var indentAttrs = wrapped && input_char !== '/' && !is_wrap_attributes_force;+ space = false;++ if (is_wrap_attributes_force && input_char !== '/') {+ var force_first_attr_wrap = false;+ if (is_wrap_attributes_force_expand_multiline && first_attr) {+ var is_only_attribute = tail.match(/^\S*(="([^"]|\\")*")?\s*\/?\s*>/) !== null;+ force_first_attr_wrap = !is_only_attribute;+ }+ if (!first_attr || force_first_attr_wrap) {+ this.print_newline(false, content);+ this.print_indentation(content);+ indentAttrs = true;+ }+ }+ if (indentAttrs) {+ has_wrapped_attrs = true;++ //indent attributes an auto, forced, or forced-align line-wrap+ var alignment_size = wrap_attributes_indent_size;+ if (is_wrap_attributes_force_aligned) {+ alignment_size = content.indexOf(' ') + 1;+ }++ for (var count = 0; count < alignment_size; count++) {+ content.push(indent_character);+ }+ }+ if (first_attr) {+ for (var i = 0; i < content.length; i++) {+ if (content[i] === ' ') {+ first_attr = false;+ break;+ }+ }+ }+ }++ if (indent_handlebars && tag_start_char === '<') {+ // When inside an angle-bracket tag, put spaces around+ // handlebars not inside of strings.+ if ((input_char + this.input.charAt(this.pos)) === '{{') {+ input_char += this.get_unformatted('}}');+ if (content.length && content[content.length - 1] !== ' ' && content[content.length - 1] !== '<') {+ input_char = ' ' + input_char;+ }+ space = true;+ }+ }++ if (input_char === '<' && !tag_start_char) {+ tag_start = this.pos - 1;+ tag_start_char = '<';+ }++ if (indent_handlebars && !tag_start_char) {+ if (content.length >= 2 && content[content.length - 1] === '{' && content[content.length - 2] === '{') {+ if (input_char === '#' || input_char === '/' || input_char === '!') {+ tag_start = this.pos - 3;+ } else {+ tag_start = this.pos - 2;+ }+ tag_start_char = '{';+ }+ }++ this.line_char_count++;+ content.push(input_char); //inserts character at-a-time (or string)++ if (content[1] && (content[1] === '!' || content[1] === '?' || content[1] === '%')) { //if we're in a comment, do something special+ // We treat all comments as literals, even more than preformatted tags+ // we just look for the appropriate close tag+ content = [this.get_comment(tag_start)];+ break;+ }++ if (indent_handlebars && content[1] && content[1] === '{' && content[2] && content[2] === '!') { //if we're in a comment, do something special+ // We treat all comments as literals, even more than preformatted tags+ // we just look for the appropriate close tag+ content = [this.get_comment(tag_start)];+ break;+ }++ if (indent_handlebars && tag_start_char === '{' && content.length > 2 && content[content.length - 2] === '}' && content[content.length - 1] === '}') {+ break;+ }+ } while (input_char !== '>');++ var tag_complete = content.join('');+ var tag_index;+ var tag_offset;++ if (tag_complete.indexOf('\n') !== -1) { //if there's a line break, thats where the tag name ends+ tag_index = tag_complete.indexOf('\n');+ } else if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends+ tag_index = tag_complete.indexOf(' ');+ } else if (tag_complete.charAt(0) === '{') {+ tag_index = tag_complete.indexOf('}');+ } else { //otherwise go with the tag ending+ tag_index = tag_complete.indexOf('>');+ }+ if (tag_complete.charAt(0) === '<' || !indent_handlebars) {+ tag_offset = 1;+ } else {+ tag_offset = tag_complete.charAt(2) === '#' ? 3 : 2;+ }+ var tag_check = tag_complete.substring(tag_offset, tag_index).toLowerCase();+ if (tag_complete.charAt(tag_complete.length - 2) === '/' ||+ this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)+ if (!peek) {+ this.tag_type = 'SINGLE';+ }+ } else if (indent_handlebars && tag_complete.charAt(0) === '{' && tag_check === 'else') {+ if (!peek) {+ this.indent_to_tag('if');+ this.tag_type = 'HANDLEBARS_ELSE';+ this.indent_content = true;+ this.traverse_whitespace();+ }+ } else if (this.is_unformatted(tag_check, unformatted) ||+ this.is_unformatted(tag_check, content_unformatted)) {+ // do not reformat the "unformatted" or "content_unformatted" tags+ comment = this.get_unformatted('</' + tag_check + '>', tag_complete); //...delegate to get_unformatted function+ content.push(comment);+ tag_end = this.pos - 1;+ this.tag_type = 'SINGLE';+ } else if (tag_check === 'script' &&+ (tag_complete.search('type') === -1 ||+ (tag_complete.search('type') > -1 &&+ tag_complete.search(/\b(text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect)/) > -1))) {+ if (!peek) {+ this.record_tag(tag_check);+ this.tag_type = 'SCRIPT';+ }+ } else if (tag_check === 'style' &&+ (tag_complete.search('type') === -1 ||+ (tag_complete.search('type') > -1 && tag_complete.search('text/css') > -1))) {+ if (!peek) {+ this.record_tag(tag_check);+ this.tag_type = 'STYLE';+ }+ } else if (tag_check.charAt(0) === '!') { //peek for <! comment+ // for comments content is already correct.+ if (!peek) {+ this.tag_type = 'SINGLE';+ this.traverse_whitespace();+ }+ } else if (!peek) {+ if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending+ this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors+ this.tag_type = 'END';+ } else { //otherwise it's a start-tag+ this.record_tag(tag_check); //push it on the tag stack+ if (tag_check.toLowerCase() !== 'html') {+ this.indent_content = true;+ }+ this.tag_type = 'START';+ }++ // Allow preserving of newlines after a start or end tag+ if (this.traverse_whitespace()) {+ this.space_or_wrap(content);+ }++ if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line+ this.print_newline(false, this.output);+ if (this.output.length && this.output[this.output.length - 2] !== '\n') {+ this.print_newline(true, this.output);+ }+ }+ }++ if (peek) {+ this.pos = orig_pos;+ this.line_char_count = orig_line_char_count;+ }++ return content.join(''); //returns fully formatted tag+ };++ this.get_comment = function(start_pos) { //function to return comment content in its entirety+ // this is will have very poor perf, but will work for now.+ var comment = '',+ delimiter = '>',+ matched = false;++ this.pos = start_pos;+ var input_char = this.input.charAt(this.pos);+ this.pos++;++ while (this.pos <= this.input.length) {+ comment += input_char;++ // only need to check for the delimiter if the last chars match+ if (comment.charAt(comment.length - 1) === delimiter.charAt(delimiter.length - 1) &&+ comment.indexOf(delimiter) !== -1) {+ break;+ }++ // only need to search for custom delimiter for the first few characters+ if (!matched && comment.length < 10) {+ if (comment.indexOf('<![if') === 0) { //peek for <![if conditional comment+ delimiter = '<![endif]>';+ matched = true;+ } else if (comment.indexOf('<![cdata[') === 0) { //if it's a <[cdata[ comment...+ delimiter = ']]>';+ matched = true;+ } else if (comment.indexOf('<![') === 0) { // some other ![ comment? ...+ delimiter = ']>';+ matched = true;+ } else if (comment.indexOf('<!--') === 0) { // <!-- comment ...+ delimiter = '-->';+ matched = true;+ } else if (comment.indexOf('{{!--') === 0) { // {{!-- handlebars comment+ delimiter = '--}}';+ matched = true;+ } else if (comment.indexOf('{{!') === 0) { // {{! handlebars comment+ if (comment.length === 5 && comment.indexOf('{{!--') === -1) {+ delimiter = '}}';+ matched = true;+ }+ } else if (comment.indexOf('<?') === 0) { // {{! handlebars comment+ delimiter = '?>';+ matched = true;+ } else if (comment.indexOf('<%') === 0) { // {{! handlebars comment+ delimiter = '%>';+ matched = true;+ }+ }++ input_char = this.input.charAt(this.pos);+ this.pos++;+ }++ return comment;+ };++ function tokenMatcher(delimiter) {+ var token = '';++ var add = function(str) {+ var newToken = token + str.toLowerCase();+ token = newToken.length <= delimiter.length ? newToken : newToken.substr(newToken.length - delimiter.length, delimiter.length);+ };++ var doesNotMatch = function() {+ return token.indexOf(delimiter) === -1;+ };++ return {+ add: add,+ doesNotMatch: doesNotMatch+ };+ }++ this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety+ if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {+ return '';+ }+ var input_char = '';+ var content = '';+ var space = true;++ var delimiterMatcher = tokenMatcher(delimiter);++ do {++ if (this.pos >= this.input.length) {+ return content;+ }++ input_char = this.input.charAt(this.pos);+ this.pos++;++ if (this.Utils.in_array(input_char, this.Utils.whitespace)) {+ if (!space) {+ this.line_char_count--;+ continue;+ }+ if (input_char === '\n' || input_char === '\r') {+ content += '\n';+ /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'+ for (var i=0; i<this.indent_level; i++) {+ content += this.indent_string;+ }+ space = false; //...and make sure other indentation is erased+ */+ this.line_char_count = 0;+ continue;+ }+ }+ content += input_char;+ delimiterMatcher.add(input_char);+ this.line_char_count++;+ space = true;++ if (indent_handlebars && input_char === '{' && content.length && content.charAt(content.length - 2) === '{') {+ // Handlebars expressions in strings should also be unformatted.+ content += this.get_unformatted('}}');+ // Don't consider when stopping for delimiters.+ }+ } while (delimiterMatcher.doesNotMatch());++ return content;+ };++ this.get_token = function() { //initial handler for token-retrieval+ var token;++ if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript+ var type = this.last_token.substr(7);+ token = this.get_contents_to(type);+ if (typeof token !== 'string') {+ return token;+ }+ return [token, 'TK_' + type];+ }+ if (this.current_mode === 'CONTENT') {+ token = this.get_content();+ if (typeof token !== 'string') {+ return token;+ } else {+ return [token, 'TK_CONTENT'];+ }+ }++ if (this.current_mode === 'TAG') {+ token = this.get_tag();+ if (typeof token !== 'string') {+ return token;+ } else {+ var tag_name_type = 'TK_TAG_' + this.tag_type;+ return [token, tag_name_type];+ }+ }+ };++ this.get_full_indent = function(level) {+ level = this.indent_level + level || 0;+ if (level < 1) {+ return '';+ }++ return Array(level + 1).join(this.indent_string);+ };++ this.is_unformatted = function(tag_check, unformatted) {+ //is this an HTML5 block-level link?+ if (!this.Utils.in_array(tag_check, unformatted)) {+ return false;+ }++ if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)) {+ return true;+ }++ //at this point we have an tag; is its first child something we want to remain+ //unformatted?+ var next_tag = this.get_tag(true /* peek. */ );++ // test next_tag to see if it is just html tag (no external content)+ var tag = (next_tag || "").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);++ // if next_tag comes back but is not an isolated tag, then+ // let's treat the 'a' tag as having content+ // and respect the unformatted option+ if (!tag || this.Utils.in_array(tag, unformatted)) {+ return true;+ } else {+ return false;+ }+ };++ this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions++ this.input = js_source || ''; //gets the input for the Parser++ // HACK: newline parsing inconsistent. This brute force normalizes the input.+ this.input = this.input.replace(/\r\n|[\r\u2028\u2029]/g, '\n');++ this.output = [];+ this.indent_character = indent_character;+ this.indent_string = '';+ this.indent_size = indent_size;+ this.brace_style = brace_style;+ this.indent_level = 0;+ this.wrap_line_length = wrap_line_length;+ this.line_char_count = 0; //count to see if wrap_line_length was exceeded++ for (var i = 0; i < this.indent_size; i++) {+ this.indent_string += this.indent_character;+ }++ this.print_newline = function(force, arr) {+ this.line_char_count = 0;+ if (!arr || !arr.length) {+ return;+ }+ if (force || (arr[arr.length - 1] !== '\n')) { //we might want the extra line+ if ((arr[arr.length - 1] !== '\n')) {+ arr[arr.length - 1] = rtrim(arr[arr.length - 1]);+ }+ arr.push('\n');+ }+ };++ this.print_indentation = function(arr) {+ for (var i = 0; i < this.indent_level; i++) {+ arr.push(this.indent_string);+ this.line_char_count += this.indent_string.length;+ }+ };++ this.print_token = function(text) {+ // Avoid printing initial whitespace.+ if (this.is_whitespace(text) && !this.output.length) {+ return;+ }+ if (text || text !== '') {+ if (this.output.length && this.output[this.output.length - 1] === '\n') {+ this.print_indentation(this.output);+ text = ltrim(text);+ }+ }+ this.print_token_raw(text);+ };++ this.print_token_raw = function(text) {+ // If we are going to print newlines, truncate trailing+ // whitespace, as the newlines will represent the space.+ if (this.newlines > 0) {+ text = rtrim(text);+ }++ if (text && text !== '') {+ if (text.length > 1 && text.charAt(text.length - 1) === '\n') {+ // unformatted tags can grab newlines as their last character+ this.output.push(text.slice(0, -1));+ this.print_newline(false, this.output);+ } else {+ this.output.push(text);+ }+ }++ for (var n = 0; n < this.newlines; n++) {+ this.print_newline(n > 0, this.output);+ }+ this.newlines = 0;+ };++ this.indent = function() {+ this.indent_level++;+ };++ this.unindent = function() {+ if (this.indent_level > 0) {+ this.indent_level--;+ }+ };+ };+ return this;+ }++ /*_____________________--------------------_____________________*/++ multi_parser = new Parser(); //wrapping functions Parser+ multi_parser.printer(html_source, indent_character, indent_size, wrap_line_length, brace_style); //initialize starting values++ while (true) {+ var t = multi_parser.get_token();+ multi_parser.token_text = t[0];+ multi_parser.token_type = t[1];++ if (multi_parser.token_type === 'TK_EOF') {+ break;+ }++ switch (multi_parser.token_type) {+ case 'TK_TAG_START':+ multi_parser.print_newline(false, multi_parser.output);+ multi_parser.print_token(multi_parser.token_text);+ if (multi_parser.indent_content) {+ if ((multi_parser.indent_body_inner_html || !multi_parser.token_text.match(/<body(?:.*)>/)) &&+ (multi_parser.indent_head_inner_html || !multi_parser.token_text.match(/<head(?:.*)>/))) {++ multi_parser.indent();+ }++ multi_parser.indent_content = false;+ }+ multi_parser.current_mode = 'CONTENT';+ break;+ case 'TK_TAG_STYLE':+ case 'TK_TAG_SCRIPT':+ multi_parser.print_newline(false, multi_parser.output);+ multi_parser.print_token(multi_parser.token_text);+ multi_parser.current_mode = 'CONTENT';+ break;+ case 'TK_TAG_END':+ //Print new line only if the tag has no content and has child+ if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {+ var tag_name = (multi_parser.token_text.match(/\w+/) || [])[0];+ var tag_extracted_from_last_output = null;+ if (multi_parser.output.length) {+ tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length - 1].match(/(?:<|{{#)\s*(\w+)/);+ }+ if (tag_extracted_from_last_output === null ||+ (tag_extracted_from_last_output[1] !== tag_name && !multi_parser.Utils.in_array(tag_extracted_from_last_output[1], unformatted))) {+ multi_parser.print_newline(false, multi_parser.output);+ }+ }+ multi_parser.print_token(multi_parser.token_text);+ multi_parser.current_mode = 'CONTENT';+ break;+ case 'TK_TAG_SINGLE':+ // Don't add a newline before elements that should remain unformatted.+ var tag_check = multi_parser.token_text.match(/^\s*<([a-z-]+)/i);+ if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)) {+ multi_parser.print_newline(false, multi_parser.output);+ }+ multi_parser.print_token(multi_parser.token_text);+ multi_parser.current_mode = 'CONTENT';+ break;+ case 'TK_TAG_HANDLEBARS_ELSE':+ // Don't add a newline if opening {{#if}} tag is on the current line+ var foundIfOnCurrentLine = false;+ for (var lastCheckedOutput = multi_parser.output.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) {+ if (multi_parser.output[lastCheckedOutput] === '\n') {+ break;+ } else {+ if (multi_parser.output[lastCheckedOutput].match(/{{#if/)) {+ foundIfOnCurrentLine = true;+ break;+ }+ }+ }+ if (!foundIfOnCurrentLine) {+ multi_parser.print_newline(false, multi_parser.output);+ }+ multi_parser.print_token(multi_parser.token_text);+ if (multi_parser.indent_content) {+ multi_parser.indent();+ multi_parser.indent_content = false;+ }+ multi_parser.current_mode = 'CONTENT';+ break;+ case 'TK_TAG_HANDLEBARS_COMMENT':+ multi_parser.print_token(multi_parser.token_text);+ multi_parser.current_mode = 'TAG';+ break;+ case 'TK_CONTENT':+ multi_parser.print_token(multi_parser.token_text);+ multi_parser.current_mode = 'TAG';+ break;+ case 'TK_STYLE':+ case 'TK_SCRIPT':+ if (multi_parser.token_text !== '') {+ multi_parser.print_newline(false, multi_parser.output);+ var text = multi_parser.token_text,+ _beautifier,+ script_indent_level = 1;+ if (multi_parser.token_type === 'TK_SCRIPT') {+ _beautifier = typeof js_beautify === 'function' && js_beautify;+ } else if (multi_parser.token_type === 'TK_STYLE') {+ _beautifier = typeof css_beautify === 'function' && css_beautify;+ }++ if (options.indent_scripts === "keep") {+ script_indent_level = 0;+ } else if (options.indent_scripts === "separate") {+ script_indent_level = -multi_parser.indent_level;+ }++ var indentation = multi_parser.get_full_indent(script_indent_level);+ if (_beautifier) {++ // call the Beautifier if avaliable+ var Child_options = function() {+ this.eol = '\n';+ };+ Child_options.prototype = options;+ var child_options = new Child_options();+ text = _beautifier(text.replace(/^\s*/, indentation), child_options);+ } else {+ // simply indent the string otherwise+ var white = text.match(/^\s*/)[0];+ var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;+ var reindent = multi_parser.get_full_indent(script_indent_level - _level);+ text = text.replace(/^\s*/, indentation)+ .replace(/\r\n|\r|\n/g, '\n' + reindent)+ .replace(/\s+$/, '');+ }+ if (text) {+ multi_parser.print_token_raw(text);+ multi_parser.print_newline(true, multi_parser.output);+ }+ }+ multi_parser.current_mode = 'TAG';+ break;+ default:+ // We should not be getting here but we don't want to drop input on the floor+ // Just output the text and move on+ if (multi_parser.token_text !== '') {+ multi_parser.print_token(multi_parser.token_text);+ }+ break;+ }+ multi_parser.last_token = multi_parser.token_type;+ multi_parser.last_text = multi_parser.token_text;+ }+ var sweet_code = multi_parser.output.join('').replace(/[\r\n\t ]+$/, '');++ // establish end_with_newline+ if (end_with_newline) {+ sweet_code += '\n';+ }++ if (eol !== '\n') {+ sweet_code = sweet_code.replace(/[\n]/g, eol);+ }++ return sweet_code;+ }++ if (typeof define === "function" && define.amd) {+ // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )+ define(["require", "./beautify", "./beautify-css"], function(requireamd) {+ var js_beautify = requireamd("./beautify");+ var css_beautify = requireamd("./beautify-css");++ return {+ html_beautify: function(html_source, options) {+ return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);+ }+ };+ });+ } else if (typeof exports !== "undefined") {+ // Add support for CommonJS. Just put this file somewhere on your require.paths+ // and you will be able to `var html_beautify = require("beautify").html_beautify`.+ var js_beautify = require('./beautify.js');+ var css_beautify = require('./beautify-css.js');++ exports.html_beautify = function(html_source, options) {+ return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);+ };+ } else if (typeof window !== "undefined") {+ // If we're running a web page and don't have either of the above, add our one global+ window.html_beautify = function(html_source, options) {+ return style_html(html_source, options, window.js_beautify, window.css_beautify);+ };+ } else if (typeof global !== "undefined") {+ // If we don't even have window, try global.+ global.html_beautify = function(html_source, options) {+ return style_html(html_source, options, global.js_beautify, global.css_beautify);+ };+ }++}());diff --git a/documentation/assets/js/highlight.pack.js b/documentation/assets/js/highlight.pack.jsnew file mode 100644index 00000000..11063f6f--- /dev/null+++ b/documentation/assets/js/highlight.pack.js@@ -0,0 +1,2 @@+/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */+!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function i(e){return k.test(e)}function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(a=o[n],i(a)||R(a))return a}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a=a.nextSibling)3===a.nodeType?i+=a.nodeValue.length:1===a.nodeType&&(n.push({event:"start",offset:i,node:a}),i=r(a,i),t(a).match(/br|hr|img|input/)||n.push({event:"stop",offset:i,node:a}));return i}(e,0),n}function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:"start"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}l+="<"+t(e)+w.map.call(e.attributes,r).join("")+">"}function u(e){l+="</"+t(e)+">"}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=a();if(l+=n(i.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=a();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(i.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(i,a){if(!i.compiled){if(i.compiled=!0,i.k=i.k||i.bK,i.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof i.k?c("keyword",i.k):E(i.k).forEach(function(e){c(e,i.k[e])}),i.k=u}i.lR=t(i.l||/\w+/,!0),a&&(i.bK&&(i.b="\\b("+i.bK.split(" ").join("|")+")\\b"),i.b||(i.b=/\B|\b/),i.bR=t(i.b),i.e||i.eW||(i.e=/\B|\b/),i.e&&(i.eR=t(i.e)),i.tE=n(i.e)||"",i.eW&&a.tE&&(i.tE+=(i.e?"|":"")+a.tE)),i.i&&(i.iR=t(i.i)),null==i.r&&(i.r=1),i.c||(i.c=[]);var s=[];i.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?i:e)}),i.c=s,i.c.forEach(function(e){r(e,i)}),i.starts&&r(i.starts,a);var l=i.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([i.tE,i.i]).map(n).filter(Boolean);i.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!i&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var i=r?"":y.classPrefix,a='<span class="'+i,o=t?"":C;return a+=e+'">',a+n+o}function p(){var e,t,r,i;if(!E.k)return n(B);for(i="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)i+=n(B.substring(t,r.index)),e=g(E,r),e?(M+=e[1],i+=h(e[0],n(r[0]))):i+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return i+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var i=E;i.skip?B+=n:(i.rE||i.eE||(B+=n),b(),i.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),i.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"<unnamed>")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=a||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substring(O,I.index),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>i.r&&(i=t),t.r>r.r&&(i=r,r=t)}),i.language&&(r.second_best=i),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"<br>":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(r)&&i.push(r),i.join(" ").trim()}function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="</span>",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var i=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return i.c.push(e.PWM),i.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),i},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/</,r:0,c:[{cN:"attr",b:e,r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("<!--","-->",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[t],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[t],starts:{e:"</script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});\ No newline at end of filediff --git a/documentation/assets/js/scripts.js b/documentation/assets/js/scripts.jsnew file mode 100644index 00000000..c53be7af--- /dev/null+++ b/documentation/assets/js/scripts.js@@ -0,0 +1,232 @@+var navigationEl = document.querySelector('.navigation');+var demosEl = document.querySelector('.demos');+var articleEls = document.querySelectorAll('article');+var jsOutputEl = document.querySelector('.js-output');+var htmlOutputEl = document.querySelector('.html-output');+var ulHeight = 20;+var demos = [];++function getScrollTop() {+ return document.body.scrollTop || document.documentElement.scrollTop;+}++function scrollTo(selector, offset, cb) {+ var offset = offset || 0;+ var el = document.querySelector(selector);+ var scrollAnim = anime({+ targets: {scroll: demosEl.scrollTop},+ scroll: el.offsetTop - offset,+ duration: 500,+ easing: 'easeInOutQuart',+ update: function(a) { demosEl.scrollTop = a.animations[0].currentValue; },+ complete: function() { if (cb) cb(); }+ });+}++function parseHTML(el, parentId) {+ var parentEl = document.createElement('div');+ var clone = el.cloneNode(true);+ var shadowEls = clone.querySelectorAll('.shadow');+ var els = clone.querySelectorAll('.el');+ for (var i = 0; i < shadowEls.length; i++ ) {+ var shadowEl = shadowEls[i];+ shadowEl.parentNode.removeChild(shadowEl);+ }+ for (var i = 0; i < els.length; i++ ) {+ els[i].removeAttribute('style');+ }+ parentEl.id = parentId;+ parentEl.innerHTML = clone.innerHTML;+ return html_beautify(parentEl.outerHTML, {+ preserve_newlines: false,+ indent_size: 2+ });+}++function outputCode(JScode, HTMLcode) {+ var js = document.createTextNode(JScode);+ var html = document.createTextNode(HTMLcode);+ jsOutputEl.innerHTML = '';+ htmlOutputEl.innerHTML = '';+ jsOutputEl.appendChild(js);+ htmlOutputEl.appendChild(html);+ hljs.highlightBlock(jsOutputEl);+ hljs.highlightBlock(htmlOutputEl);+}++function toggleSectionLink(ulEl) {+ var ulEls = document.querySelectorAll('.navigation ul');+ for (var i = 0; i < ulEls.length; i++) ulEls[i].classList.remove('active');+ ulEl.classList.add('active');+ anime.remove(ulEls);+ anime({+ targets: '.navigation ul:not(.active)',+ height: ulHeight + 10,+ duration: 400,+ easing: 'easeOutQuart'+ });+ anime({+ targets: ulEl,+ height: function(el) {+ return el.childNodes.length * ulHeight + 20;+ },+ duration: 600,+ delay: 400,+ easing: 'easeInOutQuart'+ });+}++function resetDemos() {+ demos.forEach(function(demo) {+ demo.anim.pause();+ demo.anim.seek(0);+ });+}++function createDemo(el) {+ var demo = {};+ var scriptEl = el.querySelector('script');+ var demoContentEl = el.querySelector('.demo-content');+ var title = el.querySelector('h3').innerHTML;+ var id = el.id;+ var demoAnim = window[id];+ var JScode = scriptEl ? scriptEl.innerHTML : '';+ var HTMLcode = demoContentEl ? parseHTML(demoContentEl, id) : '';+ function highlightDemo(e, push) {+ if (e) e.preventDefault();+ if (!el.classList.contains('active')) {+ resetDemos();+ var linkEls = document.querySelectorAll('.demo-link');+ for (var i = 0; i < demos.length; i++) {+ var d = demos[i];+ d.el.classList.remove('active');+ linkEls[i].parentNode.classList.remove('active');+ d.anim.pause();+ }+ outputCode(JScode, HTMLcode);+ var linkEl = document.querySelector('a[href="#'+id+'"]');+ var ulEl = linkEl.parentNode.parentNode;+ linkEl.parentNode.classList.add('active');+ el.classList.add('active');+ scrollTo('#'+id, 60, function() {+ toggleSectionLink(ulEl);+ if (!el.classList.contains('controls')) demoAnim.restart();+ });+ if (push) history.pushState(null, null, '#'+id);+ } else {+ if (!el.classList.contains('controls')) demoAnim.restart();+ }+ }+ function enterDemo() {+ if (!el.classList.contains('active')) {+ demoAnim.restart();+ }+ }+ function leaveDemo() {+ if (!el.classList.contains('active')) {+ demoAnim.pause();+ demoAnim.seek(0);+ }+ }+ el.addEventListener('click', function(e) {+ highlightDemo(e, true);+ });+ resetDemos();+ return {+ el: el,+ title: title,+ id: id,+ anim: demoAnim,+ highlight: highlightDemo+ }+}++function getDemoById(id) {+ return demos.filter(function(a) { return a.id === id})[0];+}++function createLinksSection(articleEl) {+ var articleId = articleEl.id;+ var articleTitle = articleEl.querySelector('h2').innerHTML;+ var colorClass = articleEl.classList[0];+ var ulEl = document.createElement('ul');+ var liEl = document.createElement('li');+ var sectionLinkEl = document.createElement('a');+ sectionLinkEl.setAttribute('href', '#'+articleId);+ sectionLinkEl.innerHTML = articleTitle;+ sectionLinkEl.addEventListener('click', function(e) {+ e.preventDefault();+ var firstDemoId = articleEl.querySelector('.demo').id;+ var firstDemo = getDemoById(firstDemoId);+ firstDemo.highlight(e, true);+ });+ liEl.appendChild(sectionLinkEl);+ ulEl.appendChild(liEl);+ ulEl.classList.add(colorClass);+ return ulEl;+}++function createDemoLink(demo) {+ var liEl = document.createElement('li');+ var demoLinkEl = document.createElement('a');+ demoLinkEl.setAttribute('href', '#'+demo.id);+ demoLinkEl.innerHTML = demo.title;+ demoLinkEl.classList.add('demo-link');+ demoLinkEl.addEventListener('click', function(e) {+ demo.highlight(e, true);+ });+ liEl.appendChild(demoLinkEl);+ return liEl;+}++var fragment = document.createDocumentFragment();++for (var i = 0; i < articleEls.length; i++) {+ var articleEl = articleEls[i];+ var linksSectionEl = createLinksSection(articleEl);+ var demoEls = articleEl.querySelectorAll('.demo');+ for (var d = 0; d < demoEls.length; d++) {+ var demo = createDemo(demoEls[d]);+ var demoLinkEl = createDemoLink(demo);+ linksSectionEl.appendChild(demoLinkEl);+ demos.push(demo);+ }+ fragment.appendChild(linksSectionEl);+}++navigationEl.appendChild(fragment);++function updateDemos(e) {+ var hash = window.location.hash;+ if (hash) {+ var id = hash.replace('#','');+ var demo = getDemoById(id);+ if (demo) demo.highlight();+ } else {+ demos[0].highlight();+ }+}++function keyboardNavigation(e) {+ var activeDemoEl = document.querySelector('.demo.active');+ switch (e.keyCode) {+ case 38:+ var prevEl = activeDemoEl.previousElementSibling;+ while (prevEl && !prevEl.classList.contains('demo') && prevEl.parentNode.previousElementSibling) {+ prevEl = prevEl.parentNode.previousElementSibling.lastElementChild;+ }+ if (prevEl && prevEl.classList.contains('demo')) getDemoById(prevEl.id).highlight(e, true);+ break;+ case 40:+ var nextEl = activeDemoEl.nextElementSibling;+ if (!nextEl && activeDemoEl.parentNode.nextElementSibling) {+ nextEl = activeDemoEl.parentNode.nextElementSibling.querySelector('.demo');+ }+ if (nextEl && nextEl.classList.contains('demo')) getDemoById(nextEl.id).highlight(e, true);+ break;+ }+}++window.onhashchange = updateDemos;+window.onload = updateDemos;+document.onkeydown = keyboardNavigation;diff --git a/examples/assets/js/stats.js b/documentation/assets/js/stats.jssimilarity index 100%rename from examples/assets/js/stats.jsrename to documentation/assets/js/stats.jsdiff --git a/documentation/assets/js/stats.min.js b/documentation/assets/js/stats.min.jsnew file mode 100644index 00000000..61757f3c--- /dev/null+++ b/documentation/assets/js/stats.min.js@@ -0,0 +1,5 @@+// stats.js - http://github.com/mrdoob/stats.js+(function(f,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"===typeof define&&define.amd?define(e):f.Stats=e()})(this,function(){var f=function(){function e(a){c.appendChild(a.dom);return a}function u(a){for(var d=0;d<c.children.length;d++)c.children[d].style.display=d===a?"block":"none";l=a}var l=0,c=document.createElement("div");c.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";c.addEventListener("click",function(a){a.preventDefault();+u(++l%c.children.length)},!1);var k=(performance||Date).now(),g=k,a=0,r=e(new f.Panel("FPS","#0ff","#002")),h=e(new f.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var t=e(new f.Panel("MB","#f08","#201"));u(0);return{REVISION:16,dom:c,addPanel:e,showPanel:u,begin:function(){k=(performance||Date).now()},end:function(){a++;var c=(performance||Date).now();h.update(c-k,200);if(c>g+1E3&&(r.update(1E3*a/(c-g),100),g=c,a=0,t)){var d=performance.memory;t.update(d.usedJSHeapSize/+1048576,d.jsHeapSizeLimit/1048576)}return c},update:function(){k=this.end()},domElement:c,setMode:u}};f.Panel=function(e,f,l){var c=Infinity,k=0,g=Math.round,a=g(window.devicePixelRatio||1),r=80*a,h=48*a,t=3*a,v=2*a,d=3*a,m=15*a,n=74*a,p=30*a,q=document.createElement("canvas");q.width=r;q.height=h;q.style.cssText="width:80px;height:48px";var b=q.getContext("2d");b.font="bold "+9*a+"px Helvetica,Arial,sans-serif";b.textBaseline="top";b.fillStyle=l;b.fillRect(0,0,r,h);b.fillStyle=f;b.fillText(e,t,v);+b.fillRect(d,m,n,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d,m,n,p);return{dom:q,update:function(h,w){c=Math.min(c,h);k=Math.max(k,h);b.fillStyle=l;b.globalAlpha=1;b.fillRect(0,0,r,m);b.fillStyle=f;b.fillText(g(h)+" "+e+" ("+g(c)+"-"+g(k)+")",t,v);b.drawImage(q,d+a,m,n-a,p,d,m,n-a,p);b.fillRect(d+n-a,m,a,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d+n-a,m,a,g((1-h/w)*p))}}};return f});diff --git a/examples/1000-DOM-elements.html b/documentation/examples/1000-DOM-elements.htmlsimilarity index 86%rename from examples/1000-DOM-elements.htmlrename to documentation/examples/1000-DOM-elements.htmlindex 4b4b91ce..78cf4def 100644--- a/examples/1000-DOM-elements.html+++ b/documentation/examples/1000-DOM-elements.html@@ -3,9 +3,9 @@<head><title>1000 DOM elements animations | anime.js</title><meta charset="utf-8">- <link rel="icon" type="image/png" href="assets/img/favicon.png" />- <link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <link rel="icon" type="image/png" href="../assets/img/favicon.png" />+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script><style>.particule {@@ -61,5 +61,5 @@toAnimate.forEach(animate);</script>- <script src="assets/js/stats.js"></script>+ <script src="../assets/js/stats.js"></script></html>diff --git a/examples/anime-logo-animation.html b/documentation/examples/anime-logo-animation.htmlsimilarity index 98%rename from examples/anime-logo-animation.htmlrename to documentation/examples/anime-logo-animation.htmlindex d4a8e9f2..627dc3b8 100644--- a/examples/anime-logo-animation.html+++ b/documentation/examples/anime-logo-animation.html@@ -3,9 +3,9 @@<head><title>Anime logo animation | anime.js</title><meta charset="utf-8">- <link rel="icon" type="image/png" href="assets/img/favicon.png" />- <link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <link rel="icon" type="image/png" href="../assets/img/favicon.png" />+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script><style>.logo-animation {display: flex;@@ -300,6 +300,6 @@]);</script>- <script src="assets/js/stats.js"></script>+ <script src="../assets/js/stats.js"></script></body></html>diff --git a/examples/anime-mgs-logo-animation.html b/documentation/examples/anime-mgs-logo-animation.htmlsimilarity index 98%rename from examples/anime-mgs-logo-animation.htmlrename to documentation/examples/anime-mgs-logo-animation.htmlindex efa5e5ad..696422ec 100644--- a/examples/anime-mgs-logo-animation.html+++ b/documentation/examples/anime-mgs-logo-animation.html@@ -3,9 +3,9 @@<head><title>Anime MGS logo animation | anime.js</title><meta charset="utf-8">- <link rel="icon" type="image/png" href="assets/img/favicon.png" />- <link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <link rel="icon" type="image/png" href="../assets/img/favicon.png" />+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script><style>html,@@ -231,6 +231,6 @@]);</script>- <script src="assets/js/stats.js"></script>+ <script src="../assets/js/stats.js"></script></body></html>diff --git a/examples/anime-playback.html b/documentation/examples/anime-playback.htmlsimilarity index 99%rename from examples/anime-playback.htmlrename to documentation/examples/anime-playback.htmlindex a443f4a6..5b42b9ea 100644--- a/examples/anime-playback.html+++ b/documentation/examples/anime-playback.html@@ -5,7 +5,7 @@<meta charset="utf-8"><link rel="icon" type="image/png" href="assets/img/favicon.png" /><link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <script src="../../anime.js"></script><style>.demo {diff --git a/examples/anime-timeline.html b/documentation/examples/anime-timeline.htmlsimilarity index 96%rename from examples/anime-timeline.htmlrename to documentation/examples/anime-timeline.htmlindex 8e6430f9..136da2c8 100644--- a/examples/anime-timeline.html+++ b/documentation/examples/anime-timeline.html@@ -3,9 +3,9 @@<head><title>Timeline | anime.js</title><meta charset="utf-8">- <link rel="icon" type="image/png" href="assets/img/favicon.png" />- <link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <link rel="icon" type="image/png" href="../assets/img/favicon.png" />+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script><style>.demo {diff --git a/examples/canvas-fireworks.html b/documentation/examples/canvas-fireworks.htmlsimilarity index 96%rename from examples/canvas-fireworks.htmlrename to documentation/examples/canvas-fireworks.htmlindex 73c793b3..10454ef5 100644--- a/examples/canvas-fireworks.html+++ b/documentation/examples/canvas-fireworks.html@@ -3,9 +3,9 @@<head><title>Canvas fireworks | anime.js</title><meta charset="utf-8">- <link rel="icon" type="image/png" href="assets/img/favicon.png" />- <link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <link rel="icon" type="image/png" href="../assets/img/favicon.png" />+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script><style>.logo-animation {display: flex;@@ -228,6 +228,6 @@window.addEventListener('load', setCanvasSize, false);</script>- <script src="assets/js/stats.js"></script>+ <script src="../assets/js/stats.js"></script></body></html>diff --git a/examples/ease-visualizer.html b/documentation/examples/ease-visualizer.htmlsimilarity index 98%rename from examples/ease-visualizer.htmlrename to documentation/examples/ease-visualizer.htmlindex 2a973c5c..f127870b 100644--- a/examples/ease-visualizer.html+++ b/documentation/examples/ease-visualizer.html@@ -3,9 +3,9 @@<head><title>Ease visualizer | anime.js</title><meta charset="utf-8">- <link rel="icon" type="image/png" href="assets/img/favicon.png" />- <link href="assets/css/styles.css" rel="stylesheet">- <script src="../anime.js"></script>+ <link rel="icon" type="image/png" href="../assets/img/favicon.png" />+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script><style>.easings {display: flex;diff --git a/documentation/index.html b/documentation/index.htmlnew file mode 100644index 00000000..d394de74--- /dev/null+++ b/documentation/index.html@@ -0,0 +1,1690 @@+<!DOCTYPE html>+<html>+<head>+ <title>Documentation | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />+ <link rel="icon" type="image/png" href="assets/img/favicon.png" />+ <link rel="apple-touch-icon" href="assets/img/apple-touch-icon.png" />+ <link href="https://fonts.googleapis.com/css?family=Space+Mono" rel="stylesheet">+ <link href="assets/css/anime.css" rel="stylesheet">+ <link href="assets/css/anime-theme.css" rel="stylesheet">+ <link href="assets/css/documentation.css" rel="stylesheet">+ <script src="../anime.js"></script>+</head>+<body>+ <div class="content">+ <header class="header">+ <h1><a class="logo" href="http://anime-js.com">anime.js</a></h1>+ </header>+ <section class="pane sidebar">+ <nav class="navigation"></nav>+ </section>+ <section class="pane demos">++<!-- TARGETS -->+<article id="targets" class="color-01">+ <header>+ <h2 class="demos-title">Targets</h2>+ </header>++<div id="cssSelector" class="demo">+ <h3 class="demo-title">CSS Selector</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ </div>+<script>var cssSelector = anime({+ targets: '#cssSelector .el',+ translateX: 250+});+</script>+</div>++<div id="domNode" class="demo">+ <h3 class="demo-title">DOM Node</h3>+ <div class="demo-content">+ <div class="large square shadow"></div>+ <div class="large square el"></div>+ </div>+<script>var el = document.querySelector('#domNode .el');++var domNode = anime({+ targets: el,+ translateX: 250+});+</script>+</div>++<div id="nodeList" class="demo">+ <h3 class="demo-title">Node List</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ </div>+<script>var els = document.querySelectorAll('#nodeList .el');++var nodeList = anime({+ targets: els,+ translateX: 250+});+</script>+</div>++<div id="JSobject" class="demo">+ <h3 class="demo-title">JavaScript Object</h3>+ <div class="demo-content">+ <pre>{"charged":"0"}</pre>+ </div>+<script>var obj = { charged: '0%' };++var JSobject = anime({+ targets: obj,+ charged: '100%',+ round: 1,+ easing: 'linear',+ update: function() {+ var el = document.querySelector('#JSobject pre');+ el.innerHTML = JSON.stringify(obj);+ }+});+</script>+</div>++<div id="JSarray" class="demo">+ <h3 class="demo-title">JavaScript Array</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el-01"></div>+ </div>+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el-02"></div>+ </div>+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el-03"></div>+ </div>+ </div>+<script>var el = document.querySelector('#JSarray .el-01');++var JSarray = anime({+ targets: [el, '#JSarray .el-02', '#JSarray .el-03'],+ translateX: 250+});+</script>+</div>++</article>+<!-- -->++<!-- ANIMATABLE PROPERTIES -->+<article id="properties" class="color-02">+<header>+ <h2 class="demos-title">Properties</h2>+</header>++<div id="cssProperties" class="demo">+ <h3 class="demo-title">CSS</h3>+ <div class="demo-content">+ <div class="large square shadow"></div>+ <div class="large square el"></div>+ </div>+<script>var cssProperties = anime({+ targets: '#cssProperties .el',+ left: '80%',+ opacity: 0.8,+ backgroundColor: '#FFF',+ easing: 'easeInOutQuad'+});+</script>+</div>++<div id="CSStransforms" class="demo">+ <h3 class="demo-title">CSS Transforms</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var CSStransforms = anime({+ targets: '#CSStransforms .el',+ translateX: 250,+ scale: 2,+ rotate: '1turn'+});+</script>+</div>++<div id="JSobjectProp" class="demo">+ <h3 class="demo-title">Object properties</h3>+<div class="demo-content"><pre>{"myProperty":"0"}</pre></div>+<script>var myObject = {+ prop1: 0,+ prop2: '0%'+}+var JSobjectProp = anime({+ targets: myObject,+ prop1: 50,+ prop2: '100%',+ easing: 'linear',+ round: 1,+ update: function() {+ var el = document.querySelector('#JSobjectProp pre');+ el.innerHTML = JSON.stringify(myObject);+ }+});+</script>+</div>++<div id="domAttributes" class="demo">+ <h3 class="demo-title">DOM Attributes</h3>+ <div class="demo-content">+ <input class="text-output" value="0"></input>+ </div>+<script>var domAttributes = anime({+ targets: '#domAttributes input',+ value: 1000,+ round: 1,+ easing: 'easeInOutExpo'+});+</script>+</div>++<div id="svgAttributes" class="demo">+ <h3 class="demo-title">SVG Attributes</h3>+ <div class="demo-content align-center">+<svg width="128" height="128" viewBox="0 0 128 128">+ <polygon points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100" fill="currentColor"/>+</svg>+ </div>+<script>var svgAttributes = anime({+ targets: '#svgAttributes polygon',+ points: '64 128 8.574 96 8.574 32 64 0 119.426 32 119.426 96',+ easing: 'easeInOutExpo'+});+</script>+</div>++</article>+<!-- -->++<!-- PROPERTY PARAMETERS -->+<article id="propertyParameters" class="color-03">+ <header>+ <h2 class="demos-title">Property parameters</h2>+ </header>++<div id="duration" class="demo">+ <h3 class="demo-title">Duration</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var duration = anime({+ targets: '#duration .el',+ translateX: 250,+ duration: 3000+});+</script>+</div>++<div id="delay" class="demo">+ <h3 class="demo-title">Delay</h3>+ <div class="demo-content">+<div class="square shadow"></div>+<div class="square el"></div>+ </div>+<script>var delay = anime({+ targets: '#delay .el',+ translateX: 250,+ delay: 1000+});+</script>+</div>++<div id="easing" class="demo">+ <h3 class="demo-title">Easing</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var easing = anime({+ targets: '#easing .el',+ translateX: 250,+ easing: 'easeInOutQuart'+});+</script>+</div>++<div id="specificPropertyParameters" class="demo">+ <h3 class="demo-title">Specific property parameters</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var specificPropertyParameters = anime({+ targets: '#specificPropertyParameters .el',+ translateX: {+ value: 250,+ duration: 800+ },+ rotate: {+ value: 360,+ duration: 1800,+ easing: 'easeInOutSine'+ },+ scale: {+ value: 2,+ duration: 1600,+ delay: 800,+ easing: 'easeInOutQuart'+ },+ delay: 250 // All properties except 'scale' inherit 250ms delay+});+</script>+</div>++</article>+<!-- -->++<!-- FUNCTION BASED PARAMETERS -->+<article id="functionBasedParameters" class="color-04">+<header>+ <h2 class="demos-title">Function based parameters</h2>+</header>++<div id="functionBasedDuration" class="demo">+ <h3 class="demo-title">Duration</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ </div>+<script>var functionBasedDuration = anime({+ targets: '#functionBasedDuration .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ duration: function(el, i, l) {+ return 1000 + (i * 1000);+ }+});+</script>+</div>++<div id="functionBasedDelay" class="demo">+ <h3 class="demo-title">Delay</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ </div>+<script>var functionBasedDelay = anime({+ targets: '#functionBasedDelay .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ delay: function(el, i, l) {+ return i * 100;+ }+});+</script>+</div>++<div id="functionBasedElasticity" class="demo">+ <h3 class="demo-title">Elasticity</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ </div>+<script>var functionBasedElasticity = anime({+ targets: '#functionBasedElasticity .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ elasticity: function(el, i, l) {+ return (200 + i * 200);+ }+});+</script>+</div>++<div id="combinedFunctionBasedProp" class="demo">+ <h3 class="demo-title">Combined</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div data-duration="2000" class="square el"></div>+ </div>+ <div class="line">+ <div class="square shadow"></div>+ <div data-duration="1500" class="square el"></div>+ </div>+ <div class="line">+ <div class="square shadow"></div>+ <div data-duration="1000" class="square el"></div>+ </div>+ </div>+<script>var combinedFunctionBasedProp = anime({+ targets: '#combinedFunctionBasedProp .el',+ translateX: 100,+ translateX: 250,+ rotate: 180,+ duration: function(target) {+ // Duration based on every div 'data-duration' attribute+ return target.getAttribute('data-duration');+ },+ delay: function(target, index) {+ // 100ms delay multiplied by every div index, in ascending order+ return index * 100;+ },+ elasticity: function(target, index, totalTargets) {+ // Elasticity multiplied by every div index, in descending order+ return 200 + ((totalTargets - index) * 200);+ },+ direction: 'alternate',+ loop: true+});+</script>+</div>++</article>+<!-- -->++<!-- ANIMATION PARAMETERS -->+<article id="animationParameters" class="color-05">+ <header>+ <h2 class="demos-title">Animation parameters</h2>+ </header>++<div id="alternate" class="demo">+ <h3 class="demo-title">Direction alternate</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var alternate = anime({+ targets: '#alternate .el',+ translateX: 250,+ direction: 'alternate'+});+</script>+</div>++<div id="reverse" class="demo">+ <h3 class="demo-title">Direction reverse</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var reverse = anime({+ targets: '#reverse .el',+ translateX: 250,+ direction: 'reverse'+});+</script>+</div>++<div id="loop" class="demo">+ <h3 class="demo-title">Loop (x times)</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var loop = anime({+ targets: '#loop .el',+ translateX: 250,+ loop: 3+});+</script>+</div>++<div id="loopAlternate" class="demo">+ <h3 class="demo-title">Loop alternate (x times)</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var loopAlternate = anime({+ targets: '#loopAlternate .el',+ translateX: 250,+ loop: 3,+ direction: 'alternate'+});+</script>+</div>++<div id="loopReverse" class="demo">+ <h3 class="demo-title">Loop reverse (x times)</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var loopReverse = anime({+ targets: '#loopReverse .el',+ translateX: 250,+ loop: 3,+ direction: 'reverse'+});+</script>+</div>++<div id="infiniteLoop" class="demo">+ <h3 class="demo-title">Infinite loop</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var infiniteLoop = anime({+ targets: '#infiniteLoop .el',+ translateX: 250,+ loop: true+});+</script>+</div>++<div id="infiniteLoopAlternate" class="demo">+ <h3 class="demo-title">Infinite loop alternate</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var infiniteLoopAlternate = anime({+ targets: '#infiniteLoopAlternate .el',+ translateX: 250,+ direction: 'alternate',+ loop: true+});+</script>+</div>++<div id="infiniteLoopReverse" class="demo">+ <h3 class="demo-title">Infinite loop reverse</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var infiniteLoopReverse = anime({+ targets: '#infiniteLoopReverse .el',+ translateX: 250,+ direction: 'reverse',+ loop: true+});+</script>+</div>++</article>+<!-- -->++<!-- VALUES -->+<article id="values" class="color-06">+<header>+ <h2 class="demos-title">Values</h2>+</header>++<div id="unitlessValue" class="demo">+ <h3 class="demo-title">Unitless</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var unitlessValue = anime({+ targets: '#unitlessValue .el',+ translateX: 250,+ rotate: 540+});+</script>+</div>++<div id="specificUnitValue" class="demo">+ <h3 class="demo-title">Specific unit</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var specificUnitValue = anime({+ targets: '#specificUnitValue .el',+ translateX: '20em',+ rotate: '1.5turn'+});+</script>+</div>++<div id="relativeValues" class="demo">+ <h3 class="demo-title">Relative</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el" style="transform: translateX(100px)"></div>+ </div>+<script>var relativeValues = anime({+ targets: '#relativeValues .el',+ translateX: {+ value: '+=150',+ duration: 1000+ },+ width: {+ value: '-=10',+ duration: 1800,+ easing: 'easeInOutSine'+ },+ height: {+ value: '*=4',+ duration: 1800,+ easing: 'easeInOutSine'+ },+ direction: 'alternate'+});+</script>+</div>++<div id="colors" class="demo">+ <h3 class="demo-title">Colors</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div class="square hex"></div>+ </div>+ <div class="line">+ <div class="square shadow"></div>+ <div class="square rgb"></div>+ </div>+ <div class="line">+ <div class="square shadow"></div>+ <div class="square hsl"></div>+ </div>+ </div>+<script>var hex = anime({+ targets: '#colors .hex',+ translateX: 250,+ backgroundColor: '#FFF', // Or #FFFFFF+ easing: 'linear',+ duration: 2000+});++var rgb = anime({+ targets: '#colors .rgb',+ translateX: 250,+ backgroundColor: 'rgb(255, 255, 255)',+ easing: 'linear',+ duration: 2000+});++var hsl = anime({+ targets: '#colors .hsl',+ translateX: 250,+ backgroundColor: 'hsl(360, 100%, 100%)',+ easing: 'linear',+ duration: 2000+});+</script>+<script>+ var colors = anime.timeline();+ colors.add([hex, rgb, hsl]);+</script>+</div>++<div id="specificInitialValue" class="demo">+ <h3 class="demo-title">Specific initial value</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var specificInitialValue = anime({+ targets: '#specificInitialValue .el',+ translateX: [100, 250],+ delay: 500,+ direction: 'alternate',+ loop: true+});+</script>+</div>++<div id="functionBasedPropVal" class="demo">+ <h3 class="demo-title">Function based values</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div data-x="160" class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div data-x="80" class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div data-x="250" class="small square el"></div>+ </div>+ </div>+<script>var functionBasedPropVal = anime({+ targets: '#functionBasedPropVal .el',+ translateX: function(el) {+ return el.getAttribute('data-x');+ },+ translateY: function(el, i) {+ return 50 + (-50 * i);+ },+ scale: function(el, i, l) {+ return (l - i) + .25;+ },+ rotate: function() { return anime.random(-360, 360); },+ duration: function() { return anime.random(1200, 1800); },+ duration: function() { return anime.random(800, 1600); },+ delay: function() { return anime.random(0, 1000); },+ direction: 'alternate',+ loop: true+});+</script>+</div>++<div id="keyframes" class="demo">+ <h3 class="demo-title">Keyframes</h3>+ <div class="demo-content">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var keyframes = anime({+ targets: '#keyframes .el',+ translateX: [+ { value: 250, duration: 1000, delay: 500, elasticity: 0 },+ { value: 0, duration: 1000, delay: 500, elasticity: 0 }+ ],+ translateY: [+ { value: -40, duration: 500, elasticity: 100 },+ { value: 40, duration: 500, delay: 1000, elasticity: 100 },+ { value: 0, duration: 500, delay: 1000, elasticity: 100 }+ ],+ scaleX: [+ { value: 4, duration: 100, delay: 500, easing: 'easeOutExpo' },+ { value: 1, duration: 900, elasticity: 300 },+ { value: 4, duration: 100, delay: 500, easing: 'easeOutExpo' },+ { value: 1, duration: 900, elasticity: 300 }+ ],+ scaleY: [+ { value: [1.75, 1], duration: 500 },+ { value: 2, duration: 50, delay: 1000, easing: 'easeOutExpo' },+ { value: 1, duration: 450 },+ { value: 1.75, duration: 50, delay: 1000, easing: 'easeOutExpo' },+ { value: 1, duration: 450 }+ ],+ loop: true+});+</script>+</div>++</article>+<!-- -->++<!-- TIMELINE -->+<article id="timeline" class="color-07">+<header>+ <h2 class="demos-title">Timeline</h2>+</header>++<div id="basicTimeline" class="demo">+ <h3 class="demo-title">Basic timeline</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <div class="line">+ <div class="circle shadow"></div>+ <div class="circle el"></div>+ </div>+ <div class="line">+ <div class="triangle shadow"></div>+ <div class="triangle el"></div>+ </div>+ </div>+<script>var basicTimeline = anime.timeline();++basicTimeline.add([+ anime({+ targets: '#basicTimeline .square.el',+ translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],+ translateY: [ { value: 30 }, { value: 60 }, { value: 60 } ],+ duration: 2000+ }),+ anime({+ targets: '#basicTimeline .circle.el',+ translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],+ translateY: [ { value: 30 }, { value: -30 }, { value: -30 } ],+ duration: 3000+ }),+ anime({+ targets: '#basicTimeline .triangle.el',+ translateX: [ { value: 80 }, { value: 250 } ],+ translateY: [ { value: -60 }, { value: -30 }, { value: -30 } ],+ duration: 3000+ })+]);++</script>+</div>++<div id="timelineParameters" class="demo">+ <h3 class="demo-title">Timeline parameters</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <div class="line">+ <div class="circle shadow"></div>+ <div class="circle el"></div>+ </div>+ <div class="line">+ <div class="triangle shadow"></div>+ <div class="triangle el"></div>+ </div>+ </div>+<script>var timelineParameters = anime.timeline({+ direction: 'reverse',+ loop: 'true'+});++timelineParameters.add([+ anime({+ targets: '#timelineParameters .square.el',+ translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],+ translateY: [ { value: 30 }, { value: 60 }, { value: 60 } ],+ duration: 2000,+ delay: 1000+ }),+ anime({+ targets: '#timelineParameters .circle.el',+ translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],+ translateY: [ { value: 30 }, { value: -30 }, { value: -30 } ],+ duration: 3000,+ delay: 1000+ }),+ anime({+ targets: '#timelineParameters .triangle.el',+ translateX: [ { value: 80 }, { value: 250 } ],+ translateY: [ { value: -60 }, { value: -30 }, { value: -30 } ],+ duration: 3000,+ delay: 1000+ })+]);++</script>+</div>++</article>+<!-- -->++<!-- PLAYBACK -->+<article id="playback" class="color-08">+<header>+ <h2 class="demos-title">Playback</h2>+</header>++<div id="playPause" class="demo controls">+ <h3 class="demo-title">Play / Pause</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line player">+ <button class="play">Play</button>+ <button class="pause">Pause</button>+ </div>+ </div>+<script>var playPause = anime({+ targets: '#playPause .el',+ translateX: 250,+ delay: function(el, i, l) { return i * 100; },+ direction: 'alternate',+ loop: true,+ autoplay: false+});++document.querySelector('#playPause .play').onclick = playPause.play;+document.querySelector('#playPause .pause').onclick = playPause.pause;++</script>+</div>++<div id="restartAnim" class="demo controls">+ <h3 class="demo-title">Restart</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line player">+ <button class="restart">Restart</button>+ </div>+ </div>+<script>var restartAnim = anime({+ targets: '#restartAnim .el',+ translateX: 250,+ delay: function(el, i, l) { return i * 100; },+ direction: 'alternate',+ loop: true,+ autoplay: false+});++document.querySelector('#restartAnim .restart').onclick = restartAnim.restart;++</script>+</div>++<div id="seekAnim" class="demo controls">+ <h3 class="demo-title">Seek</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line player">+ <input class="progress" step=".001" type="range" min="0" max="100" value="0"></input>+ </div>+ </div>+<script>var seekAnim = anime({+ targets: '#seekAnim .el',+ translateX: 250,+ delay: function(el, i, l) { return i * 100; },+ elasticity: 200,+ autoplay: false+});++var seekProgressEl = document.querySelector('#seekAnim .progress');+document.querySelector('#seekAnim .progress').oninput = function() {+ seekAnim.seek(seekAnim.duration * (seekProgressEl.value / 100));+};++</script>+</div>++<div id="TLcontrols" class="demo controls">+ <h3 class="demo-title">Timemline controls</h3>+ <div class="demo-content">+ <div class="line">+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <div class="line">+ <div class="circle shadow"></div>+ <div class="circle el"></div>+ </div>+ <div class="line">+ <div class="triangle shadow"></div>+ <div class="triangle el"></div>+ </div>+ <div class="line player align-items">+ <button class="play">Play</button>+ <button class="pause">Pause</button>+ <button class="restart">Restart</button>+ <input class="progress" step="2" type="range" min="0" max="100" value="0"></input>+ </div>+ </div>+<script>var controlsProgressEl = document.querySelector('#TLcontrols .progress');++var TLcontrols = anime.timeline({+ direction: 'alternate',+ update: function(anim) {+ controlsProgressEl.value = anim.progress;+ }+});++TLcontrols.add([+ anime({+ targets: '#TLcontrols .square.el',+ translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],+ translateY: [ { value: 30 }, { value: 60 }, { value: 60 } ],+ duration: 2000+ }),+ anime({+ targets: '#TLcontrols .circle.el',+ translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],+ translateY: [ { value: 30 }, { value: -30 }, { value: -30 } ],+ duration: 3000+ }),+ anime({+ targets: '#TLcontrols .triangle.el',+ translateX: [ { value: 80 }, { value: 250 } ],+ translateY: [ { value: -60 }, { value: -30 }, { value: -30 } ],+ duration: 3000+ })+]);++document.querySelector('#TLcontrols .play').onclick = TLcontrols.play;+document.querySelector('#TLcontrols .pause').onclick = TLcontrols.pause;+document.querySelector('#TLcontrols .restart').onclick = TLcontrols.restart;++controlsProgressEl.addEventListener('input', function() {+ TLcontrols.seek(TLcontrols.duration * (controlsProgressEl.value / 100));+});+</script>+</div>++</article>+<!-- -->++<!-- CALLBACKS -->+<article id="callbacks" class="color-09">+<header>+ <h2 class="demos-title">Callbacks</h2>+</header>++<div id="allCallbacks" class="demo">+ <h3 class="demo-title">All callbacks</h3>+ <div class="demo-content">+ <div class="logs">+ <input class="log update-log"></input>+ <input class="log began-log"></input>+ <input class="log completed-log"></input>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el"></div>+ </div>+ <div class="line player align-items"></div>+ </div>+<script>var updateLogEl2 = document.querySelector('#allCallbacks .update-log');+var beganLogEl2 = document.querySelector('#allCallbacks .began-log');+var completedLogEl2 = document.querySelector('#allCallbacks .completed-log');++var allCallbacks = anime({+ targets: '#allCallbacks .el',+ translateX: 250,+ delay: function(el, i) { return 1000 + (i * 100); },+ duration: function(el, i) { return 500 + (i * 500); }+});++allCallbacks.update = function(anim) {+ if (!anim.began) {+ updateLogEl2.value = 'begins in ' + Math.round(anim.delay - anim.currentTime) + 'ms';+ beganLogEl2.value = '';+ } else {+ updateLogEl2.value = 'begins in 0ms';+ }+ if (!anim.completed) {+ completedLogEl2.value = '';+ }+}+allCallbacks.begin = function() { beganLogEl2.value = 'began'; };+allCallbacks.complete = function() { completedLogEl2.value = 'completed'; };++</script>+</div>++<div id="update" class="demo">+ <h3 class="demo-title">Update</h3>+ <div class="demo-content">+ <div class="logs">+ <input class="log current-time-log"></input>+ <input class="log progress-log"></input>+ </div>+ <div class="large square shadow"></div>+ <div class="large square el"></div>+ </div>+<script>var updateLogEl = document.querySelector('#update .current-time-log');+var progressLogEl = document.querySelector('#update .progress-log');++var update = anime({+ targets: '#callbacks .el',+ translateX: 250,+ delay: 1000,+ update: function(anim) {+ updateLogEl.value = 'current time : ' + Math.round(anim.currentTime) + 'ms';+ progressLogEl.value = 'progress : ' + Math.round(anim.progress) + '%';+ }+});+</script>+</div>++<div id="begin" class="demo">+ <h3 class="demo-title">Begin</h3>+ <div class="demo-content">+ <div class="logs">+ <input class="log began-log" value="began : false"></input>+ </div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var beganLogEl = document.querySelector('#begin .began-log');++var begin = anime({+ targets: '#begin .el',+ translateX: 250,+ delay: 1000,+ begin: function(anim) {+ beganLogEl.value = 'began : ' + anim.began;+ }+});+</script>+<script>+begin.update = function(anim) {+ if (!anim.began) {+ beganLogEl.value = 'began : ' + anim.began;+ }+}+</script>+</div>++<div id="complete" class="demo">+ <h3 class="demo-title">Complete</h3>+ <div class="demo-content">+ <div class="logs">+ <input class="log completed-log" value="completed : false"></input>+ </div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+<script>var completedLogEl = document.querySelector('#complete .completed-log');++var complete = anime({+ targets: '#complete .el',+ translateX: 250,+ complete: function(anim) {+ completedLogEl.value = 'completed : ' + anim.completed;+ }+});+</script>+<script>+complete.update = function(anim) {+ if (!anim.completed) {+ completedLogEl.value = 'completed : ' + anim.completed;+ }+}+</script>+</div>++</article>+<!-- -->++<!-- SVG -->+<article id="svg" class="color-10">+<header>+ <h2 class="demos-title">SVG</h2>+</header>++<div id="motionPath" class="demo">+ <h3 class="demo-title">Motion path</h3>+ <div class="demo-content">+ <div class="motion-path">+ <div class="small square shadow follow-path"></div>+ <div class="small square el follow-path"></div>+ <svg width="256" height="112" viewBox="0 0 256 112">+ <path fill="none" stroke="currentColor" stroke-width="1" d="M8,56 C8,33.90861 25.90861,16 48,16 C70.09139,16 88,33.90861 88,56 C88,78.09139 105.90861,92 128,92 C150.09139,92 160,72 160,56 C160,40 148,24 128,24 C108,24 96,40 96,56 C96,72 105.90861,92 128,92 C154,93 168,78 168,56 C168,33.90861 185.90861,16 208,16 C230.09139,16 248,33.90861 248,56 C248,78.09139 230.09139,96 208,96 L48,96 C25.90861,96 8,78.09139 8,56 Z"/>+ </svg>+ </div>+ </div>+<script>var path = anime.path('#motionPath path');++var motionPath = anime({+ targets: '#motionPath .el',+ translateX: path('x'),+ translateY: path('y'),+ rotate: path('angle'),+ easing: 'linear',+ duration: 2000,+ loop: true+});++</script>+</div>++<div id="morphing" class="demo">+ <h3 class="demo-title">Morphing</h3>+ <div class="demo-content align-center">+ <svg width="140" height="140" viewBox="0 0 140 140">+ <g fill="none" fill-rule="evenodd">+ <g fill="currentColor" fill-opacity=".15" transform="translate(0 6)">+ <polygon points="70 0 136.574 48.369 111.145 126.631 28.855 126.631 3.426 48.369"/>+ <polygon points="70 18 119.455 53.931 100.565 112.069 39.435 112.069 20.545 53.931"/>+ <polygon points="70 34.86 101.727 57.911 89.609 95.209 50.391 95.209 38.273 57.911"/>+ <polygon points="70 50.898 84.864 61.697 79.186 79.171 60.814 79.171 55.136 61.697"/>+ </g>+ <polygon class="polymorph" stroke-width="1" stroke="currentColor" points="70 24 119.574 60.369 100.145 117.631 50.855 101.631 3.426 54.369"/>+ </g>+ </svg>+ </div>+<script>var morphing = anime({+ targets: '#morphing .polymorph',+ points: [+ { value: '70 41 118.574 59.369 111.145 132.631 60.855 84.631 20.426 60.369' },+ { value: '70 6 119.574 60.369 100.145 117.631 39.855 117.631 55.426 68.369' },+ { value: '70 57 136.574 54.369 89.145 100.631 28.855 132.631 38.426 64.369' },+ { value: '70 24 119.574 60.369 100.145 117.631 50.855 101.631 3.426 54.369' }+ ],+ easing: 'easeOutQuad',+ duration: 2000,+ loop: true+});++</script>+</div>++<div id="lineDrawing" class="demo">+ <h3 class="demo-title">Line drawing</h3>+ <div class="demo-content align-center">+ <svg viewBox="0 0 280 100">+ <g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-width="1" class="lines">+ <path d="M58 80V50.12C57.7 41.6 51.14 35 43 35a15 15 0 0 0 0 30h7.5v15H43a30 30 0 1 1 0-60c16.42 0 29.5 13.23 30 29.89V80H58z"/>+ <path d="M73 80V20H58v60h15z"/>+ <path d="M58 80V49.77C58.5 33.23 71.58 20 88 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80H58zm75 0V20h-15v60h15z"/>+ <path d="M118 80V49.77C118.5 33.23 131.58 20 148 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80h-15zm-7.5-60a7.5 7.5 0 1 1-7.48 8v-1c.25-3.9 3.5-7 7.48-7z"/>+ <path d="M133 65a15 15 0 0 1-15-15v-7.5h-15V50a30 30 0 0 0 30 30V65zm30 15V49.77C163.5 33.23 176.58 20 193 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80h-15z"/>+ <path d="M238 65a15 15 0 0 1 0-30c8.1 0 14.63 6.53 15 15h-15v15h30V49.89C267.5 33.23 254.42 20 238 20a30 30 0 0 0 0 60V65z"/>+ <path d="M260.48 65a7.5 7.5 0 1 1-7.48 8v-1c.26-3.9 3.5-7 7.48-7z"/>+ </g>+ </svg>+ </div>+<script>var lineDrawing = anime({+ targets: '#lineDrawing .lines path',+ strokeDashoffset: [anime.setDashoffset, 0],+ easing: 'easeInOutSine',+ duration: 1500,+ delay: function(el, i) { return i * 250 },+ direction: 'alternate',+ loop: true+});++</script>+</div>++</article>+<!-- -->++<!-- EASINGS -->+<article id="easings" class="color-11">+ <header>+ <h2 class="demos-title">Easings</h2>+ </header>++<div id="penner" class="demo">+ <h3 class="demo-title">Built in equations</h3>+ <div class="demo-content">+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square linear"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InQuad"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InCubic"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InQuart"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InQuint"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InSine"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InExpo"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InCirc"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InBack"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutQuad"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutCubic"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutQuart"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutQuint"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutSine"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutExpo"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutCirc"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square OutBack"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutQuad"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutCubic"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutQuart"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutQuint"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutSine"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutExpo"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutCirc"></div>+ </div>+ <div class="line">+ <div class="small stretched square shadow"></div>+ <div class="small stretched square InOutBack"></div>+ </div>+ </div>+<script>var linear = anime({+ targets: '#penner .linear',+ translateX: 250,+ easing: 'linear'+});+var InQuad = anime({+ targets: '#penner .InQuad',+ translateX: 250,+ easing: 'easeInQuad'+});+var InCubic = anime({+ targets: '#penner .InCubic',+ translateX: 250,+ easing: 'easeInCubic'+});+var InQuart = anime({+ targets: '#penner .InQuart',+ translateX: 250,+ easing: 'easeInQuart'+});+var InQuint = anime({+ targets: '#penner .InQuint',+ translateX: 250,+ easing: 'easeInQuint'+});+var InSine = anime({+ targets: '#penner .InSine',+ translateX: 250,+ easing: 'easeInSine'+});+var InExpo = anime({+ targets: '#penner .InExpo',+ translateX: 250,+ easing: 'easeInExpo'+});+var InCirc = anime({+ targets: '#penner .InCirc',+ translateX: 250,+ easing: 'easeInCirc'+});+var InBack = anime({+ targets: '#penner .InBack',+ translateX: 250,+ easing: 'easeInBack'+});+var OutQuad = anime({+ targets: '#penner .OutQuad',+ translateX: 250,+ easing: 'easeOutQuad'+});+var OutCubic = anime({+ targets: '#penner .OutCubic',+ translateX: 250,+ easing: 'easeOutCubic'+});+var OutQuart = anime({+ targets: '#penner .OutQuart',+ translateX: 250,+ easing: 'easeOutQuart'+});+var OutQuint = anime({+ targets: '#penner .OutQuint',+ translateX: 250,+ easing: 'easeOutQuint'+});+var OutSine = anime({+ targets: '#penner .OutSine',+ translateX: 250,+ easing: 'easeOutSine'+});+var OutExpo = anime({+ targets: '#penner .OutExpo',+ translateX: 250,+ easing: 'easeOutExpo'+});+var OutCirc = anime({+ targets: '#penner .OutCirc',+ translateX: 250,+ easing: 'easeOutCirc'+});+var OutBack = anime({+ targets: '#penner .OutBack',+ translateX: 250,+ easing: 'easeOutBack'+});+var InOutQuad = anime({+ targets: '#penner .InOutQuad',+ translateX: 250,+ easing: 'easeInOutQuad'+});+var InOutCubic = anime({+ targets: '#penner .InOutCubic',+ translateX: 250,+ easing: 'easeInOutCubic'+});+var InOutQuart = anime({+ targets: '#penner .InOutQuart',+ translateX: 250,+ easing: 'easeInOutQuart'+});+var InOutQuint = anime({+ targets: '#penner .InOutQuint',+ translateX: 250,+ easing: 'easeInOutQuint'+});+var InOutSine = anime({+ targets: '#penner .InOutSine',+ translateX: 250,+ easing: 'easeInOutSine'+});+var InOutExpo = anime({+ targets: '#penner .InOutExpo',+ translateX: 250,+ easing: 'easeInOutExpo'+});+var InOutCirc = anime({+ targets: '#penner .InOutCirc',+ translateX: 250,+ easing: 'easeInOutCirc'+});+var InOutBack = anime({+ targets: '#penner .InOutBack',+ translateX: 250,+ easing: 'easeInOutBack'+});+</script>+<script>var penner = anime.timeline();+penner.add([linear, InQuad, InCubic, InQuart, InQuint, InSine, InExpo, InCirc, InBack, OutQuad, OutCubic, OutQuart, OutQuint, OutSine, OutExpo, OutCirc, OutBack, InOutQuad, InOutCubic, InOutQuart, InOutQuint, InOutSine, InOutExpo, InOutCirc, InOutBack]);+</script>+</div>++<div id="elasticity" class="demo">+ <h3 class="demo-title">Elasticity</h3>+ <div class="demo-content">+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-0"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-100"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-200"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-300"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-400"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-500"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-600"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-700"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-800"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-900"></div>+ </div>+ <div class="line">+ <div class="stretched square shadow"></div>+ <div class="stretched square elasticity-1000"></div>+ </div>+ </div>+<script>var elasticity0 = anime({+ targets: '#elasticity .elasticity-0',+ translateX: 250,+ elasticity: 0,+ duration: 3000+});+var elasticity100 = anime({+ targets: '#elasticity .elasticity-100',+ translateX: 250,+ elasticity: 100,+ duration: 3000+});+var elasticity200 = anime({+ targets: '#elasticity .elasticity-200',+ translateX: 250,+ elasticity: 200,+ duration: 3000+});+var elasticity300 = anime({+ targets: '#elasticity .elasticity-300',+ translateX: 250,+ elasticity: 300,+ duration: 3000+});+var elasticity400 = anime({+ targets: '#elasticity .elasticity-400',+ translateX: 250,+ elasticity: 400,+ duration: 3000+});+var elasticity500 = anime({+ targets: '#elasticity .elasticity-500',+ translateX: 250,+ elasticity: 500,+ duration: 3000+});+var elasticity600 = anime({+ targets: '#elasticity .elasticity-600',+ translateX: 250,+ elasticity: 600,+ duration: 3000+});+var elasticity700 = anime({+ targets: '#elasticity .elasticity-700',+ translateX: 250,+ elasticity: 700,+ duration: 3000+});+var elasticity800 = anime({+ targets: '#elasticity .elasticity-800',+ translateX: 250,+ elasticity: 800,+ duration: 3000+});+var elasticity900 = anime({+ targets: '#elasticity .elasticity-900',+ translateX: 250,+ elasticity: 900,+ duration: 3000+});+var elasticity1000 = anime({+ targets: '#elasticity .elasticity-1000',+ translateX: 250,+ elasticity: 1000,+ duration: 3000+});+</script>+<script>var elasticity = anime.timeline();+elasticity.add([elasticity0, elasticity100, elasticity200, elasticity300, elasticity400, elasticity500, elasticity600, elasticity700, elasticity800, elasticity900, elasticity1000]);+</script>+</div>++<div id="customBezier" class="demo">+ <h3 class="demo-title">Custom Bézier curves</h3>+ <div class="demo-content">+ <div class="square large shadow"></div>+ <div class="square large el"></div>+ </div>+<script>var customBezier = anime({+ targets: '#customBezier .el',+ translateX: 250,+ easing: [.91,-0.54,.29,1.56]+});+</script>+</div>++<div id="customEasingFunction" class="demo">+ <h3 class="demo-title">Custom easing function</h3>+ <div class="demo-content">+ <div class="square large shadow"></div>+ <div class="square large el"></div>+ </div>+<script>anime.easings['myCustomEasingName'] = function(t) {+ return Math.pow(Math.sin(t * 3), 3);+}++var customEasingFunction = anime({+ targets: '#customEasingFunction .el',+ translateX: 250,+ easing: 'myCustomEasingName'+});+</script>+</div>++</article>+<!-- -->++ </section>+ <section class="pane code-examples">+ <div class="code-pane code-pane-js">+ <header class="code-header">+ <h2>JavaScript</h2>+ </header>+ <pre class="code-output js-output"></pre>+ </div>+ <div class="code-pane code-pane-html">+ <header class="code-header">+ <h2>HTML</h2>+ </header>+ <pre class="code-output html-output"></pre>+ </div>+ </section>+ </div>+ <script>+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');+ ga('create', 'UA-79927007-1', 'auto');+ ga('send', 'pageview');+ </script>+ <script src="assets/js/highlight.pack.js"></script>+ <script src="assets/js/beautify-html.js"></script>+ <script src="assets/js/scripts.js"></script>+</body>+</html>