You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/api-v2.0.0.html
+10-11
Original file line number
Diff line number
Diff line change
@@ -34,14 +34,16 @@
34
34
y1: '322px'
35
35
}</code></pre><strong>This property is required</strong> when the property<spanclass="snippet">direction</span> is set to<spanclass="snippet">custom</span>.<br>For more details, checkout the documentation of the <aclass="link" href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createLinearGradient" target="_blank">createLinearGradient </a>function.</td></tr><tr><td>isPausedWhenNotInView</td><td>false</td><td>Boolean</td><td>Does the animation stop when it's not in window view?<br>
36
36
(Despite this parameter, the animation always pause
37
-
when changing tab).</td></tr><tr><td>scrollDebounceThreshold <spanclass="version">v1.1.0</span></td><td>300</td><td>Int</td><td>What is the scroll <aclass="link" href="https://css-tricks.com/debouncing-throttling-explained-examples/" target="_blank">debounce</a> threshold (in ms)?<br><strong>Only useful if </strong><spanclass="snippet">isPausedWhenNotInView</span> is set to <spanclass="snippet">true</span>.</td></tr><tr><td>opacity <spanclass="required">(required)</span></td><td>/</td><td>Array of Int</td><td>You can adapt the opacity of each color of the gradient.<br>
38
-
if you have two colors <spanclass="snippet">[1, .5]</span>,
39
-
or three <spanclass="snippet">[1, .5, 1]</span>...</td></tr><tr><td>stateTransitionSpeed</td><td>1000</td><td>Int</td><td>Duration of the animation when changing state.</td></tr><tr><td>defaultStateName</td><td>'default-state'</td><td>String</td><td>The name of the default state.</td></tr><tr><td>states <spanclass="required">(required)</span></td><td>/</td><td>Object</td><td>Object containing all the states, see more info below.</td></tr><tr><td>image <spanclass="version">v1.1.0</span></td><td>/</td><td>Object</td><td>Object containing image options, see more info below.</td></tr></tbody></table></div><divclass="container bloc"><h2>options.states</h2><p>All the options available to customize the states and the different gradients.<br>
37
+
when changing tab).</td></tr><tr><td>scrollDebounceThreshold <spanclass="version">v1.1.0</span></td><td>300</td><td>Int</td><td>What is the scroll <aclass="link" href="https://css-tricks.com/debouncing-throttling-explained-examples/" target="_blank">debounce</a> threshold (in ms)?<br><strong>Only useful if </strong><spanclass="snippet">isPausedWhenNotInView</span> is set to <spanclass="snippet">true</span>.</td></tr><tr><td>stateTransitionSpeed</td><td>1000</td><td>Int</td><td>Duration of the animation when changing state.</td></tr><tr><td>defaultStateName</td><td>'default-state'</td><td>String</td><td>The name of the default state.</td></tr><tr><td>states <spanclass="required">(required)</span></td><td>/</td><td>Object</td><td>Object containing all the states, see more info below.</td></tr><tr><td>image <spanclass="version">v1.1.0</span></td><td>/</td><td>Object</td><td>Object containing image options, see more info below.</td></tr></tbody></table></div><divclass="container bloc"><h2>options.states</h2><p>All the options available to customize the states and the different gradients.<br>
40
38
Create a state with the name you want then add these parameters.<br>
41
-
By default, the name of your first state is <spanclass="snippet">'default-state'</span>, you can change it with <spanclass="snippet">options.defaultStateName</span>.</p><tableclass="api-list"><thead><tr><th>Property</th><th>Default</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>gradients <spanclass="required">(required)</span></td><td>/</td><td>Array of Arrays</td><td>The different gradients with the different colors
42
-
e.g. <spanclass="snippet">[ ['#FFF', '#000'],
43
-
['#000', '#FFF'] ]</span>.<br>
44
-
The array can contain only one gradient.</td></tr><tr><td>transitionSpeed</td><td>5000</td><td>Int</td><td>Transition duration between each gradient.</td></tr><tr><td>loop</td><td>true</td><td>Boolean</td><td>When the animation has arrived to the last gradient, does it repeat?</td></tr></tbody></table></div><divclass="container bloc" id="options-image"><h2>options.image <spanclass="version">v1.1.0</span></h2><p>All the options available to customize the image.<br>
39
+
By default, the name of your first state is <spanclass="snippet">'default-state'</span>, you can change it with <spanclass="snippet">options.defaultStateName</span>.</p><tableclass="api-list"><thead><tr><th>Property</th><th>Default</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>gradients <spanclass="required">(required)</span></td><td>/</td><td>Array of Arrays</td><td>The different gradients with the different colors, e.g.<pre><codeclass="language-js">[
<spanclass="snippet">hsl</span> and <spanclass="snippet">hsla</span>.
46
+
All the gradients should contain the same number of colors.</td></tr><tr><td>transitionSpeed</td><td>5000</td><td>Int</td><td>Transition duration between each gradient.</td></tr><tr><td>loop</td><td>true</td><td>Boolean</td><td>When the animation has arrived to the last gradient, does it repeat?</td></tr></tbody></table></div><divclass="container bloc" id="options-image"><h2>options.image <spanclass="version">v1.1.0</span></h2><p>All the options available to customize the image.<br>
45
47
The blending Mode works only if you set an image and gradients.</p><tableclass="api-list"><thead><tr><th>Property</th><th>Default</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>source <spanclass="required">(required)</span></td><td>/</td><td>String</td><td>The source of your image,
46
48
e.g. <spanclass="snippet">'img/800x200.jpg'</span>.</td></tr><tr><td>position</td><td>['center', 'center']</td><td>Array</td><td>The position of your image in the canvas, represented as an <spanclass="snippet">[x, y]</span> array.<br>
47
49
Possible values for <spanclass="snippet">x</span>:<ul><li><spanclass="snippet">'left'</span></li><li><spanclass="snippet">'center'</span></li><li><spanclass="snippet">'right'</span></li></ul>Possible values for <spanclass="snippet">y</span>:<ul><li><spanclass="snippet">'top'</span></li><li><spanclass="snippet">'center'</span></li><li><spanclass="snippet">'bottom'</span></li></ul></td></tr><tr><td>stretchMode</td><td>/</td><td>Array</td><td>Does the image have to stretch ? This option is useful for liquid/responsive design.
@@ -88,7 +90,6 @@
88
90
direction: 'diagonal',
89
91
isPausedWhenNotInView: false,
90
92
scrollDebounceThreshold: 300,
91
-
opacity: [1, 1],
92
93
stateTransitionSpeed: 1000,
93
94
image : {
94
95
source: '../assets/img/bg-forest.jpg',
@@ -126,15 +127,13 @@
126
127
}
127
128
);</code></pre><p>You can use more than 2 colors for the gradients,
128
129
but cannot have different length of colors in the
129
-
different states. you will also have to
130
-
<strong>adapt the opacity</strong>.</p><pre><codeclass="language-js">var granimInstance = new Granim({
130
+
different states.</p><pre><codeclass="language-js">var granimInstance = new Granim({
0 commit comments