-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring "Community components" example into A-Frame Examples. #5211
Merged
dmarcos
merged 14 commits into
aframevr:master
from
diarmidmackenzie:community-components-example
Mar 28, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c2d4760
Copy example from glitch
diarmidmackenzie 3144b8e
Update example to use latest working code
diarmidmackenzie e1d065b
Add link to Community Components example
diarmidmackenzie f739cf8
Consistently use jsdelivr for CDN
diarmidmackenzie 9976d7b
Update Title
diarmidmackenzie 9b7daf5
Update documentation of community components example
diarmidmackenzie ec1e2b0
Fix docs lint error
diarmidmackenzie e758261
Add comment explaining what to do if copy/pasting code.
diarmidmackenzie ef97760
Tidy up.
diarmidmackenzie 5a0f611
Merge remote-tracking branch 'upstream/master' into community-compone…
diarmidmackenzie 7d5b735
Move community components from "showcase" to "docs"
diarmidmackenzie b045d0e
Fix some bad links left over from #5215
diarmidmackenzie 80a8934
Merge remote-tracking branch 'upstream/master' into community-compone…
diarmidmackenzie dc0113f
Use versioned release here
diarmidmackenzie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -451,27 +451,37 @@ Now we can include it into our HTML: | |
</html> | ||
``` | ||
|
||
### Using jsdelivr for CDN | ||
|
||
[jsdelivr]: https://www.jsdelivr.com/ | ||
|
||
[JSDELIVR][jsdelivr] is an alternative CDN to unpkg. One benefit of JSDELIVR is that it can download files from GitHub as well as NPM. | ||
|
||
You can convert unpkg URLs to JSDELIVR URLs using this link: https://www.jsdelivr.com/unpkg | ||
|
||
You can convert GitHub URLs to JSDELIVR URLs using this link: https://www.jsdelivr.com/github | ||
|
||
### Example | ||
|
||
[glitch]: http://glitch.com/~aframe-registry | ||
[community-example]: https://aframe.io/examples/docs/community-components | ||
|
||
![Registry Example](https://cloud.githubusercontent.com/assets/674727/25502318/0f76ceec-2b4b-11e7-9829-cb3784b20dc1.gif) | ||
![Community Components Example](https://cloud.githubusercontent.com/assets/674727/25502318/0f76ceec-2b4b-11e7-9829-cb3784b20dc1.gif) | ||
|
||
Below is a complete example of using various community components from the | ||
Registry and using the unpkg CDN. We can [remix or check out this example on | ||
Glitch][glitch]. | ||
Registry and using the JSDELIVR CDN. This example can also be viewed in the [A-Frame Examples][community-example]. | ||
|
||
```html | ||
<html> | ||
<head> | ||
<script src="https://aframe.io/releases/1.4.0/aframe.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/aframe-animation-component.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/aframe-particle-system-component.min.js"></script> | ||
<script src="https://unpkg.com/aframe-extras.ocean@%5E3.5.x/dist/aframe-extras.ocean.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/gradientsky.min.js"></script> | ||
<title>Community Components Example</title> | ||
<meta name="description" content="Community Components Example"> | ||
<script src="https://aframe.io/releases/1.4.0/aframe.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-particle-system-component@a5a8449/dist/aframe-particle-system-component.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/aframe-simple-sun-sky@^1.2.2/simple-sun-sky.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-extras@d5f3f8/dist/aframe-extras.min.js"></script> | ||
</head> | ||
<body> | ||
<a-scene> | ||
<a-scene> | ||
<a-entity id="rain" particle-system="preset: rain; color: #24CAFF; particleCount: 5000"></a-entity> | ||
|
||
<a-entity id="sphere" geometry="primitive: sphere" | ||
|
@@ -483,11 +493,9 @@ Glitch][glitch]. | |
<a-entity id="ocean" ocean="density: 20; width: 50; depth: 50; speed: 4" | ||
material="color: #9CE3F9; opacity: 0.75; metalness: 0; roughness: 1" | ||
rotation="-90 0 0"></a-entity> | ||
|
||
<a-entity id="sky" geometry="primitive: sphere; radius: 5000" | ||
material="shader: gradient; topColor: 235 235 245; bottomColor: 185 185 210" | ||
scale="-1 1 1"></a-entity> | ||
|
||
|
||
<a-simple-sun-sky sun-position="1 0.4 0"></a-simple-sun-sky> | ||
|
||
<a-entity id="light" light="type: ambient; color: #888"></a-entity> | ||
</a-scene> | ||
</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,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Community Components Example</title> | ||
<meta name="description" content="Community Components Example"> | ||
<!-- If running this example without a local copy of A-Frame, replace this next line with: | ||
<script src="https://aframe.io/releases/<release_number>/aframe.min.js"></script> | ||
--> | ||
<script src="../../../dist/aframe-master.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-particle-system-component@a5a8449/dist/aframe-particle-system-component.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/aframe-simple-sun-sky@^1.2.2/simple-sun-sky.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-extras@d5f3f8/dist/aframe-extras.min.js"></script> | ||
</head> | ||
<body> | ||
<a-scene> | ||
<a-entity id="rain" particle-system="preset: rain; color: #24CAFF; particleCount: 5000"></a-entity> | ||
|
||
<a-entity id="sphere" geometry="primitive: sphere" | ||
material="color: #EFEFEF; shader: flat" | ||
position="0 0.15 -5" | ||
light="type: point; intensity: 5" | ||
animation="property: position; easing: easeInOutQuad; dir: alternate; dur: 1000; to: 0 -0.10 -5; loop: true"></a-entity> | ||
|
||
<a-entity id="ocean" ocean="density: 20; width: 50; depth: 50; speed: 4" | ||
material="color: #9CE3F9; opacity: 0.75; metalness: 0; roughness: 1" | ||
rotation="-90 0 0"></a-entity> | ||
|
||
<a-simple-sun-sky sun-position="1 0.4 0"></a-simple-sun-sky> | ||
|
||
<a-entity id="light" light="type: ambient; color: #888"></a-entity> | ||
</a-scene> | ||
</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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have duplicated code here and the example that have to be in sync. It would be cool if there's a markdown way to display html from the file hosted on gihub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option:
https://github.com/zakhenry/embedme
A limitation is that code fragments are indexable only by line number. If line numbers change, extracts will get out of sync. That's discussed (together with some possible solutions) here but there doesn't seem to be a good solution yet (and momentum has stalled since 2020).
How widespread an issue do you think this is in the docs? Is there enough benefit to be worth the overhead of adding new tools like embedme to the pipeline? Is it worth doing if snippets have to be by line number, rather than tag-based as #48 will enable?