Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(events): add events from wilderness core
- Loading branch information
1 parent
51858bd
commit ca60f10
Showing
5 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<title>Basic tween</title> | ||
<style> | ||
html, | ||
body { | ||
height: 100%; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
} | ||
|
||
svg { | ||
display: block; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<svg | ||
height="100" | ||
preserveAspectRatio="xMidYMid meet" | ||
width="100" | ||
viewBox="0 0 100 100" | ||
> | ||
</svg> | ||
<script src="dist.js"></script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { shape, render, timeline, play } from '../../src' | ||
|
||
const keyframe1 = { type: 'rect', width: 10, height: 10, x: 0, y: 0 } | ||
const keyframe2 = { type: 'rect', width: 10, height: 10, x: 90, y: 90 } | ||
|
||
const square = shape(keyframe1, keyframe2) | ||
|
||
const playbackOptions = { | ||
alternate: true, | ||
duration: 2000, | ||
iterations: Infinity | ||
} | ||
|
||
const animation = timeline(square, playbackOptions) | ||
|
||
animation.event.subscribe('timeline.start', () => console.log('timeline.start')) | ||
animation.event.subscribe('timeline.finish', () => console.log('timeline.finish')) | ||
animation.event.subscribe('frame', () => console.log('frame')) | ||
|
||
render(document.querySelector('svg'), animation) | ||
|
||
play(animation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters