Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partial for #27420 Later work: 1. Scope `<amp-animation>` selectors to its `<amp-story-page>`. 2. Provide all [`getDims()` values](https://github.com/ampproject/amphtml/blob/b6313e372fdd1298928e2417dcc616b03288e051/extensions/amp-story/1.0/animation.js#L159) as `<amp-animation>` config. 3. Support sequencing with `animate-in-after`. 4. Decide on subanimations API: element by id, `subanimations`, or `<style keyframes>`?
- Loading branch information
1 parent
15258f6
commit fdae4db
Showing
8 changed files
with
371 additions
and
139 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
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,85 @@ | ||
<!DOCTYPE html> | ||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>amp-animation inside amp-story</title> | ||
<link rel="canonical" href="." /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width,minimum-scale=1,initial-scale=1" | ||
/> | ||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script | ||
async | ||
custom-element="amp-story" | ||
src="https://cdn.ampproject.org/v0/amp-story-1.0.js" | ||
></script> | ||
<style amp-custom> | ||
body { | ||
font-family: sans-serif; | ||
font-size: 18px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<amp-story standalone> | ||
<amp-story-page id="cover"> | ||
<amp-story-grid-layer template="vertical"> | ||
<strong class="animate">rotate with amp-story-animation</strong> | ||
<div animate-in="fly-in-top" id="first">fly-in with animate-in</div> | ||
<div animate-in="fly-in-top" animate-in-after="first"> | ||
fly-in with animate-in, after the previous element | ||
</div> | ||
</amp-story-grid-layer> | ||
<amp-story-animation layout="nodisplay"> | ||
<!-- | ||
TODO(alanorozco, https://go.amp.dev/issue/27758): | ||
Remove parent for scoping selector. | ||
--> | ||
<script type="application/json"> | ||
{ | ||
"selector": "#cover .animate", | ||
"duration": "1s", | ||
"keyframes": {"transform": "rotate(360deg)"} | ||
} | ||
</script> | ||
</amp-story-animation> | ||
</amp-story-page> | ||
|
||
<amp-story-page id="page1"> | ||
<amp-story-grid-layer template="vertical"> | ||
<strong class="animate"> | ||
bounce forward with amp-story-animation | ||
</strong> | ||
<div animate-in="fly-in-top" id="first">fly-in with animate-in</div> | ||
<div animate-in="fly-in-top" animate-in-after="first"> | ||
fly-in with animate-in, after the previous element | ||
</div> | ||
</amp-story-grid-layer> | ||
<amp-story-animation layout="nodisplay"> | ||
<!-- | ||
TODO(alanorozco, https://go.amp.dev/issue/27758): | ||
Remove parent for scoping selector. | ||
--> | ||
<script type="application/json"> | ||
{ | ||
"selector": "#page1 .animate", | ||
"duration": "0.5s", | ||
"keyframes": [ | ||
{"transform": "scale(1)"}, | ||
{"transform": "scale(1.5)"}, | ||
{"transform": "scale(1)"} | ||
] | ||
} | ||
</script> | ||
</amp-story-animation> | ||
</amp-story-page> | ||
|
||
<amp-story-bookend | ||
src="bookendv1.json" | ||
layout="nodisplay" | ||
></amp-story-bookend> | ||
</amp-story> | ||
</body> | ||
</html> |
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
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
Oops, something went wrong.