Template:3DCube: Difference between revisions
From SNCApedia, the shit nobody cares about encyclopedia
Jump to navigationJump to search
SomebodyRum (talk | contribs) No edit summary |
SomebodyRum (talk | contribs) heavy rework (a forked version by Clarification needed with a modular thing for it) thanks to him for his contribution |
||
| Line 1: | Line 1: | ||
<!-- | |||
================================================== | ================================================== | ||
TEMPLATE NAME: 3DCube | TEMPLATE NAME: 3DCube | ||
A hollow, tumbling 3D cube that accepts any wikitext | |||
(images, text, or templates) on its 6 faces. | |||
================================================== | ================================================== | ||
USAGE: | USAGE: | ||
{{3DCube | {{3DCube | ||
| | | size = | ||
| front = | | front = | ||
| back = | | back = | ||
| right = | |||
| left = | | left = | ||
| top = | | top = | ||
| bottom = | | bottom = | ||
}} | }} | ||
PARAMETERS: | PARAMETERS: | ||
- size: Target width/height of the cube in pixels. Defaults to 200. | - size: Target width/height of the cube in pixels. Defaults to 200. | ||
- | - front, back, right, left, top, bottom: The arbitrary wikitext to display on each side. | ||
================================================== | ================================================== | ||
--> | --> | ||
<templatestyles src="Template:3DCube/style.css"/> | |||
<templatestyles src="Template:3DCube/style.css" /> | <div class="cc-scene" style="perspective: 600px; width: {{{size|200}}}px; height: {{{size|200}}}px;"> | ||
<div style=" | <div class="cc-cube" style="transform-style: preserve-3d; transform: translateZ(-{{#expr: {{{size|200}}} / 2}}px) rotate3d(1,0,0,60deg) rotate3d(0,0,1,40deg);"> | ||
<div class="cc-center" style="transform-style: preserve-3d;"> | |||
<div class="cc-side front" style="transform: rotateY(0deg) translateZ({{#expr: {{{size|200}}} / 2}}px);"> | |||
{{{front|}}} | |||
</div> | |||
<div class="cc-side back" style="transform: rotateY(180deg) translateZ({{#expr: {{{size|200}}} / 2}}px);"> | |||
{{{back|}}} | |||
</div> | |||
<div class="cc-side right" style="transform: rotateY(90deg) translateZ({{#expr: {{{size|200}}} / 2}}px) rotateZ(-90deg);"> | |||
{{{right|}}} | |||
</div> | |||
<div class="cc-side left" style="transform: rotateY(-90deg) translateZ({{#expr: {{{size|200}}} / 2}}px) rotateZ(90deg);"> | |||
{{{left|}}} | |||
</div> | |||
<div class="cc-side top" style="transform: rotateX(90deg) translateZ({{#expr: {{{size|200}}} / 2}}px) rotateZ(180deg);"> | |||
{{{top|}}} | |||
</div> | |||
</div> | <div class="cc-side bottom" style="transform: rotateX(-90deg) translateZ({{#expr: {{{size|200}}} / 2}}px);"> | ||
{{{bottom|}}} | |||
<noinclude> | </div> | ||
</div> | |||
</div> | |||
</div><noinclude> | |||
== Usage == | == Usage == | ||
Because the template uses transparent walls, make sure any images you use are transparent PNGs or SVGs to get the best "see-through" effect. | |||
'''Mixed content example:''' | |||
<pre> | <pre> | ||
{{3DCube | {{3DCube | ||
| size = | | size = 250 | ||
| | | front = [[File:Transparent_Image.png|200px]] | ||
| | | back = <span class="cc-text">HELLO<br>WORLD</span> | ||
| top = | | left = Just some plain text! | ||
| | | right = [[File:Another_Image.png|200px]] | ||
| top = <span class="cc-text">TOP</span> | |||
| bottom = <span class="cc-text">BOTTOM</span> | |||
}} | }} | ||
</pre> | </pre> | ||
[[Category:Formatting templates]] | [[Category:Formatting templates]] | ||
</noinclude> | </noinclude> | ||
Revision as of 20:18, 13 April 2026
Usage
Because the template uses transparent walls, make sure any images you use are transparent PNGs or SVGs to get the best "see-through" effect.
Mixed content example:
{{3DCube
| size = 250
| front = [[File:Transparent_Image.png|200px]]
| back = <span class="cc-text">HELLO<br>WORLD</span>
| left = Just some plain text!
| right = [[File:Another_Image.png|200px]]
| top = <span class="cc-text">TOP</span>
| bottom = <span class="cc-text">BOTTOM</span>
}}