|
| 1 | +<!-- |
| 2 | + If not stated otherwise in this file or this component's LICENSE file the |
| 3 | + following copyright and licenses apply: |
| 4 | +
|
| 5 | + Copyright 2020 Metrological |
| 6 | +
|
| 7 | + Licensed under the Apache License, Version 2.0 (the License); |
| 8 | + you may not use this file except in compliance with the License. |
| 9 | + You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | + Unless required by applicable law or agreed to in writing, software |
| 14 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + See the License for the specific language governing permissions and |
| 17 | + limitations under the License. |
| 18 | +--> |
| 19 | + |
| 20 | +<!DOCTYPE html> |
| 21 | +<html lang="en"> |
| 22 | +<head> |
| 23 | + <meta charset="UTF-8" /> |
| 24 | + |
| 25 | +</head> |
| 26 | +<body style="margin: 0; padding: 0"> |
| 27 | + <script type="module"> |
| 28 | + import lng from '../../dist/src/lightning.mjs'; |
| 29 | + //attachInspector(lng) |
| 30 | + |
| 31 | + window.onload = function() { |
| 32 | + class BasicUsageExample extends lng.Application { |
| 33 | + static _template() { |
| 34 | + return { |
| 35 | + Bg: { |
| 36 | + rect: true, w: 1900, h: 1080, color: 0xFF000000 |
| 37 | + }, |
| 38 | + Block: { |
| 39 | + rect: true, w: 200, h: 200, color: 0xFFFFFFFF, x: 0, y: 300 |
| 40 | + }, |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + start() { |
| 45 | + this.blockAnimation.start() |
| 46 | + } |
| 47 | + |
| 48 | + _init() { |
| 49 | + this.blockAnimation = this.tag('Block').animation({ |
| 50 | + duration: 200 / 100, |
| 51 | + repeat: 0, |
| 52 | + stopMethod: 'immediate', |
| 53 | + // timingFunction: 'cubic-bezier(0.20, 1.00, 0.80, 1.00)', |
| 54 | + actions: [ |
| 55 | + { p: 'x', v: { 0: { v: 0 }, 1: { v: 1900 - 200 } } } |
| 56 | + ], |
| 57 | + }) |
| 58 | + |
| 59 | + console.log('start'); |
| 60 | + this.blockAnimation.start(); |
| 61 | + } |
| 62 | + |
| 63 | + } |
| 64 | + |
| 65 | + const options = {stage: {w: 1900, h: 1080, clearColor: 0xFF000000, canvas2d: false, useImageWorker: false}, debug: true} |
| 66 | + |
| 67 | + const app = new BasicUsageExample(options); |
| 68 | + |
| 69 | + document.body.appendChild(app.stage.getCanvas()); |
| 70 | + } |
| 71 | + </script> |
| 72 | +</body> |
| 73 | +</html> |
0 commit comments