Нема описа

manual-test.html 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Manual test - Granim</title>
  6. <style>
  7. body {
  8. height: 250vh;
  9. margin: 0;
  10. }
  11. #granim-canvas {
  12. display: block;
  13. width: calc(100% - 100px);
  14. min-width: 200px;
  15. height: calc(100vh - 100px);
  16. min-height: 100px;
  17. margin: 50px;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <canvas id="granim-canvas"></canvas>
  23. <script src="../dist/granim.js"></script>
  24. <script>
  25. var granimInstance = new Granim({
  26. element: '#granim-canvas',
  27. direction: 'left-right',
  28. customDirection: {
  29. x0: '50px',
  30. y0: '00',
  31. x1: '0',
  32. y1: '0'
  33. },
  34. isPausedWhenNotInView: true,
  35. scrollDebounceThreshold: 300,
  36. image: {
  37. source: 'img/800x200.jpg',
  38. position: ['center', 'center'],
  39. stretchMode: ['none', 'stretch-if-bigger'],
  40. // blendingMode: 'multiply'
  41. },
  42. states : {
  43. "default-state": {
  44. gradients: [
  45. [
  46. { color: 'rgba(255, 153, 102, .33)', pos: .5 },
  47. { color: '#ff5e62', pos: 1 }
  48. ], [
  49. { color: 'hsla(144, 100%, 47%, .75)', pos: .1 },
  50. { color: 'hsl(210, 96%, 46%)', pos: .6 }
  51. ],
  52. ],
  53. transitionSpeed: 1000
  54. },
  55. "default-state2": {
  56. gradients: [
  57. [{ color: '#7ffc25', pos: .5 }, { color: 'hsla(144, 100%, 47%, .75)', pos: .8 }],
  58. [{ color: '#AA076B', pos: .1 }, { color: '#7ffc25', pos: .3 }]
  59. ],
  60. transitionSpeed: 1000
  61. }
  62. }
  63. });
  64. setTimeout(function() {
  65. granimInstance.changeState('default-state2');
  66. console.log('State Changed');
  67. }, 2000);
  68. </script>
  69. </body>
  70. </html>